/*
 * jQuery UI Resizable 1.6rc4
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *	ui.core.js
 */(function(A){A.widget("ui.resizable",A.extend({},A.ui.mouse,{_init:function(){var M=this,N=this.options;var Q=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(Q)?"relative":Q});A.extend(N,{_aspectRatio:!!(N.aspectRatio),helper:N.helper||N.ghost||N.animate?N.helper||"ui-resizable-helper":null,knobHandles:N.knobHandles===true?"ui-resizable-knob-handle":N.knobHandles});var H="1px solid #DEDEDE";N.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:H},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:H},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:H},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:H},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:H,borderBottom:H},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:H,borderLeft:H},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:H,borderTop:H},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:H,borderTop:H}};N.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};N._nodeName=this.element[0].nodeName;if(N._nodeName.match(/canvas|textarea|input|select|button|img/i)){var B=this.element;if(/relative/.test(B.css("position"))&&A.browser.opera){B.css({position:"relative",top:"auto",left:"auto"})}B.wrap(A('<div class="ui-wrapper"	style="overflow: hidden;"></div>').css({position:B.css("position"),width:B.outerWidth(),height:B.outerHeight(),top:B.css("top"),left:B.css("left")}));var J=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:J.css("marginLeft"),marginTop:J.css("marginTop"),marginRight:J.css("marginRight"),marginBottom:J.css("marginBottom")});J.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(A.browser.safari&&N.preventDefault){J.css("resize","none")}N.proportionallyResize=J.css({position:"static",zoom:1,display:"block"});this.element.css({margin:J.css("margin")});this._proportionallyResize()}if(!N.handles){N.handles=!A(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(N.handles.constructor==String){N.zIndex=N.zIndex||1000;if(N.handles=="all"){N.handles="n,e,s,w,se,sw,ne,nw"}var O=N.handles.split(",");N.handles={};var G={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var R=0;R<O.length;R++){var S=A.trim(O[R]),L=N.defaultTheme,F="ui-resizable-"+S,C=!A.ui.css(F)&&!N.knobHandles,P=A.ui.css("ui-resizable-knob-handle"),T=A.extend(L[F],L["ui-resizable-handle"]),D=A.extend(N.knobTheme[F],!P?N.knobTheme["ui-resizable-handle"]:{});var K=/sw|se|ne|nw/.test(S)?{zIndex:++N.zIndex}:{};var I=(C?G[S]:""),E=A(['<div class="ui-resizable-handle ',F,'" style="',I,G.handle,'"></div>'].join("")).css(K);N.handles[S]=".ui-resizable-"+S;this.element.append(E.css(C?T:{}).css(N.knobHandles?D:{}).addClass(N.knobHandles?"ui-resizable-knob-handle":"").addClass(N.knobHandles))}if(N.knobHandles){this.element.addClass("ui-resizable-knob").css(!A.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(Y){Y=Y||this.element;for(var V in N.handles){if(N.handles[V].constructor==String){N.handles[V]=A(N.handles[V],this.element).show()}if(N.transparent){N.handles[V].css({opacity:0})}if(this.element.is(".ui-wrapper")&&N._nodeName.match(/textarea|input|select|button/i)){var W=A(N.handles[V],this.element),X=0;X=/sw|ne|nw|se|n|s/.test(V)?W.outerHeight():W.outerWidth();var U=["padding",/ne|nw|n/.test(V)?"Top":/se|sw|s/.test(V)?"Bottom":/^e$/.test(V)?"Right":"Left"].join("");if(!N.transparent){Y.css(U,X)}this._proportionallyResize()}if(!A(N.handles[V]).length){continue}}};this._renderAxis(this.element);N._handles=A(".ui-resizable-handle",M.element);if(N.disableSelection){N._handles.disableSelection()}N._handles.mouseover(function(){if(!N.resizing){if(this.className){var U=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}M.axis=N.axis=U&&U[1]?U[1]:"se"}});if(N.autoHide){N._handles.hide();A(M.element).addClass("ui-resizable-autohide").hover(function(){A(this).removeClass("ui-resizable-autohide");N._handles.show()},function(){if(!N.resizing){A(this).addClass("ui-resizable-autohide");N._handles.hide()}})}this._mouseInit()},destroy:function(){var D=this.element,C=D.children(".ui-resizable").get(0);this._mouseDestroy();var B=function(E){A(E).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};B(D);if(D.is(".ui-wrapper")&&C){D.parent().append(A(C).css({position:D.css("position"),width:D.outerWidth(),height:D.outerHeight(),top:D.css("top"),left:D.css("left")})).end().remove();B(C)}},_mouseCapture:function(C){if(this.options.disabled){return false}var D=false;for(var B in this.options.handles){if(A(this.options.handles[B])[0]==C.target){D=true}}if(!D){return false}return true},_mouseStart:function(C){var D=this.options,B=this.element.position(),E=this.element,I=function(N){return parseInt(N,10)||0},H=A.browser.msie&&A.browser.version<7;D.resizing=true;D.documentScroll={top:A(document).scrollTop(),left:A(document).scrollLeft()};if(E.is(".ui-draggable")||(/absolute/).test(E.css("position"))){var K=A.browser.msie&&!D.containment&&(/absolute/).test(E.css("position"))&&!(/relative/).test(E.parent().css("position"));var L=K?D.documentScroll.top:0,G=K?D.documentScroll.left:0;E.css({position:"absolute",top:(B.top+L),left:(B.left+G)})}if(A.browser.opera&&(/relative/).test(E.css("position"))){E.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var M=I(this.helper.css("left")),F=I(this.helper.css("top"));if(D.containment){M+=A(D.containment).scrollLeft()||0;F+=A(D.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:M,top:F};this.size=D.helper||H?{width:E.outerWidth(),height:E.outerHeight()}:{width:E.width(),height:E.height()};this.originalSize=D.helper||H?{width:E.outerWidth(),height:E.outerHeight()}:{width:E.width(),height:E.height()};this.originalPosition={left:M,top:F};this.sizeDiff={width:E.outerWidth()-E.width(),height:E.outerHeight()-E.height()};this.originalMousePosition={left:C.pageX,top:C.pageY};D.aspectRatio=(typeof D.aspectRatio=="number")?D.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(D.preserveCursor){var J=A(".ui-resizable-"+this.axis).css("cursor");A("body").css("cursor",J=="auto"?this.axis+"-resize":J)}this._propagate("start",C);return true},_mouseDrag:function(B){var E=this.helper,D=this.options,J={},M=this,G=this.originalMousePosition,K=this.axis;var N=(B.pageX-G.left)||0,L=(B.pageY-G.top)||0;var F=this._change[K];if(!F){return false}var I=F.apply(this,[B,N,L]),H=A.browser.msie&&A.browser.version<7,C=this.sizeDiff;if(D._aspectRatio||B.shiftKey){I=this._updateRatio(I,B)}I=this._respectSize(I,B);this._propagate("resize",B);E.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!D.helper&&D.proportionallyResize){this._proportionallyResize()}this._updateCache(I);this.element.triggerHandler("resize",[B,this.ui()],this.options["resize"]);return false},_mouseStop:function(E){this.options.resizing=false;var F=this.options,I=function(M){return parseInt(M,10)||0},K=this;if(F.helper){var D=F.proportionallyResize,B=D&&(/textarea/i).test(D.get(0).nodeName),C=B&&A.ui.hasScroll(D.get(0),"left")?0:K.sizeDiff.height,H=B?0:K.sizeDiff.width;var L={width:(K.size.width-H),height:(K.size.height-C)},G=(parseInt(K.element.css("left"),10)+(K.position.left-K.originalPosition.left))||null,J=(parseInt(K.element.css("top"),10)+(K.position.top-K.originalPosition.top))||null;if(!F.animate){this.element.css(A.extend(L,{top:J,left:G}))}if(F.helper&&!F.animate){this._proportionallyResize()}}if(F.preserveCursor){A("body").css("cursor","auto")}this._propagate("stop",E);if(F.helper){this.helper.remove()}return false},_updateCache:function(B){var C=this.options;this.offset=this.helper.offset();if(B.left){this.position.left=B.left}if(B.top){this.position.top=B.top}if(B.height){this.size.height=B.height}if(B.width){this.size.width=B.width}},_updateRatio:function(E,D){var F=this.options,G=this.position,C=this.size,B=this.axis;if(E.height){E.width=(C.height*F.aspectRatio)}else{if(E.width){E.height=(C.width/F.aspectRatio)}}if(B=="sw"){E.left=G.left+(C.width-E.width);E.top=null}if(B=="nw"){E.top=G.top+(C.height-E.height);E.left=G.left+(C.width-E.width)}return E},_respectSize:function(I,D){var G=this.helper,F=this.options,N=F._aspectRatio||D.shiftKey,M=this.axis,P=I.width&&F.maxWidth&&F.maxWidth<I.width,J=I.height&&F.maxHeight&&F.maxHeight<I.height,E=I.width&&F.minWidth&&F.minWidth>I.width,O=I.height&&F.minHeight&&F.minHeight>I.height;if(E){I.width=F.minWidth}if(O){I.height=F.minHeight}if(P){I.width=F.maxWidth}if(J){I.height=F.maxHeight}var C=this.originalPosition.left+this.originalSize.width,L=this.position.top+this.size.height;var H=/sw|nw|w/.test(M),B=/nw|ne|n/.test(M);if(E&&H){I.left=C-F.minWidth}if(P&&H){I.left=C-F.maxWidth}if(O&&B){I.top=L-F.minHeight}if(J&&B){I.top=L-F.maxHeight}var K=!I.width&&!I.height;if(K&&!I.left&&I.top){I.top=null}else{if(K&&!I.top&&I.left){I.left=null}}return I},_proportionallyResize:function(){var F=this.options;if(!F.proportionallyResize){return }var D=F.proportionallyResize,C=this.helper||this.element;if(!F.borderDif){var B=[D.css("borderTopWidth"),D.css("borderRightWidth"),D.css("borderBottomWidth"),D.css("borderLeftWidth")],E=[D.css("paddingTop"),D.css("paddingRight"),D.css("paddingBottom"),D.css("paddingLeft")];F.borderDif=A.map(B,function(G,I){var H=parseInt(G,10)||0,J=parseInt(E[I],10)||0;return H+J})}D.css({height:(C.height()-F.borderDif[0]-F.borderDif[2])+"px",width:(C.width()-F.borderDif[1]-F.borderDif[3])+"px"})},_renderProxy:function(){var C=this.element,F=this.options;this.elementOffset=C.offset();if(F.helper){this.helper=this.helper||A('<div style="overflow:hidden;"></div>');var B=A.browser.msie&&A.browser.version<7,D=(B?1:0),E=(B?2:-1);this.helper.addClass(F.helper).css({width:C.outerWidth()+E,height:C.outerHeight()+E,position:"absolute",left:this.elementOffset.left-D+"px",top:this.elementOffset.top-D+"px",zIndex:++F.zIndex});this.helper.appendTo("body");if(F.disableSelection){this.helper.disableSelection()}}else{this.helper=C}},_change:{e:function(D,C,B){return{width:this.originalSize.width+C}},w:function(E,C,B){var G=this.options,D=this.originalSize,F=this.originalPosition;return{left:F.left+C,width:D.width-C}},n:function(E,C,B){var G=this.options,D=this.originalSize,F=this.originalPosition;return{top:F.top+B,height:D.height-B}},s:function(D,C,B){return{height:this.originalSize.height+B}},se:function(D,C,B){return A.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[D,C,B]))},sw:function(D,C,B){return A.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[D,C,B]))},ne:function(D,C,B){return A.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[D,C,B]))},nw:function(D,C,B){return A.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[D,C,B]))}},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);if(C!="resize"){this.element.triggerHandler(["resize",C].join(""),[B,this.ui()],this.options[C])}},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));A.extend(A.ui.resizable,{version:"1.6rc4",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input",containment:false,delay:0,disableSelection:true,distance:1,ghost:false,grid:false,knobHandles:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false}});A.ui.plugin.add("resizable","alsoResize",{start:function(C,D){var F=D.options,B=A(this).data("resizable"),E=function(G){A(G).each(function(){A(this).data("resizable-alsoresize",{width:parseInt(A(this).width(),10),height:parseInt(A(this).height(),10),left:parseInt(A(this).css("left"),10),top:parseInt(A(this).css("top"),10)})})};if(typeof (F.alsoResize)=="object"&&!F.alsoResize.parentNode){if(F.alsoResize.length){F.alsoResize=F.alsoResize[0];E(F.alsoResize)}else{A.each(F.alsoResize,function(G,H){E(G)})}}else{E(F.alsoResize)}},resize:function(D,F){var G=F.options,C=A(this).data("resizable"),E=C.originalSize,I=C.originalPosition;var H={height:(C.size.height-E.height)||0,width:(C.size.width-E.width)||0,top:(C.position.top-I.top)||0,left:(C.position.left-I.left)||0},B=function(J,K){A(J).each(function(){var N=A(this).data("resizable-alsoresize"),M={},L=K&&K.length?K:["width","height","top","left"];A.each(L||["width","height","top","left"],function(O,Q){var P=(N[Q]||0)+(H[Q]||0);if(P&&P>=0){M[Q]=P||null}});A(this).css(M)})};if(typeof (G.alsoResize)=="object"&&!G.alsoResize.nodeType){A.each(G.alsoResize,function(J,K){B(J,K)})}else{B(G.alsoResize)}},stop:function(B,C){A(this).removeData("resizable-alsoresize-start")}});A.ui.plugin.add("resizable","animate",{stop:function(F,K){var G=K.options,L=A(this).data("resizable");var E=G.proportionallyResize,B=E&&(/textarea/i).test(E.get(0).nodeName),C=B&&A.ui.hasScroll(E.get(0),"left")?0:L.sizeDiff.height,I=B?0:L.sizeDiff.width;var D={width:(L.size.width-I),height:(L.size.height-C)},H=(parseInt(L.element.css("left"),10)+(L.position.left-L.originalPosition.left))||null,J=(parseInt(L.element.css("top"),10)+(L.position.top-L.originalPosition.top))||null;L.element.animate(A.extend(D,J&&H?{top:J,left:H}:{}),{duration:G.animateDuration,easing:G.animateEasing,step:function(){var M={width:parseInt(L.element.css("width"),10),height:parseInt(L.element.css("height"),10),top:parseInt(L.element.css("top"),10),left:parseInt(L.element.css("left"),10)};if(E){E.css({width:M.width,height:M.height})}L._updateCache(M);L._propagate("animate",F)}})}});A.ui.plugin.add("resizable","containment",{start:function(C,K){var F=K.options,M=A(this).data("resizable"),H=M.element;var D=F.containment,G=(D instanceof A)?D.get(0):(/parent/.test(D))?H.parent().get(0):D;if(!G){return }M.containerElement=A(G);if(/document/.test(D)||D==document){M.containerOffset={left:0,top:0};M.containerPosition={left:0,top:0};M.parentData={element:A(document),left:0,top:0,width:A(document).width(),height:A(document).height()||document.body.parentNode.scrollHeight}}else{M.containerOffset=A(G).offset();M.containerPosition=A(G).position();M.containerSize={height:A(G).innerHeight(),width:A(G).innerWidth()};var J=M.containerOffset,B=M.containerSize.height,I=M.containerSize.width,E=(A.ui.hasScroll(G,"left")?G.scrollWidth:I),L=(A.ui.hasScroll(G)?G.scrollHeight:B);M.parentData={element:G,left:J.left,top:J.top,width:E,height:L}}},resize:function(D,K){var F=K.options,N=A(this).data("resizable"),C=N.containerSize,J=N.containerOffset,H=N.size,I=N.position,L=F._aspectRatio||D.shiftKey,B={top:0,left:0},E=N.containerElement;if(E[0]!=document&&(/static/).test(E.css("position"))){B=N.containerPosition}if(I.left<(F.helper?J.left:0)){N.size.width=N.size.width+(F.helper?(N.position.left-J.left):(N.position.left-B.left));if(L){N.size.height=N.size.width/F.aspectRatio}N.position.left=F.helper?J.left:0}if(I.top<(F.helper?J.top:0)){N.size.height=N.size.height+(F.helper?(N.position.top-J.top):N.position.top);if(L){N.size.width=N.size.height*F.aspectRatio}N.position.top=F.helper?J.top:0}var G=Math.abs((F.helper?N.offset.left-B.left:(N.offset.left-B.left))+N.sizeDiff.width),M=Math.abs((F.helper?N.offset.top-B.top:(N.offset.top-J.top))+N.sizeDiff.height);if(G+N.size.width>=N.parentData.width){N.size.width=N.parentData.width-G;if(L){N.size.height=N.size.width/F.aspectRatio}}if(M+N.size.height>=N.parentData.height){N.size.height=N.parentData.height-M;if(L){N.size.width=N.size.height*F.aspectRatio}}},stop:function(C,J){var D=J.options,L=A(this).data("resizable"),H=L.position,I=L.containerOffset,B=L.containerPosition,E=L.containerElement;var F=A(L.helper),M=F.offset(),K=F.outerWidth()-L.sizeDiff.width,G=F.outerHeight()-L.sizeDiff.height;if(D.helper&&!D.animate&&(/relative/).test(E.css("position"))){A(this).css({left:M.left-B.left-I.left,width:K,height:G})}if(D.helper&&!D.animate&&(/static/).test(E.css("position"))){A(this).css({left:M.left-B.left-I.left,width:K,height:G})}}});A.ui.plugin.add("resizable","ghost",{start:function(D,E){var F=E.options,B=A(this).data("resizable"),G=F.proportionallyResize,C=B.size;if(!G){B.ghost=B.element.clone()}else{B.ghost=G.clone()}B.ghost.css({opacity:0.25,display:"block",position:"relative",height:C.height,width:C.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof F.ghost=="string"?F.ghost:"");B.ghost.appendTo(B.helper)},resize:function(C,D){var E=D.options,B=A(this).data("resizable"),F=E.proportionallyResize;if(B.ghost){B.ghost.css({position:"relative",height:B.size.height,width:B.size.width})}},stop:function(C,D){var E=D.options,B=A(this).data("resizable"),F=E.proportionallyResize;if(B.ghost&&B.helper){B.helper.get(0).removeChild(B.ghost.get(0))}}});A.ui.plugin.add("resizable","grid",{resize:function(B,J){var E=J.options,L=A(this).data("resizable"),H=L.size,F=L.originalSize,G=L.originalPosition,K=L.axis,I=E._aspectRatio||B.shiftKey;E.grid=typeof E.grid=="number"?[E.grid,E.grid]:E.grid;var D=Math.round((H.width-F.width)/(E.grid[0]||1))*(E.grid[0]||1),C=Math.round((H.height-F.height)/(E.grid[1]||1))*(E.grid[1]||1);if(/^(se|s|e)$/.test(K)){L.size.width=F.width+D;L.size.height=F.height+C}else{if(/^(ne)$/.test(K)){L.size.width=F.width+D;L.size.height=F.height+C;L.position.top=G.top-C}else{if(/^(sw)$/.test(K)){L.size.width=F.width+D;L.size.height=F.height+C;L.position.left=G.left-D}else{L.size.width=F.width+D;L.size.height=F.height+C;L.position.top=G.top-C;L.position.left=G.left-D}}}}})})(jQuery)