function Space_Memcp(){this.init=function(){Drag.rootTable=$("parentTable");Drag.mozinit()};this.dragStart=function(){};this.onDrag=function(a,h){for(var d=0;d<Drag.rootTable.cells.length;d++){var e=Drag.getInfo(Drag.rootTable.cells[d]);if(a>=e.left&&a<=e.right&&h>=e.top&&h<=e.bottom){var g=Drag.rootTable.cells[d].id.replace("main_layout","");if((","+Drag.disable+",").indexOf(","+g+",")!=-1){return}var b=Drag.rootTable.cells[d].getElementsByTagName("DIV");if(b.length==0){if(a>=e.left&&a<=e.right&&h>=e.top&&h<=e.bottom){Drag.rootTable.cells[d].appendChild(Drag.obj);Drag.handler.resize()}break}Drag.layout=g;for(var c=0;c<b.length;c++){var f=Drag.getInfo(b[c]);if(a>=f.left&&a<=f.right&&h>=f.top&&h<=f.bottom){Drag.rootTable.cells[d].insertBefore(Drag.obj,b[c]);Drag.handler.resize();break}else{Drag.rootTable.cells[d].appendChild(Drag.obj);Drag.handler.resize()}}}}};this.dragEnd=function(){var a=Drag.obj;do{if(!a.previousSibling){a=a.parentNode;break}a=a.previousSibling}while(a.tagName!="DIV");a=a.id;if(Drag.layout!=null){Drag.handler.clearResult(Drag.obj);if(layout[Drag.layout].indexOf(a)!=-1){layout[Drag.layout]=layout[Drag.layout].replace("["+a+"]","["+a+"]["+Drag.obj.id+"]")}else{layout[Drag.layout]="["+Drag.obj.id+"]["+layout[Drag.layout]+"]"}Drag.handler.trimResult()}};this.resize=function(){Drag.tdiv.style.width=Drag.obj.offsetWidth+"px"};this.del=function(b){try{if($("check_"+b.id)){$("check_"+b.id).checked=false;$("menuitem_"+b.id).style.display="none"}}catch(a){}Drag.handler.clearResult(b);Drag.handler.trimResult();b.parentNode.removeChild(b)};this.add=function(a,e,c,b){var d=$("dragClone").innerHTML;layoutid="main_layout"+a;if($(layoutid).style.display=="none"){if(a==2){a=0}else{if(a==0){a=2}}layoutid="main_layout"+a}d=d.replace(/\[id\]/g,e);d=d.replace(/\[title\]/g,c);d=d.replace("[disable]",b);$(layoutid).innerHTML+=d;layout[a]+="["+e+"]";Drag.handler.trimResult()};this.check=function(a,g,j,c){var h=0;for(var f in layout){var k="]"+layout[f]+"[";k=k.split("][");for(var b in k){if(k[b]==g){h=1;break}}}try{if(h){Drag.handler.del($(g));$("menuitem_"+g).style.display="none"}else{Drag.handler.add(a,g,j,c);$("menuitem_"+g).style.display=""}}catch(d){}};this.clearResult=function(a){for(i=0;i<layout.length;i++){layout[i]=layout[i].replace("["+a.id+"]","")}};this.trimResult=function(){for(i=0;i<layout.length;i++){layout[i]=layout[i].replace("[]","");layout[i]=layout[i].replace("[[","[");layout[i]=layout[i].replace("]]","]")}}}function clearSide(b){if(b==0){targetside=2}else{if(b==2){targetside=0}else{return}}targetcellid="main_layout"+targetside;layout[targetside]+=layout[b];var c="]"+layout[b]+"[";c=c.split("][");for(var a in c){if(c[a]!=""){$(targetcellid).appendChild($(c[a]))}}layout[b]=""}function leftSide(){$("main_layout0").style.display="";$("main_layout2").style.display="none";$("side_1").checked=true;tmp_spaceside=1;clearSide(2);Drag.mozinit()}function rightSide(){$("main_layout0").style.display="none";$("main_layout2").style.display="";$("side_2").checked=true;tmp_spaceside=2;clearSide(0);Drag.mozinit()}function bothSide(){$("main_layout0").style.display="";$("main_layout2").style.display="";$("side_0").checked=true;tmp_spaceside=0;Drag.mozinit()}function setStyle(b,a){$("style_"+b).checked=true;$("stylecss").href="";$("stylecss").href="mspace/"+b+"/style.css";tmp_styledir=b;if(is_ie){$("stylecss").onload=setStyleonLoad}}function setStyleonLoad(){var a=document.styleSheets.stylecss.rules;for(i in a){if(a[i].selectorText=="#menu_top"&&a[i].style.width){$("menu_top").style.width=a[i].style.width}if(a[i].selectorText=="#header"&&a[i].style.width){$("header").style.width=a[i].style.width}if(a[i].selectorText=="#header DIV.bg"&&a[i].style.width){$("headerbg").style.width=a[i].style.width}if(a[i].selectorText=="#menu"&&a[i].style.width){$("menu").style.width=a[i].style.width}if(a[i].selectorText==".outer"&&a[i].style.width){$("outer").style.width=a[i].style.width}if(a[i].selectorText=="#footer"&&a[i].style.width){$("footer").style.width=a[i].style.width}}}function saveLayout(){if(layout[1]==""){alert(space_layout_nocenter)}else{$("spacelayout0").value=layout[0];$("spacelayout1").value=layout[1];$("spacelayout2").value=layout[2];$("dragform").submit()}}function previewLayout(a){if(layout[1]==""){alert(space_layout_nocenter)}else{if(layout[0]==""){tmp_spaceside=2}if(layout[2]==""){tmp_spaceside=1}window.open("space.jsp?uid="+a+"&preview="+layout[0]+"|"+layout[1]+"|"+layout[2]+"&spaceside="+tmp_spaceside+"&style="+tmp_styledir,"","")}}function previewtext(a,b){if(a=="pre_title"&&b==""){b=$("pre_title_default").innerHTML}$(a).innerHTML=htmlspecialchars(b)}function checkinit(a){try{if($("check_"+a)){$("check_"+a).checked=true;$("menuitem_"+a).style.display=""}}catch(b){}};
