var params={right:0,bottom:0,currentX:0,currentY:0,flag:false};var getCss=function(o,key){return o.currentStyle?o.currentStyle[key]:document.defaultView.getComputedStyle(o,false)[key];};var startDrag=function(bar,target,callback){if(getCss(target,"right")!=="auto"){params.right=getCss(target,"right");}
if(getCss(target,"bottom")!=="auto"){params.bottom=getCss(target,"bottom");}
bar.onmousedown=function(event){params.flag=true;if(!event){event=window.event;bar.onselectstart=function(){return false;};}
var e=event;params.currentX=e.clientX;params.currentY=e.clientY;};document.onmouseup=function(){params.flag=false;if(getCss(target,"right")!=="auto"){params.right=getCss(target,"right");}
if(getCss(target,"bottom")!=="auto"){params.bottom=getCss(target,"bottom");}};document.onmousemove=function(event){var e=event?event:window.event;if(params.flag){var nowX=e.clientX,nowY=e.clientY;var disX=nowX-params.currentX,disY=nowY-params.currentY;target.style.right=parseInt(params.right)-disX+"px";target.style.bottom=parseInt(params.bottom)-disY+"px";}
if(typeof callback=="function"){callback(parseInt(params.right)+disX,parseInt(params.bottom)+disY);}};};