(function(e){e.fn.jqDrag=function(f){return b(this,f,"d")};e.fn.jqResize=function(f){return b(this,f,"r")};e.jqDnR={dnr:{},e:0,drag:function(f){if(g.k=="d"){d.css({left:g.X+f.pageX-g.pX,top:g.Y+f.pageY-g.pY})}else{d.css({width:Math.max(f.pageX-g.pX+g.W,0),height:Math.max(f.pageY-g.pY+g.H,0)})}return false},stop:function(){d.css("opacity",g.o);e(document).unbind("mousemove",a.drag).unbind("mouseup",a.stop)}};var a=e.jqDnR,g=a.dnr,d=a.e,b=function(j,i,f){return j.each(function(){i=(i)?e(i,j):j;i.bind("mousedown",{e:j,k:f},function(h){var m=h.data,l={};d=m.e;if(d.css("position")!="relative"){try{l=d.position()}catch(k){}}g={X:l.left||c("left")||0,Y:l.top||c("top")||0,W:c("width")||d[0].scrollWidth||0,H:c("height")||d[0].scrollHeight||0,pX:h.pageX,pY:h.pageY,k:m.k,o:d.css("opacity")};d.css({opacity:0.8});e(document).mousemove(e.jqDnR.drag).mouseup(e.jqDnR.stop);return false})})},c=function(f){return parseInt(d.css(f))||false}})(jQuery);