(function(d){var c=false;d.fn.resizable=function(a,b){if(typeof a=="string"){return d.fn.resizable.methods[a](this,b)}function j(i){var e=i.data;var f=d.data(e.target,"resizable").options;if(e.dir.indexOf("e")!=-1){var g=e.startWidth+i.pageX-e.startX;g=Math.min(Math.max(g,f.minWidth),f.maxWidth);e.width=g}if(e.dir.indexOf("s")!=-1){var h=e.startHeight+i.pageY-e.startY;h=Math.min(Math.max(h,f.minHeight),f.maxHeight);e.height=h}if(e.dir.indexOf("w")!=-1){e.width=e.startWidth-i.pageX+e.startX;if(e.width>=f.minWidth&&e.width<=f.maxWidth){e.left=e.startLeft+i.pageX-e.startX}}if(e.dir.indexOf("n")!=-1){e.height=e.startHeight-i.pageY+e.startY;if(e.height>=f.minHeight&&e.height<=f.maxHeight){e.top=e.startTop+i.pageY-e.startY}}}function m(e){var f=e.data;var g=f.target;if(!d.boxModel&&d.browser.msie){d(g).css({width:f.width,height:f.height,left:f.left,top:f.top})}else{d(g).css({width:f.width-f.deltaWidth,height:f.height-f.deltaHeight,left:f.left,top:f.top})}}function k(e){c=true;d.data(e.data.target,"resizable").options.onStartResize.call(e.data.target,e);return false}function l(e){j(e);if(d.data(e.data.target,"resizable").options.onResize.call(e.data.target,e)!=false){m(e)}return false}function n(e){c=false;j(e,true);m(e);d.data(e.data.target,"resizable").options.onStopResize.call(e.data.target,e);d(document).unbind(".resizable");d("body").css("cursor","auto");return false}return this.each(function(){var e=null;var f=d.data(this,"resizable");if(f){d(this).unbind(".resizable");e=d.extend(f.options,a||{})}else{e=d.extend({},d.fn.resizable.defaults,a||{});d.data(this,"resizable",{options:e})}if(e.disabled==true){return}d(this).bind("mousemove.resizable",{target:this},function(i){if(c){return}var h=g(i);if(h==""){d(i.data.target).css("cursor","")}else{d(i.data.target).css("cursor",h+"-resize")}}).bind("mousedown.resizable",{target:this},function(i){var h=g(i);if(h==""){return}function q(p){var o=parseInt(d(i.data.target).css(p));if(isNaN(o)){return 0}else{return o}}var r={target:i.data.target,dir:h,startLeft:q("left"),startTop:q("top"),left:q("left"),top:q("top"),startX:i.pageX,startY:i.pageY,startWidth:d(i.data.target).outerWidth(),startHeight:d(i.data.target).outerHeight(),width:d(i.data.target).outerWidth(),height:d(i.data.target).outerHeight(),deltaWidth:d(i.data.target).outerWidth()-d(i.data.target).width(),deltaHeight:d(i.data.target).outerHeight()-d(i.data.target).height()};d(document).bind("mousedown.resizable",r,k);d(document).bind("mousemove.resizable",r,l);d(document).bind("mouseup.resizable",r,n);d("body").css("cursor",h+"-resize")}).bind("mouseleave.resizable",{target:this},function(h){d(h.data.target).css("cursor","")});function g(B){var A=d(B.data.target);var i="";var D=A.offset();var h=A.outerWidth();var w=A.outerHeight();var x=e.edge;if(B.pageY>D.top&&B.pageY<D.top+x){i+="n"}else{if(B.pageY<D.top+w&&B.pageY>D.top+w-x){i+="s"}}if(B.pageX>D.left&&B.pageX<D.left+x){i+="w"}else{if(B.pageX<D.left+h&&B.pageX>D.left+h-x){i+="e"}}var y=e.handles.split(",");for(var C=0;C<y.length;C++){var z=y[C].replace(/(^\s*)|(\s*$)/g,"");if(z=="all"||z==i){return i}}return""}})};d.fn.resizable.methods={options:function(a){return d.data(a[0],"resizable").options},enable:function(a){return a.each(function(){d(this).resizable({disabled:false})})},disable:function(a){return a.each(function(){d(this).resizable({disabled:true})})}};d.fn.resizable.defaults={disabled:false,handles:"n, e, s, w, ne, se, sw, nw, all",minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000,edge:5,onStartResize:function(a){},onResize:function(a){},onStopResize:function(a){}}})(jQuery);