function setCk() {
    poovl="";
    for(i = 1;i < 9;i++) {
        if($("cnt"+i)) {
            if($("cnt"+i).visible()) {
                poovl += i+"_"+"o"+",";
            } else {
                poovl += i+"_"+"c"+",";
            }
        }
    }
    document.cookie = "pane="+Sortable.sequence('rightpane')+"*"+poovl+"; expires=Thu, 1-Jan-2030 00:00:00 GMT";
}

function paneOnOff(pn) {
    if($("cnt"+pn).visible()) {
        $("cnt"+pn).style.display = "none";
        $("mkcnt"+pn).src="skin/default/img/icon_title_1.gif";
    } else {
        $("cnt"+pn).style.display = "block";
        $("mkcnt"+pn).src="skin/default/img/icon_title_1_minus.gif";
    }
    setCk();
}

function paneOnOffInit(pn) {
    if($("cnt"+pn)) {
        $("cnt"+pn).style.display = "none";
        $("mkcnt"+pn).src="skin/default/img/icon_title_1.gif";
        }
}

ckary = document.cookie.split("; ");
ckstr = "";
i = 0;
while (ckary[i]) {
    if (ckary[i].substr(0,5) == "pane=") {
        ckstr = ckary[i].substr(5,ckary[i].length);
        break;
    }
    i++;
}
if(ckstr == "") {
    ckstr="1,2,3,4,5,6,7,8*1_o,2_o,3_o,4_o,5_o,6_o,7_o,8_o";
    }
ckstrcat = ckstr.split("*");
ckstrary = ckstrcat[0].split(",");
ckstrary2 = ckstrcat[1].split(",");
var panecnt="";
for(i = 0;i < ckstrary.length;i++) {
    panecnt += $("dv"+ckstrary[i]).innerHTML;
}
for(p = 1;p < 9;p++) {
    if($("dv"+p).innerHTML != '' && ckstrcat[1].indexOf(p,0) == -1) {
        panecnt = $("dv"+p).innerHTML + panecnt;
    }
}
$('rightpane').innerHTML = panecnt;
for(i = 0;i < ckstrary2.length;i++) {
    ckstrary3 = ckstrary2[i].split("_");
    if(ckstrary3[1] == 'c') {
        paneOnOffInit(ckstrary3[0]);
    }
}
Sortable.create('rightpane',{
    tag:'div',
    dropOnEmpty:true,
    handle:'b_b c_00',
    containment:'rightpane',
    constraint:false,
    onUpdate:function() {
        setCk();
    }
});