var _Event=new Moz_event();var Drag=new Drag_Events();is_moz=is_moz||is_opera;function Moz_event(){this.srcElement=null,this.setEvent=function(a){_Event.srcElement=a.target;_Event.clientX=a.clientX;_Event.clientY=a.clientY}}function Drag_Events(){this.handler=null;this.dragged=false;this.obj=null;this.tdiv=null;this.rootTable=null;this.layout=null;this.disable=null;this.getEvent=function(){if(is_ie){return event}else{if(is_moz){return _Event}}};this.dragStart=function(b,a){if(Drag.dragged){return}Drag.disable=a;if(is_ie){document.body.onselectstart=function(){return false}}Drag.obj=Drag.getEvent().srcElement;if(Drag.obj.tagName=="TD"||Drag.obj.tagName=="TR"){Drag.obj=Drag.obj.offsetParent.parentNode;Drag.obj.style.zIndex=100}else{if(Drag.obj.parentNode.tagName=="TD"||Drag.obj.parentNode.tagName=="TR"){Drag.obj=Drag.obj.parentNode;Drag.obj=Drag.obj.offsetParent.parentNode;Drag.obj.style.zIndex=100}else{if(Drag.obj.tagName=="DIV"){Drag.obj=Drag.obj.parentNode;Drag.obj.style.zIndex=100}else{return}}}Drag.dragged=true;Drag.tdiv=document.createElement("DIV");Drag.tdiv.innerHTML=Drag.obj.innerHTML;Drag.tdiv.className="tempDIV";Drag.tdiv.style.filter="alpha(opacity=50)";Drag.tdiv.style.opacity=0.5;Drag.tdiv.style.width=Drag.obj.offsetWidth+"px";Drag.tdiv.style.Height=Drag.obj.offsetHeight+"px";Drag.tdiv.style.top=Drag.getInfo(Drag.obj).top+"px";Drag.tdiv.style.left=Drag.getInfo(Drag.obj).left+"px";Drag.obj.parentNode.appendChild(Drag.tdiv);Drag.lastX=Drag.getEvent().clientX;Drag.lastY=Drag.getEvent().clientY;Drag.lastLeft=parseInt(Drag.tdiv.style.left);Drag.lastTop=parseInt(Drag.tdiv.style.top);Drag.lastTop=parseInt(Drag.lastTop)-document.body.scrollTop;if(is_ie){b.returnValue=false}else{b.preventDefault()}Drag.handler.dragStart()};this.onDrag=function(){if((!Drag.dragged)||Drag.obj==null){return}var a=Drag.getEvent().clientX;var c=Drag.getEvent().clientY;Drag.tdiv.style.left=(parseInt(Drag.lastLeft)+a-Drag.lastX)+"px";Drag.tdiv.style.top=(parseInt(Drag.lastTop)+c-Drag.lastY)+"px";Drag.tdiv.style.top=(parseInt(Drag.tdiv.style.top)+document.body.scrollTop)+"px";c=c+document.body.scrollTop;Drag.handler.onDrag(a,c);var b=Drag.getInfo(Drag.tdiv);if(a>b.right){Drag.tdiv.style.left=a-20+"px"}if(c>b.bottom){Drag.tdiv.style.top=c-10+"px"}};this.dragEnd=function(){if(is_ie){document.body.onselectstart=function(){return true}}if(!Drag.dragged){return}Drag.dragged=false;Drag.handler.dragEnd();Drag.obj.style.zIndex=1;Drag.tdiv.parentNode.removeChild(Drag.tdiv);Drag.obj=null};this.getInfo=function(c){var d=new Object();d.left=d.right=d.top=d.bottom=0;var a=c.offsetWidth;var b=c.offsetHeight;while(c){d.left+=c.offsetLeft;d.top+=c.offsetTop;c=c.offsetParent}d.right=d.left+a;d.bottom=d.top+b;return d};this.mozinit=function(){if(is_moz){Drag.rootTable.cells=new Array();var b=Drag.rootTable.getElementsByTagName("TD");for(var a=0;a<b.length;a++){if(b[a].offsetParent==Drag.rootTable){Drag.rootTable.cells.push(b[a])}}}};this.init=function(a){Drag.handler=new a();Drag.handler.init();if(is_ie){document.onmousemove=Drag.onDrag;document.onmouseup=Drag.dragEnd}else{if(is_moz){document.body.setAttribute("onMouseMove","_Event.setEvent(event);Drag.onDrag();");document.body.setAttribute("onMouseUp","_Event.setEvent(event);Drag.dragEnd();")}}}};
