var DragDrop=new Object();DragDrop.Mod=function(){var self=this;var mouseX;var mouseY;var colArrayPos=new Array();this.col;this.Obj=null;this.inCol=null;this.init=function(n){var divs=$A(self.Obj.getElementsByTagName("div"));divs.each(function(o){if(o.getAttribute("rel")&&o.getAttribute("rel")=="fordrag"){Event.observe(o,"mousedown",self.onStartDrag,false);};});var closeDivs=Element.getElementsByClassName(self.Obj,"closebox");closeDivs.each(function(element){element.onclick=close_div.bindAsEventListener(this);});var hideDivs=Element.getElementsByClassName(self.Obj,"minbox");hideDivs.each(function(element){element.onclick=hide_div.bindAsEventListener(this);});};this.onStartDrag=function(evt){var getPos;evt=Common.fixEvent(evt);var element=Event.element(evt);if(element.tagName=="LI"){return;};self.Obj.startDrag=true;colArrayPos=new Array();getPos=new DragUtil.findPos(self.Obj);var tmpGhost=document.createElement("DIV");tmpGhost.className="modGhost";tmpGhost.id="modGhost";tmpGhost.name=self.col;tmpGhost.style.height=parseFloat(getPos.height)-2+"px";self.Obj.parentNode.insertBefore(tmpGhost,self.Obj);self.Obj.style.position="absolute";self.Obj.style.width="100%";self.Obj.style.top=parseFloat(getPos.top)-4+"px";self.Obj.style.left=parseFloat(getPos.left)-4+"px";if(Common.Browser.isIE)self.Obj.style.filter="alpha(opacity=50);";else self.Obj.style.MozOpacity=0.8;mouseX=evt.clientX-parseInt(self.Obj.style.left);mouseY=evt.clientY-parseInt(self.Obj.style.top);if(document.body.setCapture)document.body.setCapture();else if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);Event.observe(document,"mousemove",self.onDrag,false);Event.observe(document,"mouseup",self.endDrag,false);for(var i=0;i<2;i++){colArrayPos[i]=new DragUtil.findPos($("col_div"+i));};};this.onDrag=function(evt){evt=Common.fixEvent(evt);var inCol;var x=parseFloat(self.Obj.style.left);var y=parseFloat(self.Obj.style.top);for(var i=0;i<colArrayPos.length;i++){if((x+parseFloat(self.Obj.offsetWidth)/2)>=parseFloat(colArrayPos[i].left))inCol=$("col_div"+i);};var tmpGhost=document.createElement("DIV");tmpGhost.className=$("modGhost").className;tmpGhost.id=$("modGhost").id;tmpGhost.name=$("modGhost").name;tmpGhost.style.height=$("modGhost").style.height;if(self.Obj.getAttribute("_for")&&self.Obj.getAttribute("_for")!=inCol.id){self.Obj.style.left=evt.clientX-mouseX+"px";self.Obj.style.top=evt.clientY-mouseY+"px";return;};var isExtend=false;isExtend=self.Obj.getAttribute("extendfor")==inCol.id;if(self.Obj.getAttribute("extendfor")){$A(self.Obj.getElementsByTagName("DIV")).each(function(o){if(o.getAttribute("extend")&&o.getAttribute("extend")=="true"){if(isExtend){o.className="show";}else{o.className=o.getAttribute("isdefault")?"show":"hide";};};})};if($("modGhost").name!=inCol.id){Element.remove($("modGhost"));tmpGhost.name=inCol.id;inCol.appendChild(tmpGhost);};var ghostPos=new DragUtil.findPos($("modGhost"));var colArr=DragUtil.getColArr(inCol);var ghostIndex=DragUtil.getGhostIndex(colArr);if(ghostIndex!=0&&y<=parseFloat((new DragUtil.findPos(colArr[ghostIndex-1])).top)){Element.remove($("modGhost"));inCol.insertBefore(tmpGhost,colArr[ghostIndex-1]);};if(ghostIndex!=(colArr.length-1)&&y>=parseFloat((new DragUtil.findPos(colArr[ghostIndex+1])).top)){Element.remove($("modGhost"));if(colArr[ghostIndex+2]){inCol.insertBefore(tmpGhost,colArr[ghostIndex+2]);}else{inCol.appendChild(tmpGhost);};};self.Obj.style.left=evt.clientX-mouseX+"px";self.Obj.style.top=evt.clientY-mouseY+"px";return false;};this.endDrag=function(evt){self.Obj.startDrag=false;$("modGhost").parentNode.insertBefore(self.Obj,$("modGhost"));Element.remove($("modGhost"));if(Common.Browser.isIE)self.Obj.style.filter="alpha(opacity=100);";else self.Obj.style.MozOpacity=1;self.Obj.style.position="static";self.Obj.style.width="auto";if(document.body.releaseCapture)document.body.releaseCapture();else if(window.releaseEvents)window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);Event.stopObserving(document,"mousemove",self.onDrag,false);Event.stopObserving(document,"mouseup",self.endDrag,false);self.after_Drag();};this.after_Drag=function(){savemod(self.endDrag_callback);};this.endDrag_callback=function(req){};};