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