function change_sort_order(order, object) {
    // in order to get the next div id (for swap innerHTML), get the next sibling of the div,
    // make a copy of the current innerHTML of the current child which is going to be overwritten
    // paste the copy in the next_sibling and paste the copy in the old sibling

    var element_properties = object.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
//    alert(element_properties.id);
    var DIV_nextSibling = (order == "down") ? getNextSibling(element_properties) : getPreviousSibling(element_properties);

    var currentSibling = element_properties;

        var currentId = currentSibling.id;
        var nextId = DIV_nextSibling.id;

        var currentHTML = currentSibling.innerHTML;
        var nextHTML = DIV_nextSibling.innerHTML;

        currentSibling.id = nextId;
        DIV_nextSibling.id = currentId;

        currentSibling.innerHTML = nextHTML;
        DIV_nextSibling.innerHTML = currentHTML;

        ready = false;

        url = document.location.href.split("&");
//        alert(url[0] + "&action=change_sort_order&swap_id_one="+currentId+"&swap_id_two="+nextId);
        ajaxRead(url[0] + "&action=change_sort_order&swap_id_one="+currentId+"&swap_id_two="+nextId, "ajax");
        change_background(element_properties, currentId);
}


function change_background(parent, id) {
//    alert(parent.style.border = "solid yellow 10px");
    //// loop door alle tables heen, zoek op background color, en als het yellow is maak het blue.. want alleen de laatste div
    //// moet geel zijn

//    document.getElementById(id).style.border = "solid black 10px";
//    alert(document.getElementById(id).style.border = "solid black 10px");
//    alert(parent.id);
    document.getElementById(id).style.border = "solid yellow 10px";
    var parent_div = document.getElementById(id).parentNode;
    var child_div = parent_div.firstChild;

    child_div.style.border = "solid black 10px";
//    alert(child_div.id);
//    parent_div.style.border = "solid black 10px";
//    alert(parent_div.innerHTML);
    var len = parent_div.childNodes.length;
//    alert("aantal rows = "+len);
    for(var i = 0; i < len; i++)
    {
        var table_row = parent_div.childNodes[i];
//        alert(parent_div.childNodes[i].innerHTML);

//      table_row.style.border = "solid black 10px";

        if(table_row.id == "tr"+id) {
            alert(table_row.id);
            table_row.style.backgroundColor = "yellow";
        } else {
            table_row.style.backgroundColor = "";
        }
    }
}
