function serializeDashboard(position){
    switch (position)
    {
        case '0':
            new Ajax.Request('/dashboard/order',{asynchronous:true, evalScripts:true, parameters:Sortable.serialize('firstlist')});
            break;
        case '1':
            new Ajax.Request('/dashboard/order',{asynchronous:true, evalScripts:true, parameters:Sortable.serialize('secondlist')});
            break;
        case '2':
            new Ajax.Request('/dashboard/order',{asynchronous:true, evalScripts:true, parameters:Sortable.serialize('thirdlist')});
            break;
    }
}
function changeState(idx){
    new Ajax.Request('/dashboard/change_state',{asynchronous:true, evalScripts:true, parameters:'id='+idx});    
    //new Ajax.Request('/dashboard/ch');
    //alert(idx);
    //{asynchronous:true, evalScripts:true, parameters:{id:'293'}}
}
function loadingAddItem(){
    $('dash_column_loading').toggle();
}
function enableSortables(){
    disableSortables();
    Sortable.create("firstlist", {constraint:false, containment:['firstlist','secondlist','thirdlist'], dropOnEmpty:true,handle:'header', onUpdate:function(){new Ajax.Request('/dashboard/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("firstlist")})}});
    Sortable.create("secondlist", {constraint:false, containment:['firstlist','secondlist','thirdlist'], dropOnEmpty:true,handle:'header', onUpdate:function(){new Ajax.Request('/dashboard/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("secondlist")})}});
    Sortable.create("thirdlist", {constraint:false, containment:['firstlist','secondlist','thirdlist'], dropOnEmpty:true,handle:'header', onUpdate:function(){new Ajax.Request('/dashboard/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("thirdlist")})}});
}
function disableSortables(){
    Sortable.destroy("firstlist");
    Sortable.destroy("secondlist");
    Sortable.destroy("thirdlist");
}