/*
 * jQuery Dynamic Library 3
 *
 * http://code.google.com/p/jquery-dynamic/
 * licensed under the MIT license
 *
 * author: john kuindji
 */
(function(F){var H=false;F(window).one("load",function(){H=true});var G=["w","s","e","n","sw","se","ne","nw"];var J={s:"nw",se:"nw",e:"nw",sw:"ne",w:"ne",ne:"sw",n:"sw",nw:"se"};var B={events:{},localBind:function(L,N,M){if(arguments.length==3){var O={};O[L]=N}else{var O=L;M=N}for(var L in O){if(!O[L]){continue}if(this.events[L]==undefined){this.events[L]=[]}this.events[L].push({fn:O[L],scope:M})}return this},localTrigger:function(L,O){if(this.events[L]==undefined){return true}var N=this.events[L].length;var M=-1;while(N--,N>=0){var P=this.events[L][N];M=P.fn.call(P.scope,O);if(M==false){return M}}return M},bind:function(M,O,L){if(!O){return this}var N=M+"."+this.eventNamespace;if(L){N+="."+L}this.o.unbind(N);this.o.bind(N,O);this.wrapEventHandle(M);return this},trigger:function(L,N,O){if(this.localEvents){return this.localTrigger(L,N)}if(!O&&this.wrapEventHandle(L)===false){return }var M=jQuery.Event({type:L+"."+this.eventNamespace});this.o.trigger(M,N);return M.result},wrapEventHandle:function(L){var M=jQuery.data(this.dom,"events");if(!M||!M[L]){return false}var N=this;F.each(M[L],function(P){if(this.dnmcModified){return true}if(this.type.indexOf(N.eventNamespace)<0){return true}var O=this;M[L][P]=function(){return O.call(N.opt.scope,arguments[1])};M[L][P].type=O.type;M[L][P].guid=O.guid;M[L][P].dnmcModified=true})}};var E=function(L){this.dom=L;this.o=F(L);this.positionGrid=this.gridStart=this.sizeGrid=this.bounds=this.ratio=this.cssPosition=this.offset=this.position=this.margin=this.size=this.sizeRelated=this.cssSize=this.sParent=this.oParent=this.scrollIsRoot=this.offsetIsRoot=this.so=this.po=this.r=this.scrollIsOuter=this.min=this.max=this.rectCache=false;this.checkPositionGrid=this.checkResizeGrid=this.checkRatio=true;this.sizeGridStart="nw";this.ratioCorrectionMode="w";this.sizeChangeOnly=false};E.prototype={scrollParent:function(){var L=this.o.parents().filter(function(){return(/(auto|scroll)/).test(F.curCSS(this,"overflow",1)+F.curCSS(this,"overflow-y",1)+F.curCSS(this,"overflow-x",1))}).eq(0);return !L.length?F(document):L},prepare:function(){return this.prepareGeneral().prepareSizeRelated().preparePosition()},prepareGeneral:function(){this.prepareAbsolute();var R=this.o.offsetParent(),S=this.scrollParent(),P={top:0,left:0},M=false,L=false;var Q=S[0]==document||/body|html/i.test(S[0].tagName),N=R[0]==document||/body|html/i.test(R[0].tagName),O=S;if(!Q&&!N){while((O=O.parent())&&!(O[0]==document||/body|html/i.test(O[0].tagName))){if(O[0]==S[0]){L=true;break}}}if(!N){M=R.offset()}if(!M){M={left:0,top:0,bl:0,bt:0}}else{M.bl=0;M.bt=0}if(N&&!Q&&"fixed"!=this.cssPosition&&"static"!=S.css("position")){M.bl=parseInt(S.css("borderLeftWidth"),10)||0;M.bt=parseInt(S.css("borderTopWidth"),10)||0}else{if(!N){M.bl=parseInt(R.css("borderLeftWidth"),10)||0;M.bt=parseInt(R.css("borderTopWidth"),10)||0}}if("relative"==this.cssPosition){if(N&&Q){P={left:(parseInt(this.o.css("left"),10)||0)-this.offset.left,top:(parseInt(this.o.css("top"),10)||0)-this.offset.top}}else{P={left:-(this.offset.left-M.left-(parseInt(this.o.css("left"),10)||0)-M.bl-this.margin.left+(!Q?S.scrollLeft():0)),top:-(this.offset.top-M.top-(parseInt(this.o.css("top"),10)||0)-M.bt-this.margin.top+(!Q?S.scrollTop():0))}}}this.sParent=S;this.oParent=R;this.po=M;this.r=P;this.scrollIsRoot=Q;this.offsetIsRoot=N;this.scrollIsOuter=L;return this},afterDOMPositionChange:function(){var L={left:this.offset.left,top:this.offset.top};this.prepareGeneral();this.offset={left:L.left,top:L.top};this.preparePosition().update("position")},prepareAbsolute:function(){var L=this.o;this.cssPosition=L.css("position");this.offset=L.offset();this.size={width:parseInt(L.outerWidth()||L.css("width")||this.dom.style.width,10)||0,height:parseInt(L.outerHeight()||L.css("height")||this.dom.style.height,10)||0};this.margin={top:parseInt(L.css("marginTop"),10)||0,left:parseInt(L.css("marginLeft"),10)||0};this.rectCache=false;return this},prepareSizeRelated:function(){var L=this.o;this.cssSize={width:parseInt(L[F.boxModel?"width":"outerWidth"]()||L.css("width")||this.dom.style.width,10)||0,height:parseInt(L[F.boxModel?"height":"outerHeight"]()||L.css("height")||this.dom.style.height,10)||0};this.sizeRelated={bl:parseInt(L.css("borderLeftWidth"),10)||0,bt:parseInt(L.css("borderTopWidth"),10)||0,br:parseInt(L.css("borderRightWidth"),10)||0,bb:parseInt(L.css("borderBottomWidth"),10)||0,pl:parseInt(L.css("paddingLeft"),10)||0,pt:parseInt(L.css("paddingTop"),10)||0,pr:parseInt(L.css("paddingRight"),10)||0,pb:parseInt(L.css("paddingBottom"),10)||0};return this},preparePosition:function(){this.position=this.convertPosition(this.offset,"relative");return this},convertPosition:function(U,W){var V=W=="relative"?1:-1,N=this.cssPosition,L=this.r,O=this.po,P=this.margin,R=this.scrollIsRoot,S=this.offsetIsRoot,M=this.sParent;if("absolute"==N&&S){var T=0}else{if("fixed"==N){var T=0}else{if("relative"==N){var T=R?0:V}else{var T=R||this.scrollIsOuter?0:V}}}var Q="relative"==N&&V==1&&S&&R?0:V;return{left:(U.left+L.left*V-O.left*V-P.left*Q-O.bl*V+(T!=0?M.scrollLeft()*T:0)-("fixed"==N?F(document).scrollLeft():0)),top:(U.top+L.top*V-O.top*V-P.top*Q-O.bt*V+(T!=0?M.scrollTop()*T:0)-("fixed"==N?F(document).scrollTop():0))}},convertSize:function(M,O){if(!F.support.boxModel){return{width:M.width,height:M.height}}if(!this.sizeRelated){this.prepareSizeRelated()}var L=O=="inner"?1:-1,N=this.sizeRelated;return{width:(M.width-N.bl*L-N.br*L-N.pl*L-N.pr*L),height:(M.height-N.bt*L-N.bb*L-N.pt*L-N.pb*L)}},rect:function(M,P){if(!this.position){this.prepareGeneral().preparePosition()}var O=this.convertPosition(this.position,"absolute"),L=this.size;P=parseInt(P,10)||0;if(!this.rectCache){this.rectCache={x1:O.left,x2:O.left+L.width,y1:O.top,y2:O.top+L.height}}var N=this.rectCache;return{x1:N.x1-P,x2:N.x2+P,y1:N.y1-P,y2:N.y2+P,w:L.width,h:L.height}},setPositionGrid:function(L,M){if(!M){M={x:0,y:0}}this.gridStart=M;this.positionGrid=L;this.update("position");return this},clearPositionGrid:function(){this.potisionGrid=false;this.gridStart=false;return this},setSizeGrid:function(L,M){if(!M){M="nw"}this.sizeGrid=L;this.sizeGridStart=M;this.update("size");return this},clearSizeGrid:function(){this.sizeGrid=false;this.sizeGridStart=false;return this},setBounds:function(L){this.bounds=L;return this},clearBounds:function(){this.bounds=false;return this},setMinSize:function(L){this.min=L;return this},setMaxSize:function(L){this.max=L;return this},setRatio:function(L){this.ratio=L;return this},getBounds:function(){var L=this.bounds;if(!L){return false}return{x1:typeof L.x1=="function"?L.x1(this.o):L.x1==undefined?-5000:L.x1,x2:typeof L.x2=="function"?L.x2(this.o):L.x2==undefined?10000:L.x2,y1:typeof L.y1=="function"?L.y1(this.o):L.y1==undefined?-5000:L.y1,y2:typeof L.y2=="function"?L.y2(this.o):L.y2==undefined?1000:L.y2}},correctPosition:function(){if(!this.positionGrid&&!this.bounds){return this}var P=this.position,L=this.gridStart,Q=this.positionGrid,O=this.offset;if(Q&&this.checkPositionGrid){P.left=L.x+Math.round((P.left-L.x)/Q.x)*Q.x;P.top=L.y+Math.round((P.top-L.y)/Q.y)*Q.y}if(this.bounds){var N=this.getBounds();var M={x1:O.left,x2:O.left+this.size.width,y1:O.top,y2:O.top+this.size.height};if(M.x2-M.x1<=N.x2-N.x1){if(M.x1<N.x1){P.left+=N.x1-M.x1}if(M.x2>N.x2){P.left-=M.x2-N.x2}}if(M.y2-M.y1<=N.y2-N.y1){if(M.y1<N.y1){P.top+=N.y1-M.y1}if(M.y2>N.y2){P.top-=M.y2-N.y2}}}return this},correctSize:function(){if(!this.min&&!this.max&&!this.ratio&&!this.sizeGrid){return this}var R=this.ofs,L=this.sizeGridStart,O=this.min,T=this.max,S=this.ratio,Q=this.cssSize;var V=this.convertSize(Q,"outer");if(V.width<1){V.width=1}if(V.height<1){V.height=1}if(this.sizeGrid&&this.checkResizeGrid){var U=(Math.round(V.width/this.sizeGrid.x)*this.sizeGrid.x);var N=U-V.width;var P=(Math.round(V.height/this.sizeGrid.y)*this.sizeGrid.y);var M=P-V.height;if(/s/.test(L)){R.top-=M;V.height=P}if(/e/.test(L)){R.left-=N;V.width=U}if(/n/.test(L)){V.height+=M}if(/w/.test(L)){V.width+=N}this.position=this.convertPosition(R,"relative");Q=this.convertSize(V,"inner")}if(O&&O.w!=undefined&&Q.width<O.w){Q.width=O.w}if(O&&O.h!=undefined&&Q.height<O.h){Q.height=O.h}if(T&&T.w!=undefined&&Q.width>T.w){Q.width=T.w}if(T&&T.h!=undefined&&Q.height>T.w){Q.height=T.h}if(S&&this.checkRatio){if(this.ratioCorrectionMode=="w"){Q.height=Math.round(Q.width/S)}if(this.ratioCorrectionMode=="h"){Q.width=Math.round(Q.height*S)}}if(Q.width<1){Q.width=1}if(Q.height<1){Q.height=1}this.cssSize=Q;return this},update:function(T,P,R,U){if(!T){T="both"}if(T=="position"||T=="both"){this.correctPosition()}if(T=="size"||T=="both"){this.correctSize()}var L=this.dom.style,Q=this.cssSize,O=this.position,S=this.sizeChangeOnly;if(!P){if(T=="size"||T=="both"){if(S!="h"){L.width=Math.round(Q.width)+"px"}if(S!="w"){L.height=Math.round(Q.height)+"px"}}if(T=="position"||T=="both"){L.left=Math.round(O.left)+"px";L.top=Math.round(O.top)+"px"}if(U){U.call(this)}}else{var N=this,M={};if(!R){R=null}if(T=="size"||T=="both"){M.width=Q.width;M.height=Q.height}if(T=="position"||T=="both"){M.left=O.left;M.top=O.top}this.o.animate(M,P,R,function(){if(U){U.call(N)}})}return this},underPointer:function(M){var L=this.rect();return M.pageX>L.x1&&M.pageX<L.x2&&M.pageY>L.y1&&M.pageY<L.y2},intersect:function(O,M,R,S){var Q=this.rect(),N=this.size;if(typeof M=="string"){switch(M){case"intersect":if(((Q.y1>O.y1?Q.y2-O.y1:O.y2-Q.y1)<N.height+(O.y2-O.y1))&&((Q.x1>O.x1?Q.x2-O.x1:O.x2-Q.x1)<N.width+(O.x2-O.x1))){return true}break;case"fit":if(O.x1<=Q.x1&&O.x2>=Q.x2&&O.y1<=Q.y1&&O.y2>=Q.y2){return true}break;case"snap":if(R=="outer"){if(Math.abs(O.x2-Q.x1)<S){return"l"}if(Math.abs(O.y2-Q.y1)<S){return"t"}if(Math.abs(O.x1-Q.x2)<S){return"r"}if(Math.abs(O.y1-Q.y2)<S){return"b"}}else{if(Math.abs(O.x1-S-Q.x1)<S){return"l"}if(Math.abs(O.y1-S-Q.y1)<S){return"t"}if(Math.abs(O.x2+S-Q.x2)<S){return"r"}if(Math.abs(O.y2+S-Q.y2)<S){return"b"}}}}if(typeof M=="number"){if(!this.intersect(O,M>=1?"fit":"intersect")){return false}var P=Q.y1>O.y1?O.y2-Q.y1:Q.y2-O.y1;var L=Q.x1>O.x1?O.x2-Q.x1:Q.x2-O.x1;return(L*100/N.width)/100>=M&&(P*100/N.height)/100>=M}return false},enableSelection:function(){this.o.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.dnmc")},disableSelection:function(){this.o.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.dnmc select.dnmc dragstart.dnmc",function(){return false})}};var I=function(N){var M=this.o=F(N);this.dom=N;this.events={};var L=M.data("dynamic");if(L==undefined){M.data("dynamic",new E(N));L=M.data("dynamic")}this.dynamic=L;this.dynamic.prepareAbsolute();this.opt={accept:true,tolerance:"pointer",cls:{},group:false,scope:false,data:false};this.lastDraggable=this.curDraggable=this.localEvents=false;this.eventNamespace="droppable"};I.prototype=F.extend({},B,{toggle:function(L){if(L=="enable"||L===true){this.o.addClass("dnmc-droppable");return }if(L=="disable"||L===false){this.o.removeClass("dnmc-droppable");return }this.o[this.o.hasClass("dnmc-droppable")?"removeClass":"addClass"]("dnmc-droppable");return this},setOptions:function(M,O){var N=this.opt;if(!O){O="default"}var L=false;if(N.cls&&M.cls){L=F.extend({},N.cls,M.cls)}F.extend(N,M);if(L){N.cls=L}if(!N.scope||N.scope=="dom"){N.scope=this.dom}if(N.scope=="dnmc"){N.scope=this}this.bind("over",N.over,O).bind("out",N.out,O).bind("drop",N.drop,O).bind("activate",N.activate,O).bind("deactivate",N.deactivate,O)},rect:function(){return this.dynamic.rect()},eventData:function(L,N){var M={self:this.o,draggable:this.lastDraggable,data:this.opt.data,event:L};return N?F.extend(M,N):M},accept:function(L){var M=this.opt;if(typeof M.accept=="boolean"){return M.accept}if(typeof M.accept=="string"){return L.is(M.accept)}if(F.isFunction(M.accept)){return M.accept.call(M.scope,L)}return typeof M.accept==L[0]},activate:function(L){if(L[0]==this.dom){return false}if(this.opt.cls.active){this.o.addClass(this.opt.cls.active)}this.dynamic.prepareAbsolute();this.lastDraggable=L;this.trigger("activate",this.eventData())},deactivate:function(){var L=this.opt;if(L.cls.active){this.o.removeClass(L.cls.active)}if(L.cls.over){this.o.removeClass(L.cls.over)}this.trigger("deactivate",this.eventData());this.lastDraggable=false},over:function(L){if(this.opt.cls.over){this.o.addClass(this.opt.cls.over)}return this.trigger("over",this.eventData(L.event,{helper:L.helper,placeholder:L.placeholder}))},out:function(L){if(this.opt.cls.over){this.o.removeClass(this.opt.cls.over)}return this.trigger("out",this.eventData(L.event,{helper:L.helper,placeholder:L.placeholder}))},drop:function(L){return this.trigger("drop",this.eventData(L.event,{helper:L.helper,placeholder:L.placeholder}))}});var D={getBoundsFromContainer:function(){var L=false;if(this.opt.container===true){L=this.dynamic.offsetIsRoot?this.dynamic.sParent:this.dynamic.oParent}if(typeof this.opt.container=="string"){if(this.opt.container=="parent"){L=this.o.parent()}else{L=F(this.opt.container)}}if(!L||!L.length){L=F(document)}var N=L[0]==document||/html|body/i.test(L[0].tagName);if(!N){var O=L.offset();var M=parseInt(L.css("borderTopWidth"))||0;var P=parseInt(L.css("borderLeftWidth"))||0;return{x1:O.left+P,x2:O.left+P+L.innerWidth(),y1:O.top+M,y2:O.top+M+L.innerHeight()}}return{x1:function(){return L.scrollLeft()},y1:function(){return L.scrollTop()},x2:function(){return L.scrollLeft()+F(window).width()},y2:function(){return L.scrollTop()+F(window).height()}}},createIframeFix:function(){F(this.opt.iframeFix===true?"iframe":this.opt.iframeFix).each(function(){F('<div class="dnmc-iframe-fix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:9999}).css(F(this).offset()).appendTo("body")})},removeIframeFix:function(){F("div.dnmc-iframe-fix").each(function(){this.parentNode.removeChild(this)})},initSnap:function(M,N){var L=[];F((this.opt.snap!==true?this.opt.snap:N)).not(M).not(".dnmc-resize").each(function(){var O=F(this),P=O.data("dynamic");if(P==undefined){O.data("dynamic",new E(this));P=O.data("dynamic")}P.prepareGeneral().preparePosition().rect();L.push({elem:O,s:false,dnmc:P})});this.snap=L},clearSnap:function(){this.snap=this.snapped=false},unSnap:function(N){var M=this.opt,O=this.snapped;for(var L in O){if(!O[L]){continue}if((L=="t"||L=="b")&&Math.abs(O[L].my-N.pageY)>M.snapTolerance){this.trigger("snapRelease",this.eventData(N,{target:O[L].elem.elem,side:L}));if(M.cls.snapTarget){O[L].elem.elem.removeClass(M.cls.snapTarget)}O[L]=O[L].elem.s[L]=false}if((L=="l"||L=="r")&&Math.abs(O[L].mx-N.pageX)>M.snapTolerance){this.trigger("snapRelease",this.eventData(N,{target:O[L].elem.elem,side:L}));if(M.cls.snapTarget){O[L].elem.elem.removeClass(M.cls.snapTarget)}O[L]=O[L].elem.s[L]=false}}for(var L in O){if(typeof O[L]=="object"){return true}}if(M.cls.snapped){this.moving.removeClass(M.cls.snapped)}this.snapped=false},checkSnap:function(Q){var L=this.opt,S=this.dynamic,P=this.snapped,T=this.snap;S.rectCache=false;for(var N=0,O=T.length;N<O;N++){var U=T[N];if(L.snapMode!="inner"){if(!S.intersect(U.dnmc.rect(false,L.snapTolerance),"intersect")){if(!U.s){continue}for(var M in U.s){P[M]=false}U.s=false;continue}var R=S.intersect(U.dnmc.rect(false,L.snapTolerance),"snap","outer",L.snapTolerance);if(R&&!P[R]){this.doSnap(R,true,T[N],Q)}}if(L.snapMode!="outer"){if(!S.intersect(U.dnmc.rect(),"fit")){if(!U.s){continue}for(var M in U.s){if(!P[M]||P[M].mode=="outer"){continue}P[M]=false;U.s[M]=false}if(!U.s.t&&!U.s.r&&!U.s.b&&!U.s.l){U.s=false}continue}var R=S.intersect(U.dnmc.rect(false,-L.snapTolerance),"snap","inner",L.snapTolerance);if(R&&!P[R]){this.doSnap(R,false,T[N],Q)}}}},mouseDelay:function(O,Q,M){var L=this.opt,P=this.dom,N=this;if(!L.distance&&!L.delay){return Q.call(M,O)}if(L.distance){F(P.ownerDocument).bind("mouseup.dnmc",function(){F(P.ownerDocument).unbind("mousemove.dnmc")});this.preClick={x:O.pageX,y:O.pageY};F(P.ownerDocument).bind("mousemove.dnmc",function(R){if(Math.abs(R.pageX-N.preClick.x)>=L.distance||Math.abs(R.pageY-N.preClick.y)>=L.distance){F(P.ownerDocument).unbind("mousemove.dnmc");Q.call(M,R)}});return false}if(L.delay){F(P.ownerDocument).bind("mouseup.dnmc",function(){window.clearTimeout(N.timer);N.timer=false;F(P.ownerDocument).unbind("mouseup.dnmc")});this.timer=window.setTimeout(function(){F(P.ownerDocument).unbind("mouseup.dnmc");Q.call(M,O)},L.delay);return false}},checkKey:function(M,P){if(!this.opt.withKey||!this.opt.withKey[M]){return true}var O=this.opt.withKey[M].split("|");for(var N=0,L=O.length;N<L;N++){if(O[N]=="none"&&!(P.ctrlKey||P.shiftKey||P.altKey)){return true}if(O[N]=="any"&&(P.ctrlKey||P.shiftKey||P.altKey)){return true}if(P[O[N]+"Key"]){return true}}return false}};var K=function(N){var M=this.o=F(N);this.dom=N;this.events={};this.moving=this.o;var L=M.data("dynamic");if(L==undefined){M.data("dynamic",new E(N));L=M.data("dynamic")}this.dynamic=L;this.eventNamespace="draggable";this.opt={helper:false,destroyHelper:true,opacity:false,animate:false,easing:false,cls:{},axis:false,restore:false,bound:false,scroll:false,scrollStep:20,scrollSensitivity:20,scrollOutside:false,zIndex:1000,cancel:":input",cursorAt:false,delay:false,distance:false,handle:this.o,snap:false,snapTolerance:20,snapMode:"both",stack:false,renew:true,placeholder:false,grid:false,gridStart:false,keyboard:false,keyStep:5,keyTime:100,keyboardOnly:false,target:".dnmc-droppable",targetGroup:false,targetOptions:false,iframeFix:false,container:false,scope:false,data:null,unselectable:true,withKey:false,hide:false,helperAppendTo:false,preserveCursor:false};this.enabled=this.envCached=this.dropCached=this.snapCached=this.focus=this.localEvents=false;this.resetVars()};F.extend(K.prototype,B,D,{toggle:function(L){if((L=="disable"||L===false)&&this.enabled){return this.setEvents("off")}if((L=="enable"||L===true)&&!this.enabled){return this.setEvents("on")}},setEvents:function(O){var M=this,L=this.opt,N=this.o;if(O=="on"){if(!L.keyboard||!L.keyboardOnly){F(function(){L.handle.bind("mousedown.dnmc",function(P){return M.mouseDown.call(M,P)});if(L.cancel){F(L.cancel,N).bind("mousedown.dnmc",function(P){P.stopPropagation();return true})}})}this.enabled=true;N.addClass("dnmc-draggable");if(L.cls.active){N.addClass(L.cls.active)}if(L.keyboard){this.initFocusElement()}if(L.unselectable){this.dynamic.disableSelection()}this.trigger("enabled",this.eventData())}if(O=="off"){if(!L.keyboard||!L.keyboardOnly){L.handle.unbind("mousedown.dnmc");if(L.cancel){F(L.cancel,N).unbind("mousedown.dnmc")}}this.enabled=false;N.removeClass("dnmc-draggable");if(L.cls.active){N.removeClass(L.cls.active)}if(L.keyboard){this.removeFocusElement()}if(L.unselectable){this.dynamic.enableSelection()}this.trigger("disabled",this.eventData())}return this},setOptions:function(M,O){if(!O){O="default"}var L=false,N=this.opt;if(N.cls&&M.cls){L=F.extend({},N.cls,M.cls)}F.extend(N,M);if(L){N.cls=L}if(!F.easing){N.easing=null}if(!N.scope||N.scope=="dom"){N.scope=this.dom}if(N.scope=="dnmc"){N.scope=this}if(typeof N.handle=="string"){N.handle=F(N.handle,this.o)}if(!N.handle||N.handle.length==0){N.handle=this.o}if(N.grid&&typeof N.grid!="object"){N.grid={x:N.grid,y:N.grid}}if(N.distance&&N.delay){N.delay=false}if(N.cursorAt){N.grid=false}if(!N.stack&&typeof N.zIndex!="number"){N.zIndex=1000}if(!N.cls){N.cls={}}this.bind("beforeStart",N.beforeStart,O).bind("start",N.start,O).bind("drag",N.drag,O).bind("beforeEnd",N.beforeEnd,O).bind("beforeDrop",N.beforeDrop,O).bind("end",N.end,O).bind("snap",N.onSnap,O).bind("snapRelease",N.onSnapRelease,O).bind("scroll",N.onScroll,O).bind("enabled",N.enabled,O).bind("disabled",N.disabled,O);if(O!="default"){this.resetVars()}},resetVars:function(){this.helperSize={w:0,h:0};this.timer=this.zIndex=this.opacity=this.click=this.cssPosition=this.mouseProp=this.startMouse=this.startPosition=this.startOffset=this.xdiff=this.ydiff=this.snapped=this.stack=this.placeholder=this.keyTimer=false;if(this.opt.renew||!this.envCached){this.scroll=this.sEdge=this.gridStart=this.snap=false}if(this.opt.renew||!this.dropCached){this.target=false}var L=this;if(this.snapped&&this.opt.cls.snapTarget){F.each(this.snapped,function(){if(this.elem){this.elem.elem.removeClass(L.opt.cls.snapTarget)}})}this.curTarget=[];this.repairHelper=(!this.opt.helper||typeof this.opt.helper=="object"||typeof this.opt.helper=="string")},eventData:function(L,N){var M={self:this.o,helper:this.moving,placeholder:this.placeholder,event:L,data:this.opt.data};return N?F.extend(M,N):M},createHelper:function(Q){var N=this.opt,S=this.dynamic,L=false,P=false,R=this.o;this.opacity=R.css("opacity");this.cssPosition=R.css("position");this.zIndex=R.css("z-index");if(N.helper&&this.checkKey("helper",Q)){switch(typeof N.helper){case"boolean":if(N.cls.helper){L=F('<div class="dnmc-helper"></div>').css({position:S.cssPosition,width:R.width(),height:R.height()}).addClass(N.cls.helper)}else{L=R.clone();F(".dnmc-resize, .dnmc-resize-wrapper",L).remove()}break;case"function":L=F(N.helper.call(N.scope,R));break;case"object":case"string":L=F(N.helper);break}L.css("position","absolute").appendTo(N.helperAppendTo?N.helperAppendTo:this.dynamic.offsetIsRoot&&"static"!=this.dynamic.cssPosition?"body":this.dom.parentNode).show();L.data("dynamic",new E(L[0]));var O=L.data("dynamic");O.prepareGeneral();L.dnmcHelper=true;O.position=O.convertPosition(S.offset,"relative");O.offset=O.convertPosition(O.position,"absolute");O.update("position");if(F.browser.opera&&/img/i.test(L[0].tagName)){L.bind("mousedown.dnmc",function(T){T.stopPropagation();T.preventDefault();return false})}this.dynamic=L.data("dynamic")}else{L=R}this.helperSize={w:this.dynamic.size.width,h:this.dynamic.size.height};if(N.placeholder&&this.checkKey("placeholder",Q)){switch(typeof N.placeholder){case"boolean":P=F('<div class="dnmc-placeholder"></div>');break;case"function":P=F(N.placeholder.call(N.scope,R));break;case"object":case"string":P=F(N.placeholder)}P.css({position:this.cssPosition,width:R.width(),height:R.height()});if(N.cls.placeholder){P.addClass(N.cls.placeholder)}if("relative"==R.data("dynamic").cssPosition){P.css("position","absolute")}P.insertBefore(R);P.data("dynamic",new E(P[0]));var M=P.data("dynamic");M.prepare();M.position=M.convertPosition(S.offset,"relative");M.cssSize=M.convertSize(S.size,"inner");M.update("both");P.show()}if(!N.helper&&"static"==this.cssPosition){L.css({position:"absolute",left:S.offset.left-S.margin.left,top:S.offset.top-S.margin.top});S.cssPosition="absolute"}if(N.opacity){L.css("opacity",N.opacity)}if(N.zIndex&&!N.stack){L.css("z-index",N.zIndex)}if(this.stack&&this.stack.helperIndex){L.css("z-index",this.stack.helperIndex)}if(N.cls.drag){R.addClass(N.cls.drag)}L.show();if(L.dnmcHelper&&P){R.hide()}this.moving=L;this.placeholder=P},removeHelper:function(){var M=this.opt,O=this.dynamic,N=this.placeholder,L=this.moving;if(M.cls.drag){this.o.removeClass(M.cls.drag)}if(this.repairHelper||!L.dnmcHelper){if(M.opacity){L.css("opacity",this.opacity)}if(M.zIndex&&!M.stack){L.css("z-index",this.zIndex)}if("static"==this.cssPosition){L.css({position:"static",left:"",top:""});O.cssPosition="static"}}if(M.placeholder&&N){N[M.destroyHelper?"remove":"hide"]();this.placeholder=false}if(M.placeholder&&M.helper){this.o.show()}if(L.dnmcHelper){var O=this.dynamic=this.o.data("dynamic");O.prepareGeneral();O.position=O.convertPosition(L.data("dynamic").offset,"relative");L[M.destroyHelper?"remove":"hide"]()}this.moving=this.o},initTargets:function(){var M=this,L=this.opt;if(!L.targetOptions){L.targetOptions={scope:this}}if(L.targetOptions.scope==undefined){L.targetOptions.scope=this}var N=F(L.target!=true?L.target:".dnmc-droppable");this.target=[];N.filter(function(){if(this==M.dom){return false}var P=F(this),O=P.data("droppable");if(O==undefined){P.droppable(L.targetOptions);O=P.data("droppable")}if(L.targetGroup&&O.opt.group!=L.targetGroup){return false}if(!O.accept(M.o)){return false}P.data("dynamic").prepareGeneral().preparePosition();O.activate(M.o);M.target.push(O);return true});if(this.target.length==0){this.target=false}},resetTargets:function(){for(var M=0,L=this.target.length;M<L;M++){this.target[M].deactivate()}this.target=false;this.clearCurrentTargets()},clearCurrentTargets:function(M){var O=this.curTarget;for(var N=0,L=O.length;N<L;N++){if(!O[N]){continue}if(M){O[N].out()}O[N].curDraggable=false}O=[]},initGrid:function(){var L=this.opt.gridStart,M=this.opt,N=this.dynamic;if(!L){L={x:(N.position.left>M.grid.x)?N.position.left%M.grid.x:N.position.left,y:(N.position.top>M.grid.y)?N.position.top%M.grid.y:N.position.top}}else{if(typeof L!="object"||L.x==undefined){L=F(L).offset();if(typeof L!=undefined){L.x=L.left;L.y=L.top}else{return M.gridStart=M.grid=false}}}if(M.grid){N.setPositionGrid(M.grid,L)}},initScrollArea:function(){var N=this.opt,M={},R=this.o.data("dynamic");if(!R.sParent){R.prepareGeneral()}switch(typeof N.scroll){case"boolean":if(N.container){this.scroll=N.container}else{this.scroll=R.sParent}break;case"object":case"string":this.scroll=F(N.scroll)}if(!this.scroll||this.scroll.length==0){this.scroll=false;return false}var L=this.scroll;if((/body|html/i).test(L[0].tagName)||L[0]==document){M.allowEverywhere=true;if("fixed"==this.dynamic.cssPosition){M.isTop=function(S){return S.clientY<N.scrollSensitivity};M.isBottom=function(S){return F(window).height()-S.clientY<N.scrollSensitivity};M.isLeft=function(S){return S.clientX<N.scrollSensitivity};M.isRight=function(S){return F(window).width()-S.clientX<N.scrollSensitivity}}else{M.isTop=function(S){return S.pageY-F(document).scrollTop()<N.scrollSensitivity};M.isBottom=function(S){return F(window).height()-(S.pageY-F(document).scrollTop())<N.scrollSensitivity};M.isLeft=function(S){return S.pageX-F(document).scrollLeft()<N.scrollSensitivity};M.isRight=function(S){return F(window).width()-(S.pageX-F(document).scrollLeft())<N.scrollSensitivity}}M.curScroll=function(){return{left:F(document).scrollLeft(),top:F(document).scrollTop()}};M.scrollDiff=function(S){return{x:F(document).scrollLeft()-S.left,y:F(document).scrollTop()-S.top}};M.scrollY=function(S,T){F(document).scrollTop(F(document).scrollTop()+N.scrollStep*T)};M.scrollX=function(S,T){F(document).scrollLeft(F(document).scrollLeft()+N.scrollStep*T)}}else{var Q=(/auto|scroll/i).test(L.css("overflow"))||(/auto|scroll/i).test(L.css("overflow-x"));var P=(/auto|scroll/i).test(L.css("overflow"))||(/auto|scroll/i).test(L.css("overflow-y"));if(!Q&&!P){return false}M.allowEverywhere=false;var O=L.offset();M.x1=O.left;M.y1=O.top;M.x2=O.left+L.outerWidth();M.y2=O.top+L.outerHeight();M.isTop=function(S){return S.pageY-O.top<N.scrollSensitivity};M.isBottom=function(S){return(O.top+L[0].offsetHeight)-S.pageY<N.scrollSensitivity};M.isLeft=function(S){return S.pageX-O.left<N.scrollSensitivity};M.isRight=function(S){return(O.left+L[0].offsetWidth)-S.pageX<N.scrollSensitivity};M.curScroll=function(){return{left:L[0].scrollLeft,top:L[0].scrollTop}};M.scrollDiff=function(S){return{x:L[0].scrollLeft-S.left,y:L[0].scrollTop-S.top}};M.scrollY=function(S,T){L[0].scrollTop+=N.scrollStep*T};M.scrollX=function(S,T){L[0].scrollLeft+=N.scrollStep*T}}this.sEdge=M},clearScrollArea:function(){this.sEdge=this.scroll=false},initFocusElement:function(){var L=this;this.focus=F('<a href="#" class="dnmc-focus"></a>').css({position:"absolute",tabIndex:"-1"}).bind("click.dnmc",function(M){M.stopPropagation();return false}).bind("keydown.dnmc",function(M){return L.doKeyboardNav.call(L,M)}).bind("keyup.dnmc",function(M){return L.cancelKeyboardNav.call(L,M)}).bind("blur.dnmc",function(M){return L.onBlur.call(L)}).appendTo("body");this.opt.handle.bind("click.dnmc",function(M){return L.onFocus.call(L,M)});if(this.opt.keyboardOnly&&this.opt.grid){this.initGrid()}},removeFocusElement:function(){this.focus.unbind().remove();this.opt.handle.unbind("click.dnmc");this.focus=false},checkTargets:function(O){this.dynamic.rectCache=false;var M=this.target,P=this.dynamic;for(var N=0,L=M.length;N<L;N++){if("pointer"==M[N].opt.tolerance&&M[N].dynamic.underPointer(O)){this.addTarget(M[N],O)}else{if("pointer"!=M[N].opt.tolerance&&P.intersect(M[N].dynamic.rect(),M[N].opt.tolerance)){this.addTarget(M[N],O)}else{if(M[N].curDraggable&&M[N].curDraggable.dom==this.dom){this.removeTarget(M[N],O)}}}}},allowedToScroll:function(L){return(this.opt.scrollOutside||this.sEdge.allowEverywhere)?true:(L.pageX>this.sEdge.x1&&L.pageX<this.sEdge.x2&&L.pageY>this.sEdge.y1&&L.pageY<this.sEdge.y2)},addTarget:function(L,M){if(L.curDraggable.dom==this.dom){return }if(L.opt.greedy){this.clearCurrentTargets(true)}L.curDraggable=this;L.over(this.eventData(M));this.curTarget.push(L)},removeTarget:function(M,Q){var R=this.curTarget,O=true,P=false;if(!R.length){return }for(var N=0,L=R.length;N<L;N++){if(!P&&R[N]&&R[N].dom==M.dom){R[N].out(this.eventData(Q));R[N]=null;P=true}if(R[N]!=null){O=false}}if(O){R=[]}M.curDraggable=false},doDrop:function(O){var M=this.curTarget;if(!M.length){return false}for(var N=0,L=M.length;N<L;N++){if(M[N]){M[N].drop(this.eventData(O));this.trigger("drop",this.eventData(O,{droppable:M[N].o}))}}},doSnap:function(S,T,M,O){var P={l:"r",t:"b",r:"l",b:"t"},N=this.snapped||{},Q=M.dnmc,L=this.opt,R=this.dynamic;if(typeof M.s!="object"){M.s={}}if(typeof N[S]=="object"||typeof N[P[S]]=="object"){return true}M.s[S]=true;N[S]={mx:O.pageX,my:O.pageY,elem:M,mode:(T?"outer":"inner")};if(S=="b"){R.offset.top=(T?Q.offset.top:Q.offset.top+Q.size.height)-this.helperSize.h}if(S=="l"){R.offset.left=(T?Q.offset.left+Q.size.width:Q.offset.left)}if(S=="t"){R.offset.top=(T?Q.offset.top+Q.size.height:Q.offset.top)}if(S=="r"){R.offset.left=(T?Q.offset.left:Q.offset.left+Q.size.width)-this.helperSize.w}this.trigger("snap",this.eventData(O,{target:M.elem,side:S}));if(L.cls.snapped){this.moving.addClass(L.cls.snapped)}if(L.cls.snapTarget){M.elem.addClass(L.cls.snapTarget)}this.snapped=N;return true},doKeyboardNav:function(M){if(F.inArray(M.keyCode,[37,38,39,40])==-1){return false}if(!this.checkKey("keyboard",M)){return false}if((M.keyCode==38||M.keyCode==40)&&this.opt.axis=="x"){return false}if((M.keyCode==37||M.keyCode==39)&&this.opt.axis=="y"){return false}if(this.opt.grid){if(M.keyCode==38||M.keyCode==40){this.opt.keyStep=this.opt.grid.y}if(M.keyCode==37||M.keyCode==39){this.opt.keyStep=this.opt.grid.x}}if(!this.keyTimer){var L=this;this.keyTimer=window.setTimeout(function(){L.doKeyboardNav.call(L,M)},this.opt.keyTime)}this.dynamic.offset[(M.keyCode==38||M.keyCode==40?"top":"left")]+=this.opt.keyStep*(M.keyCode==39||M.keyCode==40?1:-1);this.dynamic.preparePosition().update("position");this.trigger("drag",this.eventData(M));return false},cancelKeyboardNav:function(){if(!this.keyTimer){return false}window.clearTimeout(this.keyTimer);this.keyTimer=false},doScroll:function(O){if(!this.allowedToScroll(O)){return false}var M=this.sEdge;var L=M.curScroll.call(this);if(M.isTop.call(this,O)){M.scrollY.call(this,O,-1)}if(M.isBottom.call(this,O)){M.scrollY.call(this,O,1)}if(M.isLeft.call(this,O)){M.scrollX.call(this,O,-1)}if(M.isRight.call(this,O)){M.scrollX.call(this,O,1)}var N=M.scrollDiff.call(this,L);if(N.x!=0||N.y!=0){this.trigger("scroll",this.eventData(O,{diff:N}))}},doStack:function(){var L=this;this.stack=F.makeArray(F(this.opt.stack!==true?this.opt.stack:".dnmc-draggable")).sort(function(N,M){return(parseInt(F(N).css("zIndex"))||L.opt.zIndex)-(parseInt(F(M).css("zIndex"))||L.opt.zIndex)});F(this.stack).each(function(M){this.style.zIndex=L.opt.zIndex+M});this.o[0].style.zIndex=this.opt.zIndex+this.stack.length;this.stack.helperIndex=this.o[0].style.zIndex+1},toggleHidden:function(L){F(this.opt.hide).not(this.dom).css("visibility",L?"hidden":"visible")},onFocus:function(L){if(!this.focus){return false}this.focus.css({left:F(document).scrollLeft(),top:F(document).scrollTop()});this.dynamic.prepareAbsolute().preparePosition();this.focus[0].focus();if(this.opt.cls.focus){this.moving.addClass(this.opt.cls.focus)}return false},onBlur:function(){if(this.opt.cls.focus){this.moving.removeClass(this.opt.cls.focus)}},mouseDown:function(L){if(!this.checkKey("drag",L)){return false}L.preventDefault();L.stopPropagation();if(this.trigger("beforeStart",this.eventData(L))===false){return false}this.mouseDelay(L,this.moveStart,this);return false},moveStart:function(O){var M=this.opt,P=this.dynamic,N=this,L=this.preClick;P.prepare();this.startMouse={x:O.pageX,y:O.pageY};this.startPosition={left:P.position.left,top:P.position.top};this.startOffset={left:P.offset.left,top:P.offset.top};this.click=L?{x:L.x-P.offset.left,y:L.y-P.offset.top}:{x:O.pageX-P.offset.left,y:O.pageY-P.offset.top};this.preClick=false;this.createHelper(O);if(M.cursorAt){if(M.cursorAt.left!=undefined){this.click.x=-M.cursorAt.left}if(M.cursorAt.top!=undefined){this.click.y=-M.cursorAt.top}if(M.cursorAt.right!=undefined){this.click.x=P.size.width+M.cursorAt.right}if(M.cursorAt.bottom!=undefined){this.click.y=P.size.height+M.cursorAt.bottom}}if(M.preserveCursor){this.bodyCursor=F("body").css("cursor");F("body").css("cursor",this.o.css("cursor"))}if(M.renew||!this.snapCached){if(M.snap){this.initSnap([this.dom,this.moving[0],this.placeholder?this.placeholder[0]:false],".dnmc-draggable")}else{this.clearSnap()}this.snapCached=true}if(M.renew||!this.envCached){if(M.container){P.setBounds(this.getBoundsFromContainer())}if(M.bound){P.setBounds(M.bound)}if(!M.container&&!M.bound){P.clearBounds()}if(M.scroll){this.initScrollArea()}else{this.clearScrollArea()}if(M.grid){this.initGrid()}else{P.clearPositionGrid()}this.envCached=true}if(M.target){this.initTargets()}if(M.stack){this.doStack()}if(M.iframeFix){this.createIframeFix()}if(M.hide){this.toggleHidden(true)}if(M.withKey&&M.withKey.grid){P.checkPositionGrid=this.checkKey("grid",O)}F(this.dom.ownerDocument).bind("mousemove.dnmc",function(Q){return N.mouseMove.call(N,Q)});F(this.dom.ownerDocument).bind("mouseup.dnmc",function(Q){return N.mouseUp.call(N,Q)});this.trigger("start",this.eventData(O));if(O){this.mouseMove(O)}return false},mouseMove:function(M){var L=this.opt,O=this.dynamic,N=this.snapped;if(L.axis!="y"&&L.axis!="none"&&!N.l&&!N.r){O.offset.left=M.pageX-this.click.x}if(L.axis!="x"&&L.axis!="none"&&!N.t&&!N.b){O.offset.top=M.pageY-this.click.y}if(this.scroll){this.doScroll(M)}if(this.snap){this.checkSnap(M)}if(this.snapped){this.unSnap(M)}if(this.target&&this.checkKey("drop",M)){this.checkTargets(M)}O.preparePosition().update("position");if(this.trigger("drag",this.eventData(M))===false){return this.mouseUp(M)}return true},mouseUp:function(S){if(this.trigger("beforeEnd",this.eventData(S))===false){return false}var O=this.opt,T=this.dynamic,N=this,L=this.curTarget,P=this.moving,M=this.placeholder;F(this.dom.ownerDocument).unbind(".dnmc");if(L.length>0&&this.checkKey("drop",S)){for(var Q=0,R=L.length;Q<R;Q++){if(L[Q]){this.trigger("beforeDrop",this.eventData(S,{droppable:L[Q].o}))}}this.o.data("dynamic").afterDOMPositionChange()}if(O.animate&&this.checkKey("animate",S)){if(O.restore&&this.checkKey("restore",S)){T.position=T.convertPosition(this.startOffset,"relative");return T.update("position",O.animate,O.easing,function(){N.moveEnd(S)})}else{if(O.helper&&"static"!=this.cssPosition&&P.dnmcHelper){var V=P.data("dynamic"),W=P,T=this.dynamic=this.o.data("dynamic");if(M){this.o.show()}T.prepareGeneral();if(M){var U=M.data("dynamic");U.prepareAbsolute();T.position=T.convertPosition(U.offset,"relative");T.update("position")}T.position=T.convertPosition(V.offset,"relative");this.moving=this.o;return this.dynamic.update("position",O.animate,O.easing,function(){N.moving=W;N.moveEnd(S)})}else{return this.moveEnd(S)}}}else{if(!O.animate&&O.restore&&this.checkKey("restore",S)){T.position=T.convertPosition(this.startOffset,"relative");T.update("position");return this.moveEnd(S)}else{if(!O.restore&&!O.animate&&O.helper){this.removeHelper();this.dynamic.update("position");return this.moveEnd(S)}}}return this.moveEnd(S)},moveEnd:function(M){var L=this.opt;this.removeHelper();if(this.bodyCursor){F("body").css("cursor",this.bodyCursor);this.bodyCursor=false}if(L.iframeFix){this.removeIframeFix()}if(L.hide){this.toggleHidden(false)}if(this.curTarget&&this.checkKey("drop",M)){this.doDrop(M)}if(this.target){this.resetTargets()}this.trigger("end",this.eventData(M));this.resetVars();if(L.cls.snapped){this.o.removeClass(L.cls.snapped)}return false}});var C=function(N){this.dom=N;var M=this.o=F(N);this.wrapper=this.o;this.events={};var L=M.data("dynamic");if(L==undefined){M.data("dynamic",new E(N));L=M.data("dynamic")}this.dynamic=L;this.enabled=this.inProcess=this.n=this.ne=this.e=this.se=this.s=this.sw=this.w=this.nw=this.handlesInitialized=this.localEvents=this.wrapperMode=false;this.opt={handles:"e,se,s",cls:{},axis:false,delay:false,distance:false,outside:0,snapTolerance:20,snapMode:"both",hide:false,min:10,max:false,ratio:false,animate:false,easing:false,renew:true,helper:false,grid:false,snap:false,restore:false,iframeFix:false,container:false,bound:false,scope:false,wheel:false,clickndrag:false,opacity:false,scroll:false,scrollStep:20,scrollSensitivity:20,data:null,cancel:":input",unselectable:false,withKey:false,size:5,wrapper:false,nw:false,n:false,ne:false,e:false,se:false,s:false,sw:false,w:false};this.eventNamespace="resizable";this.resetVars()};F.extend(C.prototype,B,D,{toggle:function(L){if(L=="enable"||L===true){return this.setEvents("on")}if(L=="disable"||L===false){return this.setEvents("off")}},setEvents:function(O){var L=this.opt,N=this.o,M=this;if(O=="on"&&!this.enabled){this.dynamic.prepareAbsolute();if("static"==this.dynamic.cssPosition&&!H){var M=this;F(window).bind("load",function(){M.createResizeHandles()})}else{this.createResizeHandles()}if(L.wheel){N.bind("mouseenter.dnmcresize",function(){F("body").bind("mousewheel.dnmcresize",function(P,Q){return M.onWheel(P,Q)});F(M.opt.cancel,N).bind("mousewheel.dnmcresize",function(P){P.stopPropagation();return true});return false});N.bind("mouseleave.dnmcresize",function(){F("body").unbind("mousewheel.dnmcresize");return true})}if(L.clickndrag){N.bind("mousedown.dnmcresize",function(P){return M.onMouseDown(P)});F(L.cancel,N).bind("mousedown.dnmcresize",function(P){P.stopPropagation();return true})}if(L.unselectable){this.dynamic.disableSelection()}if(F.browser.safari&&/textarea/i.test(this.dom.tagName)){N.css("resize","none")}this.enabled=true;N.addClass("dnmc-resizable");if(L.cls.active){N.addClass(L.cls.active)}this.trigger("enabled",this.eventData())}if(O=="off"&&this.enabled){this.removeResizeHandles();if(L.wheel){N.unbind("mouseenter.dnmcresize").unbind("mouseleave.dnmcresize");F(L.cancel,N).unbind("mousewheel.dnmcresize")}if(L.clickndrag){N.unbind("mousedown.dnmcresize");F(L.cancel,N).unbind("mousedown.dnmcresize")}if(L.unselectable){this.dynamic.enableSelection()}this.enabled=false;N.removeClass("dnmc-resizable");if(L.cls.active){N.removeClass(L.cls.active)}this.trigger("disabled",this.eventData())}return this},eventData:function(L,N){var M={self:this.o,helper:this.helper,size:this.dynamic.size,cssSize:this.dynamic.cssSize,data:this.opt.data,event:L};return N?F.extend(M,N):M},correctRatio:function(){var L=this.opt;if(L.ratio===true){L.ratio=this.o.width()/this.o.height()}if(L.ratio&&L.max){var M=L.max.w/L.max.h;if((L.ratio>1&&M>1)||(L.ratio<=1&&M<=1)){L.max.w=Math.round(L.max.h*L.ratio)}else{L.max.h=Math.round(L.max.w/L.ratio)}}if(L.ratio&&L.min){var M=L.min.w/L.min.h;if((L.ratio>1&&M>1)||(L.ratio<=1&&M<=1)){L.min.h=Math.round(L.min.w/L.ratio)}else{L.min.w=Math.round(L.min.h*L.ratio)}}},setOptions:function(M,P){var L=false,N=this.opt;if(N&&N.cls&&M&&M.cls){L=F.extend({},N.cls,M.cls)}if(!P){P="default"}F.extend(N,M);if(L){N.cls=L}if(!N.scope||N.scope=="dom"){N.scope=this.dom}if(N.scope=="dnmc"){N.scope=this}if(!N.min){N.min={w:parseInt(this.o.css("min-width"),10)||10,h:parseInt(this.o.css("min-height"),10)||10}}if(!N.max){N.max={w:parseInt(this.o.css("max-width"),10)||false,h:parseInt(this.o.css("max-height"),10)||false}}if(!N.max.w&&!N.max.h){N.max=false}if(N.min&&typeof N.min!="object"){N.min={w:N.min,h:N.min}}if(N.max&&typeof N.max!="object"){N.max={w:N.max,h:N.max}}if(N.grid&&typeof N.grid!="object"){N.grid={x:N.grid,y:N.grid}}if(F.browser.safari&&!H){var O=this;F(window).bind("load",function(){O.correctRatio()})}else{this.correctRatio()}this.bind("beforeStart",N.beforeStart,P).bind("start",N.start,P).bind("sizeChange",N.sizeChange,P).bind("beforeEnd",N.beforeEnd,P).bind("end",N.end,P).bind("snap",N.onSnap,P).bind("snapRelease",N.onSnapRelease,P).bind("enabled",N.enabled,P).bind("disabled",N.disabled,P).bind("scroll",N.onScroll,P);if(P!="default"){this.resetVars()}},resetVars:function(){this.helper=this.startSize=this.startPosition=this.cssPosition=this.timer=this.opacity=this.startOffset=this.startHandleOffset=this.startMouse=this.snapped=this.wtimer=this.wdelta=false;this.wstrength=5;if(this.opt.renew||!this.snapCached){this.snap=false}},createHelper:function(N,P){if(!this.checkKey("helper",P)){return false}var Q=this.dynamic,L=this.opt,M=false;if(L.cls.helper){M=F('<div class="dnmc-resize-helper"></div>').addClass(L.cls.helper);if(L.opacity){M.css("opacity",L.opacity)}}else{M=this.o.clone();F("*",M).remove();if(L.cls.ghost){M.addClass(L.cls.ghost)}M.css("opacity",L.opacity!==false?L.opacity:0.7)}M.appendTo(Q.offsetIsRoot?"body":this.dom.parentNode);if(F.browser.safari){Q.show()}M.css({position:"absolute",zIndex:1000,width:Q.size.width,height:Q.size.height});if(N){M.css({cursor:N+"-resize"})}M.data("dynamic",new E(M[0]));var O=M.data("dynamic");O.prepare();M.dnmcHelper=true;O.position=O.convertPosition(Q.offset,"relative");O.cssSize=O.convertSize(Q.size,"inner");O.update("both").prepareAbsolute();this.helper=M;this.dynamic=O},removeHelper:function(){if(!this.helper){return true}var M=this.dynamic=this.o.data("dynamic"),L=this.helper.data("dynamic");L.prepareAbsolute();M.prepare();M.position=M.convertPosition(L.offset,"relative");M.cssSize=M.convertSize(L.size,"inner");this.helper.remove()},createResizeHandles:function(){var M=this.opt.handles.split(",");if(F.inArray("none",M)!=-1){return false}if(F.inArray("all",M)!=-1){M=G}if(M.length==0){return false}var O=this.o.css("overflow")+this.o.css("overflow-x")+this.o.css("overflow-y");if(/img|input|select|textarea|button|object|iframe|table|a|canvas/i.test(this.dom.tagName)){this.createWrapper(/static|relative/i.test(this.dynamic.cssPosition)?3:1)}else{if(/auto|scroll/i.test(O)||(/hidden/i.test(O)&&this.opt.outside>0)){this.createWrapper(1)}else{if(this.opt.wrapper||"static"==this.dynamic.cssPosition){this.createWrapper(2)}}}var L=M.length;while(L--,L>=0){this.createResizeHandle(M[L])}var N=this;if(this.opt.hide){this.o.bind("mouseenter.dnmc",function(){N.toggleHandles("on")}).bind("mouseleave.dnmc",function(){if(!N.inProcess){N.toggleHandles("off")}})}else{this.toggleHandles("on")}if(this.wrapperMode&&this.wrapperMode!=2){this.o.bind("start.draggable.__rszbl",function(){N.toggleHandles("off")});this.o.bind("end.draggable.__rszbl",function(){N.wrapper.insertAfter(N.o);N.toggleHandles("on")})}if("relative"==this.dynamic.cssPosition&&F.browser.msie){F(window).one("load",function(){N.updateHandles()})}},createWrapper:function(L){var M=F("<div class=dnmc-resize-wrapper></div>").css({padding:"0px",margin:"0px",border:"0px",width:"0px",height:"0px",left:"0px",top:"0px",background:"transparent",zIndex:"",overflow:"visible",overflowX:"visible",overflowY:"visible"});if(L==1){M.css("position",this.dynamic.cssPosition!="fixed"?"absolute":"fixed").insertAfter(this.o)}if(L==2){M.css("position","relative");this.o.prepend(M)}if(L==3){M.css("position","relative").insertAfter(this.o)}M.data("dynamic",new E(M[0]));this.wrapperMode=L;this.wrapper=M},updateHandles:function(R){var S=this.dynamic,N=8,M=this.wrapperMode?this.wrapper.data("dynamic"):false,L=this.opt;S.prepareSizeRelated().prepareAbsolute();var U={width:S.size.width-("static"==S.cssPosition?0:S.sizeRelated.bl)-S.sizeRelated.br,height:S.size.height-("static"==S.cssPosition?0:S.sizeRelated.bt)-S.sizeRelated.bb};if(M){M.prepareGeneral();M.position=M.convertPosition(S.offset,"relative");M.update("position")}while(N--,N>=0){var V=G[N];if(!this[V]){continue}var Q=this[V].data("dynamic");if(this[V][0].customHandle){Q.prepareAbsolute();continue}if(R){var W=this[V].width();var P=this[V].height();if(P<=1&&(V=="w"||V=="e")){this[V].autoSize=true}if(W<=1&&(V=="n"||V=="s")){this[V].autoSize=true}if(W<=1){Q.o[0].style.width=Q.o[0].style.height=L.size+"px"}Q.prepareAbsolute().prepareSizeRelated()}var X=false;if(V=="ne"){var O={left:U.width-Q.size.width,top:0}}if(V=="se"){var O={left:U.width-Q.size.width,top:U.height-Q.size.height}}if(V=="nw"){var O={left:0,top:0}}if(V=="sw"){var O={left:0,top:U.height-Q.size.height}}if(V=="n"||V=="s"){var O={left:0,top:V=="n"?0:U.height-Q.size.height};if(this[V].autoSize){if(this[V+"w"]||this[V+"e"]){if(this[V+"w"]){O.left=this[V+"w"].data("dynamic").size.width}if(this[V+"e"]){X=Q.convertSize({width:U.width-this[V+"e"].data("dynamic").size.width-O.left,height:Q.size.height},"inner")}else{X=Q.convertSize({width:U.width-O.left,height:Q.size.height},"inner")}}else{X=Q.convertSize({width:U.width,height:Q.size.height},"inner")}if(X.width<1){X.width=1}}else{O.left=Math.round(U.width/2-Q.size.width/2)}}if(V=="w"||V=="e"){var O={left:V=="w"?0:U.width-Q.size.width,top:0};if(this[V].autoSize){if(this["n"+V]||this["s"+V]){if(this["n"+V]){O.top=this["n"+V].data("dynamic").size.height}if(this["s"+V]){X=Q.convertSize({height:U.height-this["s"+V].data("dynamic").size.height-O.top,width:Q.size.width},"inner")}else{X=Q.convertSize({height:U.height-O.top,width:Q.size.width},"inner")}}else{X=Q.convertSize({height:U.height,width:Q.size.width},"inner")}if(X.height<1){X.height=1}}else{O.top=Math.round(U.height/2-Q.size.height/2)}}var T=L.outside;if(T){if(V!="n"&&V!="s"){O.left+=T*(/w/.test(V)?-1:1)}else{if(this[V+"w"]){X.width+=T}if(this[V+"e"]){X.width+=T}if(this[V+"w"]){O.left-=T}}if(V!="w"&&V!="e"){O.top+=T*(/n/.test(V)?-1:1)}else{if(this["n"+V]){X.height+=T}if(this["s"+V]){X.height+=T}if(this["n"+V]){O.top-=T}}}Q.position={left:O.left,top:O.top};if(X){Q.cssSize={width:X.width,height:X.height}}Q.update("both")}},toggleHandles:function(L){F(".dnmc-resize",this.wrapper)[L=="on"?"show":"hide"]();if(this.wrapperMode){this.wrapper[L=="on"?"show":"hide"]()}if(L=="on"){this.updateHandles(!this.handlesInitialized)}},removeResizeHandles:function(){F(".dnmc-resize",this.o).each(function(){if(this.customHandle){return true}F(this).remove()});this.n=this.ne=this.e=this.se=this.s=this.sw=this.w=this.nw=false;if(this.wrapperMode){this.wrapper.remove();this.o.unbind(".__rszbl")}this.wrapperMode=false;if(this.opt.hide){this.o.unbind("mouseenter.dnmc").unbind("mouseleave.dnmc")}this.o.unbind("end.draggable.__resizable")},createResizeHandle:function(P){if("static"==this.o.css("position")&&!/td/i.test(this.dom.tagName)&&/w|n/.test(P)){return false}var M=this.opt,O=false;if(M.axis){if(/e|w/.test(P)&&M.axis=="y"){return false}if(/n|s/.test(P)&&M.axis=="x"){return false}}var Q=parseInt(this.wrapper.css("z-index"),10)||0;if(M[P]){if(typeof M[P]=="object"){O=F(M[P])}else{O=F(M[P],this.o)}if(O.length==0){O=false}else{O[0].customHandle=true}}if(!O){O=F("<div></div>").css({position:"absolute",zIndex:"",cursor:P+"-resize",overflow:"hidden"});O.css({width:0,height:0});this.wrapper.append(O)}O.addClass("dnmc-resize").addClass("dnmc-resize-"+P);O.show();if(M.cls.handle){O.addClass(M.cls.handle)}if(M.cls[P]){O.addClass(M.cls[P])}var N=P=="n"||P=="s"?"y":(P=="w"||P=="e"?"x":false);var L=false;if(M.cls.handleHelper){L={helper:M.cls.handleHelper}}if(M.cls[P+"Helper"]){L={helper:M.cls[P+"Helper"]}}O.draggable({axis:N,zIndex:Q,renew:M.renew,delay:M.delay,distance:M.distance,data:P,scope:this,snap:false,restore:M.restore,target:false,cls:L,destroyHelper:true,preserveCursor:true});O.data("draggable").localBind({beforeStart:this.onBeforeStart,start:this.onDragStart,drag:this.onDragResize,end:this.onBeforeEnd,scroll:this.onScroll},this).localEvents=true;this[P]=O},doSnap:function(S,U,O,P){var Q={l:"r",t:"b",r:"l",b:"t"},R=this.dynamic,M=this.opt,L=O.dnmc;if(typeof O.s!="object"){O.s={}}if(typeof this.snapped!="object"){this.snapped={}}if(typeof this.snapped[S]=="object"||typeof this.snapped[Q[S]]=="object"){return true}O.s[S]=true;this.snapped[S]={mx:P.pageX,my:P.pageY,elem:O,mode:(U?"outer":"inner")};R.prepareAbsolute();if(S=="l"){var N=U?L.offset.left+L.size.width:L.offset.left;R.size.width+=R.offset.left-N;R.offset.left=N}if(S=="t"){var T=U?L.offset.top+L.size.height:L.offset.top;R.size.height+=R.offset.top-T;R.offset.top=T}if(S=="b"){R.size.height=U?L.offset.top-R.offset.top:L.offset.top+L.size.height-R.offset.top}if(S=="r"){R.size.width=U?L.offset.left-R.offset.left:L.offset.left+L.size.width-R.offset.left}R.position=R.convertPosition(R.offset,"relative");R.cssSize=R.convertSize(R.size,"inner");this.trigger("snap",this.eventData(P,{target:O.elem,side:S}));if(M.cls.snapped){this.moving.addClass(M.cls.snapped)}if(M.cls.snapTarget){O.addClass(M.cls.snapTarget)}return true},setBounds:function(P){var L=this[P].data("draggable").opt.bound,M=this.opt,N={},O=this.dynamic.rect();if(!L){L={}}if(/w|n/.test(P)){if(M.max&&/n/.test(P)){N.y1=O.y2-M.max.h}if(M.min&&/n/.test(P)){N.y2=O.y2-M.min.h}if(M.max&&/w/.test(P)){N.x1=O.x2-M.max.w}if(M.min&&/w/.test(P)){N.x2=O.x2-M.min.w}}if(/s|e/.test(P)){if(M.max&&/s/.test(P)){N.y2=O.y1+M.max.h}if(M.min&&/s/.test(P)){N.y1=O.y1+M.min.h}if(M.max&&/e/.test(P)){N.x2=O.x1+M.max.w}if(M.min&&/e/.test(P)){N.x1=O.x1+M.min.w}}if(N.x1&&(!L.x1||L.x1<N.x1)){L.x1=N.x1}if(N.x2&&(!L.x2||L.x2>N.x2)){L.x2=N.x2}if(N.y1&&(!L.y1||L.y1<N.y1)){L.y1=N.y1}if(N.y2&&(!L.y2||L.y2>N.y2)){L.y2=N.y2}this[P].data("dynamic").setBounds(L)},correctHandleBound:function(O,M){var N=this.dynamic.rect();var L=this[O].data("dynamic").rect();if(/e/.test(O)&&M.x2!=undefined&&!F.isFunction(M.x2)){M.x2-=N.x2-L.x2}if(/n/.test(O)&&M.y1!=undefined&&!F.isFunction(M.y1)){M.y1+=L.y1-N.y1}if(/w/.test(O)&&M.x1!=undefined&&!F.isFunction(M.x1)){M.x1+=L.x1-N.x1}if(/s/.test(O)&&M.y2!=undefined&&!F.isFunction(M.y2)){M.y2-=N.y2-L.y2}return M},onScroll:function(L){var O=L.diff,M=L.data,N=L.event,P=this.dynamic;if(P.scrollIsRoot){return true}if("fixed"!=P.cssPosition){if(/n/.test(M)){this.startSize.h-=O.y;P.offset.top+=O.y}if(/s/.test(M)){this.startSize.h+=O.y;P.offset.top-=O.y}if(/w/.test(M)){this.startSize.w-=O.x;P.offset.left+=O.x}if(/e/.test(M)){this.startSize.w+=O.x;P.offset.left-=O.x}}this.trigger("scroll",this.eventData(N,{diff:O,handle:M}))},onBeforeStart:function(M){var N=M.data,O=M.event,L=this.opt,P=this[M.data].data("draggable");if(this.trigger("beforeStart",this.eventData(O,{handle:N}))===false){return false}if(!this.checkKey("handle",O)){return false}this.dynamic.prepare();this.inProcess=true;P.opt.scroll=L.scroll;P.opt.scrollStep=L.scrollStep;P.opt.scrollSensitivity=L.scrollSensitivity;if(L.renew||!this.snapCached){if(L.snap){this.initSnap(F(".dnmc-draggable",this.o).add(this.dom),".dnmc-resizable")}this.snapCached=true}if(L.container){P.opt.bound=this.getBoundsFromContainer()}else{P.opt.bound=L.bound}if(L.iframeFix){this.createIframeFix()}this.dynamic.sizeChangeOnly=L.axis=="x"?"w":L.axis=="y"?"h":false;if(L.helper&&this.checkKey("helper",O)){this.createHelper(N,O);P.opt.helperAppendTo=this.helper}if(L.helper||(N&&this[N][0].customHandle)){P.opt.helper=true}},onDragStart:function(M){var N=M.data,O=M.event,P=this.dynamic,L=this.opt,Q=M.data?this[M.data].data("draggable"):false;if(!this.helper&&L.opacity){this.opacity=this.o.css("opacity");this.o.css("opacity",L.opacity)}if(N&&(L.helper||this[N][0].customHandle)&&!L.cls.handleHelper&&!L.cls[N+"Helper"]){Q.moving.css({background:"transparent",visibility:"hidden"})}P.setMinSize(L.min);P.setMaxSize(L.max);P.setRatio(L.ratio);if(L.grid){P.setSizeGrid(L.grid,(N?J[N]:"se"))}else{P.setSizeGrid(false,false)}this.cssPosition=this.o.data("dynamic").cssPosition;this.startSize={w:P.cssSize.width,h:P.cssSize.height};this.startPosition={left:P.position.left,top:P.position.top};this.startOffset={left:P.offset.left,top:P.offset.top};if(N){this.startHandleOffset={left:Q.dynamic.offset.left,top:Q.dynamic.offset.top};if(L.min||L.max){this.setBounds(N)}if(Q.opt.bound){Q.opt.bound=this.correctHandleBound(N,Q.opt.bound)}}if(L.cls.resize){this.o.addClass(L.cls.resize)}this.trigger("start",this.eventData(O,{handle:N}))},onBeforeEnd:function(N,S){var P=N.data,Q=N.event,R=this.dynamic,M=this.opt,O=this;if(!S){S=this.onDragEnd}this.trigger("beforeEnd",this.eventData(Q,{handle:P}));if(this.opt.animate&&this.checkKey("animate",Q)){if(this.opt.restore&&this.checkKey("restore",Q)){R.cssSize={width:this.startSize.w,height:this.startSize.h};R.position=this.startPosition;R.update("both",M.animate,M.easing,function(){S.call(O,N)})}else{if(M.helper&&this.helper&&this.o[0]!=this.helper[0]){var L=this.o.data("dynamic");L.prepareGeneral().prepareSizeRelated();R.prepareAbsolute();L.position=L.convertPosition(this.dynamic.offset,"relative");L.cssSize=L.convertSize(this.dynamic.size,"inner");this.toggleHandles("off");L.update("both",M.animate,M.easing,function(){O.toggleHandles("on");S.call(O,N)})}}}else{if(!M.animate&&M.restore&&this.checkKey("restore",Q)){R.cssSize={width:this.startSize.w,height:this.startSize.h};R.position=this.startPosition;R.update("both");S.call(O,N)}else{S.call(this,N)}}},onDragEnd:function(M){var N=M.data,P=M.event,L=this.opt,O=N?this[N].data("dynamic"):false;if(N&&this[N][0].customHandle&&L.helper){O.position=O.convertPosition(this.startHandleOffset,"relative");O.update("position")}if(this.opacity!==false){this.o.css("opacity",this.opacity)}if(L.helper&&this.helper&&this.helper[0]!=this.o[0]){this.removeHelper();this.dynamic.update("both");if(N){this.updateHandles()}}else{if(L.restore&&N){this.updateHandles()}}this.startSize=false;if(N){var O=this[N].data("draggable");O.opt.helper=false;O.opt.bound=false;O.dynamic.setBounds(false)}if(L.cls.resize){this.o.removeClass(L.cls.resize)}this.trigger("end",this.eventData(P,{handle:N}));if(L.iframeFix){this.removeIframeFix()}this.inProcess=false;this.resetVars()},onDragResize:function(Y){var S=Y.data,V=Y.event,N=Y.self,L=this.opt,W=this.dynamic,U=this.snapped,T=Y.self.data("draggable");T.dynamic.offset=T.dynamic.convertPosition(T.dynamic.position,"absolute");var P=T.dynamic.offset.left-this.startHandleOffset.left;var O=T.dynamic.offset.top-this.startHandleOffset.top;var Q=/w/.test(S)?-1:1;var M=/n/.test(S)?-1:1;var R=0;var X=S=="s"||S=="se"||S=="e"?false:true;if("static"==W.cssPosition){X=false}W.ratioCorrectionMode=S=="n"||S=="s"?"h":"w";if(L.axis!="y"&&!U.l&&!U.r){W.cssSize.width=this.startSize.w+P*Q}if(L.axis!="x"&&!U.t&&!U.b){R=W.cssSize.height=this.startSize.h+O*M}if(X){if(L.axis!="y"&&S!="ne"&&!U.l&&!U.r){W.offset.left=this.startOffset.left+P}if(L.axis!="x"&&S!="sw"&&!U.t&&!U.b){W.offset.top=this.startOffset.top+O}}if(this.snap){W.size=W.convertSize(W.cssSize,"outer");this.checkSnap(V)}if(U){this.unSnap(V)}if(L.withKey&&L.withKey.grid){W.checkSizeGrid=this.checkKey("grid",V)}if(L.withKey&&L.withKey.ratio){W.checkRatio=this.checkKey("ratio",V)}if(W.cssSize.width<1&&X&&S!="ne"){W.offset.left-=-(W.cssSize.width-1)}if(W.cssSize.height<1&&X&&S!="sw"){W.offset.top-=-(W.cssSize.height-1)}W.correctSize();if(X&&L.ratio&&(S=="nw"||S=="ne")&&this.checkKey("ratio",V)){W.offset.top+=R-W.cssSize.height}if(X){W.preparePosition().update("both")}else{W.update("size")}if(!L.helper){this.updateHandles()}this.trigger("sizeChange",this.eventData(V,{handle:S}),true)},onWheel:function(M,N){if(!this.checkKey("wheel",M)){return true}if(!this.opt.animate||this.opt.wheel!==true){return this.doWheelResize(M,N)}if(N!=this.wdelta){if(this.inProcess){this.dynamic.o.stop(true,true)}this.wstrength=5}this.wdelta=N;this.wstrength*=1.8;if(this.wstrength>100){this.wstrength=100}if(!this.wtimer){var L=this;this.wtimer=window.setTimeout(function(){L.doWheelResize(M,N)},50)}return false},doWheelResize:function(O,R){var P=this.dynamic,L=this.opt,N=this;if(this.inProcess){P.o.stop(true,true)}this.inProcess=true;this.wtimer=false;if(!P.oParent){P.prepareGeneral()}P.prepareAbsolute().preparePosition();if(!P.cssSize){P.prepareSizeRelated()}var Q={w:P.cssSize.width,h:P.cssSize.height};var M=L.wheel===true?Math.round(P.cssSize.width/(L.animate?(100/this.wstrength):10)):L.wheel;this.wstrength=5;if(L.axis!="y"){P.cssSize.width+=M*(R>0?1:-1)}if(L.axis!="x"){P.cssSize.height+=M*(R>0?1:-1)}P.setMinSize(L.min);P.correctSize();if("static"!=P.cssPosition){P.position.left+=Math.round((Q.w-P.cssSize.width)/2);P.position.top+=Math.round((Q.h-P.cssSize.height)/2)}if(L.animate){this.toggleHandles("off")}P.update("both",L.animate,L.easing,function(){N.updateHandles();N.trigger("sizeChange",N.eventData(O,{delta:R}),true);N.inProcess=false;if(N.opt.animate){N.toggleHandles("on")}});return false},onMouseDown:function(L){if(this.trigger("beforeStart",this.eventData(L))===false){return false}if(!this.checkKey("clickndrag",L)){return false}this.inProcess=true;if(this.opt.container){this.opt.bound=this.getBoundsFromContainer()}this.startMouse={x:L.pageX,y:L.pageY};this.mouseDelay(L,this.onClicknDragStart,this);return false},onClicknDragStart:function(M){if(this.opt.iframeFix){this.createIframeFix()}if(this.opt.bound){this.dynamic.setBounds(this.opt.bound)}this.dynamic.prepare();if(this.opt.helper){this.createHelper(false,M)}this.onDragStart({data:false,event:M,self:this.o});var L=this;F("body").bind("mouseup.dnmcresize",function(N){L.onBeforeEnd({event:N,handle:false,self:L.o},L.onMouseUp);return false}).bind("mousemove.dnmcresize",function(N){return L.onClicknDrag(N)})},onClicknDrag:function(M){var N=this.dynamic,L=this.opt;if(L.axis!="y"){N.cssSize.width=this.startSize.w+(this.startMouse.y-M.pageY)}if(L.axis!="x"){N.cssSize.height=this.startSize.h+(this.startMouse.y-M.pageY)}N.correctSize();N.position.left=this.startPosition.left+Math.floor((this.startSize.w-N.cssSize.width)/2);N.position.top=this.startPosition.top+Math.floor((this.startSize.h-N.cssSize.height)/2);N.update("both");if(!L.helper){this.updateHandles()}this.trigger("sizeChange",this.eventData(M),true);return true},onMouseUp:function(L){F("body").unbind("mouseup.dnmcresize").unbind("mousemove.dnmcresize");this.onDragEnd(L);this.dynamic.prepareGeneral();this.updateHandles();return false}});var A={draggable:K,droppable:I,resizable:C};F.each(A,function(L){F.fn[L]=function(M){if("destroy"==M){return this.each(function(){var O=F(this).data(L);if(O==undefined){return true}O.toggle(false);F(this).removeData(L);return true})}if("restart"==M){return this.each(function(){var O=F(this).data(L);if(O==undefined){return true}O.toggle(false).toggle(true)})}var N=typeof M;return this.each(function(){var O=false,S=F(this),R=S.data(L);if(R==undefined){O=true;S.data(L,new A[L](this));R=S.data(L)}if(O){var P=F.extend({},F.fn[L].defaults,M);R.setOptions(P)}if(!O&&(!M||N=="object")){R.setOptions(M)}if(N=="string"){if(M.indexOf("!")==0&&F.fn[L].presets[M.substr(1)]){S.unbind("."+L+"."+M.substr(1))}else{if(F.fn[L].presets[M]){var Q=F.fn[L].presets[M];R.setOptions(Q,M)}}}if(O&&!P.skipEnable){R.toggle(true)}if(!O&&(N=="boolean"||M=="enable"||M=="disable")){R.toggle(M)}})};F.fn[L].defaults={};F.fn[L].presets={}})})(jQuery);