(function(B){B.ui={plugin:{add:function(F,G,D){var E=B.ui[F].prototype;for(var H in D){E.plugins[H]=E.plugins[H]||[];E.plugins[H].push([G,D[H]])}},call:function(G,E,F){var D=G.plugins[E];if(!D){return}for(var H=0;H<D.length;H++){if(G.options[D[H][0]]){D[H][1].apply(G.element,F)}}}},cssCache:{},css:function(D){if(B.ui.cssCache[D]){return B.ui.cssCache[D]}var E=B('<div class="ui-gen">').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");B.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{B("body").get(0).removeChild(E.get(0))}catch(F){}return B.ui.cssCache[D]},disableSelection:function(D){B(D).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(D){B(D).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(F,D){var E=/top/.test(D||"top")?"scrollTop":"scrollLeft",G=false;if(F[E]>0){return true}F[E]=1;G=F[E]>0?true:false;F[E]=0;return G}};var A=B.fn.remove;B.fn.remove=function(){B("*",this).add(this).triggerHandler("remove");return A.apply(this,arguments)};function C(D,G,E){var F=B[D][G].getter||[];F=(typeof F=="string"?F.split(/,?\s+/):F);return(B.inArray(E,F)!=-1)}B.widget=function(E,F){var D=E.split(".")[0];E=E.split(".")[1];B.fn[E]=function(J){var H=(typeof J=="string"),G=Array.prototype.slice.call(arguments,1);if(H&&C(D,E,J)){var I=B.data(this[0],E);return(I?I[J].apply(I,G):undefined)}return this.each(function(){var K=B.data(this,E);if(H&&K&&B.isFunction(K[J])){K[J].apply(K,G)}else{if(!H){B.data(this,E,new B[D][E](this,J))}}})};B[D][E]=function(H,I){var G=this;this.widgetName=E;this.widgetBaseClass=D+"-"+E;this.options=B.extend({},B.widget.defaults,B[D][E].defaults,I);this.element=B(H).bind("setData."+E,function(L,K,J){return G.setData(K,J)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};B[D][E].prototype=B.extend({},B.widget.prototype,F)};B.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(E,D){this.options[E]=D;if(E=="disabled"){this.element[D?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};B.widget.defaults={disabled:false};B.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(B.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(B.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,D=(F.which==1),G=(typeof this.options.cancel=="string"?B(F.target).parents().add(F.target).filter(this.options.cancel).length:false);if(!D||G||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};B(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(B.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){B(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};B.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{init:function(){var B=this.options;if(B.helper=="original"&&!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}this.element.addClass("ui-draggable");(B.disabled&&this.element.addClass("ui-draggable-disabled"));this.mouseInit()},mouseStart:function(F){var B=this.options;if(this.helper||B.disabled||A(F.target).is(".ui-resizable-handle")){return false}var H=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==F.target){H=true}});if(!H){return false}if(A.ui.ddmanager){A.ui.ddmanager.current=this}this.helper=A.isFunction(B.helper)?A(B.helper.apply(this.element[0],[F])):(B.helper=="clone"?this.element.clone():this.element);if(!this.helper.parents("body").length){this.helper.appendTo((B.appendTo=="parent"?this.element[0].parentNode:B.appendTo))}if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position"))){this.helper.css("position","absolute")}this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:F.pageX-this.offset.left,top:F.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var G=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&A.browser.mozilla){G={top:0,left:0}}this.offset.parent={top:G.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:G.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var C=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:C.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:C.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(B.cursorAt){if(B.cursorAt.left!=undefined){this.offset.click.left=B.cursorAt.left+this.margins.left}if(B.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-B.cursorAt.right+this.margins.left}if(B.cursorAt.top!=undefined){this.offset.click.top=B.cursorAt.top+this.margins.top}if(B.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.cursorAt.bottom+this.margins.top}}if(B.containment){if(B.containment=="parent"){B.containment=this.helper[0].parentNode}if(B.containment=="document"||B.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(B.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(B.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(B.containment)){var E=A(B.containment)[0];var D=A(B.containment).offset();this.containment=[D.left+(parseInt(A(E).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,D.top+(parseInt(A(E).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,D.left+Math.max(E.scrollWidth,E.offsetWidth)-(parseInt(A(E).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),D.top+Math.max(E.scrollHeight,E.offsetHeight)-(parseInt(A(E).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}}this.propagate("start",F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(A.ui.ddmanager&&!B.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,F)}this.helper.addClass("ui-draggable-dragging");this.mouseDrag(F);return true},convertPositionTo:function(C,B){if(!B){B=this.position}var D=C=="absolute"?1:-1;return{top:(B.top+this.offset.relative.top*D+this.offset.parent.top*D-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*D+(this.cssPosition=="fixed"?A(document).scrollTop():0)*D+this.margins.top*D),left:(B.left+this.offset.relative.left*D+this.offset.parent.left*D-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*D+(this.cssPosition=="fixed"?A(document).scrollLeft():0)*D+this.margins.left*D)}},generatePosition:function(E){var B=this.options;var F={top:(E.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)-(this.cssPosition=="fixed"?A(document).scrollTop():0)),left:(E.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)-(this.cssPosition=="fixed"?A(document).scrollLeft():0))};if(!this.originalPosition){return F}if(this.containment){if(F.left<this.containment[0]){F.left=this.containment[0]}if(F.top<this.containment[1]){F.top=this.containment[1]}if(F.left>this.containment[2]){F.left=this.containment[2]}if(F.top>this.containment[3]){F.top=this.containment[3]}}if(B.grid){var C=this.originalPosition.top+Math.round((F.top-this.originalPosition.top)/B.grid[1])*B.grid[1];F.top=this.containment?(!(C<this.containment[1]||C>this.containment[3])?C:(!(C<this.containment[1])?C-B.grid[1]:C+B.grid[1])):C;var D=this.originalPosition.left+Math.round((F.left-this.originalPosition.left)/B.grid[0])*B.grid[0];F.left=this.containment?(!(D<this.containment[0]||D>this.containment[2])?D:(!(D<this.containment[0])?D-B.grid[0]:D+B.grid[0])):D}return F},mouseDrag:function(B){this.position=this.generatePosition(B);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",B)||this.position;if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){var D=A.ui.ddmanager.drop(this,C)}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){B.propagate("stop",C);B.clear()})}else{this.propagate("stop",C);this.clear()}return false},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!="original"&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},plugins:{},uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}},propagate:function(B,C){A.ui.plugin.call(this,B,[C,this.uiHash()]);if(B=="drag"){this.positionAbs=this.convertPositionTo("absolute")}return this.element.triggerHandler(B=="drag"?B:"drag"+B,[C,this.uiHash()],this.options[B])},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable");this.mouseDestroy()}}));A.extend(A.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input",delay:0,distance:1,helper:"original"}});A.ui.plugin.add("draggable","cursor",{start:function(D,C){var B=A("body");if(B.css("cursor")){C.options._cursor=B.css("cursor")}B.css("cursor",C.options.cursor)},stop:function(C,B){if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("draggable","zIndex",{start:function(D,C){var B=A(C.helper);if(B.css("zIndex")){C.options._zIndex=B.css("zIndex")}B.css("zIndex",C.options.zIndex)},stop:function(C,B){if(B.options._zIndex){A(B.helper).css("zIndex",B.options._zIndex)}}});A.ui.plugin.add("draggable","opacity",{start:function(D,C){var B=A(C.helper);if(B.css("opacity")){C.options._opacity=B.css("opacity")}B.css("opacity",C.options.opacity)},stop:function(C,B){if(B.options._opacity){A(B.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(C,B){A(B.options.iframeFix===true?"iframe":B.options.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(C,B){A("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","scroll",{start:function(E,C){var B=C.options;var D=A(this).data("draggable");B.scrollSensitivity=B.scrollSensitivity||20;B.scrollSpeed=B.scrollSpeed||20;D.overflowY=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-y"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);D.overflowX=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-x"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);if(D.overflowY[0]!=document&&D.overflowY[0].tagName!="HTML"){D.overflowYOffset=D.overflowY.offset()}if(D.overflowX[0]!=document&&D.overflowX[0].tagName!="HTML"){D.overflowXOffset=D.overflowX.offset()}},drag:function(E,C){var B=C.options;var D=A(this).data("draggable");if(D.overflowY[0]!=document&&D.overflowY[0].tagName!="HTML"){if((D.overflowYOffset.top+D.overflowY[0].offsetHeight)-E.pageY<B.scrollSensitivity){D.overflowY[0].scrollTop=D.overflowY[0].scrollTop+B.scrollSpeed}if(E.pageY-D.overflowYOffset.top<B.scrollSensitivity){D.overflowY[0].scrollTop=D.overflowY[0].scrollTop-B.scrollSpeed}}else{if(E.pageY-A(document).scrollTop()<B.scrollSensitivity){A(document).scrollTop(A(document).scrollTop()-B.scrollSpeed)}if(A(window).height()-(E.pageY-A(document).scrollTop())<B.scrollSensitivity){A(document).scrollTop(A(document).scrollTop()+B.scrollSpeed)}}if(D.overflowX[0]!=document&&D.overflowX[0].tagName!="HTML"){if((D.overflowXOffset.left+D.overflowX[0].offsetWidth)-E.pageX<B.scrollSensitivity){D.overflowX[0].scrollLeft=D.overflowX[0].scrollLeft+B.scrollSpeed}if(E.pageX-D.overflowXOffset.left<B.scrollSensitivity){D.overflowX[0].scrollLeft=D.overflowX[0].scrollLeft-B.scrollSpeed}}else{if(E.pageX-A(document).scrollLeft()<B.scrollSensitivity){A(document).scrollLeft(A(document).scrollLeft()-B.scrollSpeed)}if(A(window).width()-(E.pageX-A(document).scrollLeft())<B.scrollSensitivity){A(document).scrollLeft(A(document).scrollLeft()+B.scrollSpeed)}}}});A.ui.plugin.add("draggable","snap",{start:function(D,C){var B=A(this).data("draggable");B.snapElements=[];A(C.options.snap===true?".ui-draggable":C.options.snap).each(function(){var F=A(this);var E=F.offset();if(this!=B.element[0]){B.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:E.top,left:E.left})}})},drag:function(N,G){var R=A(this).data("draggable");var M=G.options.snapTolerance||20;var J=G.absolutePosition.left,O=J+R.helperProportions.width,K=G.absolutePosition.top,P=K+R.helperProportions.height;for(var H=R.snapElements.length-1;H>=0;H--){var I=R.snapElements[H].left,D=I+R.snapElements[H].width,E=R.snapElements[H].top,L=E+R.snapElements[H].height;if(!((I-M<J&&J<D+M&&E-M<K&&K<L+M)||(I-M<J&&J<D+M&&E-M<P&&P<L+M)||(I-M<O&&O<D+M&&E-M<K&&K<L+M)||(I-M<O&&O<D+M&&E-M<P&&P<L+M))){continue}if(G.options.snapMode!="inner"){var B=Math.abs(E-P)<=20;var F=Math.abs(L-K)<=20;var C=Math.abs(I-O)<=20;var Q=Math.abs(D-J)<=20;if(B){G.position.top=R.convertPositionTo("relative",{top:E-R.helperProportions.height,left:0}).top}if(F){G.position.top=R.convertPositionTo("relative",{top:L,left:0}).top}if(C){G.position.left=R.convertPositionTo("relative",{top:0,left:I-R.helperProportions.width}).left}if(Q){G.position.left=R.convertPositionTo("relative",{top:0,left:D}).left}}if(G.options.snapMode!="outer"){var B=Math.abs(E-K)<=20;var F=Math.abs(L-P)<=20;var C=Math.abs(I-J)<=20;var Q=Math.abs(D-O)<=20;if(B){G.position.top=R.convertPositionTo("relative",{top:E,left:0}).top}if(F){G.position.top=R.convertPositionTo("relative",{top:L-R.helperProportions.height,left:0}).top}if(C){G.position.left=R.convertPositionTo("relative",{top:0,left:I}).left}if(Q){G.position.left=R.convertPositionTo("relative",{top:0,left:D-R.helperProportions.width}).left}}}}});A.ui.plugin.add("draggable","connectToSortable",{start:function(D,C){var B=A(this).data("draggable");B.sortables=[];A(C.options.connectToSortable).each(function(){if(A.data(this,"sortable")){var E=A.data(this,"sortable");B.sortables.push({instance:E,shouldRevert:E.options.revert});E.refreshItems();E.propagate("activate",D,B)}})},stop:function(D,C){var B=A(this).data("draggable");A.each(B.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;B.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance.mouseStop(D);this.instance.element.triggerHandler("sortreceive",[D,A.extend(this.instance.ui(),{sender:B.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper}else{this.instance.propagate("deactivate",D,B)}})},drag:function(F,C){var B=A(this).data("draggable"),E=this;var D=function(H){var K=H.left,G=K+H.width,J=H.top,I=J+H.height;return(K<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<G&&J<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<I)};A.each(B.sortables,function(G){if(D.call(B,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(E).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return C.helper[0]};F.target=this.instance.currentItem[0];this.instance.mouseCapture(F,true);this.instance.mouseStart(F,true,true);this.instance.offset.click.top=B.offset.click.top;this.instance.offset.click.left=B.offset.click.left;this.instance.offset.parent.left-=B.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=B.offset.parent.top-this.instance.offset.parent.top;B.propagate("toSortable",F)}if(this.instance.currentItem){this.instance.mouseDrag(F)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(F,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}B.propagate("fromSortable",F)}}})}});A.ui.plugin.add("draggable","stack",{start:function(D,C){var B=A.makeArray(A(C.options.stack.group)).sort(function(E,F){return(parseInt(A(E).css("zIndex"),10)||C.options.stack.min)-(parseInt(A(F).css("zIndex"),10)||C.options.stack.min)});A(B).each(function(E){this.style.zIndex=C.options.stack.min+E});this[0].style.zIndex=C.options.stack.min+B.length}})})(jQuery);(function(A){A.widget("ui.resizable",A.extend({},A.ui.mouse,{init:function(){var S=this,L=this.options;var M=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(M)?"relative":M});A.extend(L,{_aspectRatio:!!(L.aspectRatio),helper:L.helper||L.ghost||L.animate?L.helper||"proxy":null,knobHandles:L.knobHandles===true?"ui-resizable-knob-handle":L.knobHandles});var D="1px solid #DEDEDE";L.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#FFFFFF",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:D},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:D},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:D},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:D},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:D,borderBottom:D},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:D,borderLeft:D},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:D,borderTop:D},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:D,borderTop:D}};L.knobTheme={"ui-resizable-handle":{background:"#FFFFFF",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"}};L._nodeName=this.element[0].nodeName;if(L._nodeName.match(/canvas|textarea|input|select|button|img/i)){var R=this.element;if(/relative/.test(R.css("position"))&&A.browser.opera){R.css({position:"relative",top:"auto",left:"auto"})}R.wrap(A('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:R.css("position"),width:R.outerWidth(),height:R.outerHeight(),top:R.css("top"),left:R.css("left")}));var C=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:C.css("marginLeft"),marginTop:C.css("marginTop"),marginRight:C.css("marginRight"),marginBottom:C.css("marginBottom")});C.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(A.browser.safari&&L.preventDefault){C.css("resize","none")}L.proportionallyResize=C.css({position:"static",zoom:1,display:"block"});this.element.css({margin:C.css("margin")});this._proportionallyResize()}if(!L.handles){L.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(L.handles.constructor==String){L.zIndex=L.zIndex||1000;if(L.handles=="all"){L.handles="n,e,s,w,se,sw,ne,nw"}var H=L.handles.split(",");L.handles={};var B={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 F=0;F<H.length;F++){var G=A.trim(H[F]),O=L.defaultTheme,P="ui-resizable-"+G,J=!A.ui.css(P)&&!L.knobHandles,T=A.ui.css("ui-resizable-knob-handle"),I=A.extend(O[P],O["ui-resizable-handle"]),Q=A.extend(L.knobTheme[P],!T?L.knobTheme["ui-resizable-handle"]:{});var N=/sw|se|ne|nw/.test(G)?{zIndex:++L.zIndex}:{};var E=(J?B[G]:""),K=A(['<div class="ui-resizable-handle ',P,'" style="',E,B.handle,'"></div>'].join("")).css(N);L.handles[G]=".ui-resizable-"+G;this.element.append(K.css(J?I:{}).css(L.knobHandles?Q:{}).addClass(L.knobHandles?"ui-resizable-knob-handle":"").addClass(L.knobHandles))}if(L.knobHandles){this.element.addClass("ui-resizable-knob").css(!A.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(W){W=W||this.element;for(var X in L.handles){if(L.handles[X].constructor==String){L.handles[X]=A(L.handles[X],this.element).show()}if(L.transparent){L.handles[X].css({opacity:0})}if(this.element.is(".ui-wrapper")&&L._nodeName.match(/textarea|input|select|button/i)){var Y=A(L.handles[X],this.element),U=0;U=/sw|ne|nw|se|n|s/.test(X)?Y.outerHeight():Y.outerWidth();var V=["padding",/ne|nw|n/.test(X)?"Top":/se|sw|s/.test(X)?"Bottom":/^e$/.test(X)?"Right":"Left"].join("");if(!L.transparent){W.css(V,U)}this._proportionallyResize()}if(!A(L.handles[X]).length){continue}}};this._renderAxis(this.element);L._handles=A(".ui-resizable-handle",S.element);if(L.disableSelection){L._handles.each(function(U,V){A.ui.disableSelection(V)})}L._handles.mouseover(function(){if(!L.resizing){if(this.className){var U=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}S.axis=L.axis=U&&U[1]?U[1]:"se"}});if(L.autoHide){L._handles.hide();A(S.element).addClass("ui-resizable-autohide").hover(function(){A(this).removeClass("ui-resizable-autohide");L._handles.show()},function(){if(!L.resizing){A(this).addClass("ui-resizable-autohide");L._handles.hide()}})}this.mouseInit()},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}},propagate:function(B,C){A.ui.plugin.call(this,B,[C,this.ui()]);if(B!="resize"){this.element.triggerHandler(["resize",B].join(""),[C,this.ui()],this.options[B])}},destroy:function(){var B=this.element,C=B.children(".ui-resizable").get(0);this.mouseDestroy();var D=function(E){A(E).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};D(B);if(B.is(".ui-wrapper")&&C){B.parent().append(A(C).css({position:B.css("position"),width:B.outerWidth(),height:B.outerHeight(),top:B.css("top"),left:B.css("left")})).end().remove();D(C)}},mouseStart:function(J){if(this.options.disabled){return false}var K=false;for(var B in this.options.handles){if(A(this.options.handles[B])[0]==J.target){K=true}}if(!K){return false}var E=this.options,C=this.element.position(),H=this.element,L=function(O){return parseInt(O,10)||0},F=A.browser.msie&&A.browser.version<7;E.resizing=true;E.documentScroll={top:A(document).scrollTop(),left:A(document).scrollLeft()};if(H.is(".ui-draggable")||(/absolute/).test(H.css("position"))){var D=A.browser.msie&&!E.containment&&(/absolute/).test(H.css("position"))&&!(/relative/).test(H.parent().css("position"));var I=D?E.documentScroll.top:0,G=D?E.documentScroll.left:0;H.css({position:"absolute",top:(C.top+I),left:(C.left+G)})}if(A.browser.opera&&/relative/.test(H.css("position"))){H.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var M=L(this.helper.css("left")),N=L(this.helper.css("top"));if(E.containment){M+=A(E.containment).scrollLeft()||0;N+=A(E.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:M,top:N};this.size=E.helper||F?{width:H.outerWidth(),height:H.outerHeight()}:{width:H.width(),height:H.height()};this.originalSize=E.helper||F?{width:H.outerWidth(),height:H.outerHeight()}:{width:H.width(),height:H.height()};this.originalPosition={left:M,top:N};this.sizeDiff={width:H.outerWidth()-H.width(),height:H.outerHeight()-H.height()};this.originalMousePosition={left:J.pageX,top:J.pageY};E.aspectRatio=(typeof E.aspectRatio=="number")?E.aspectRatio:((this.originalSize.height/this.originalSize.width)||1);if(E.preserveCursor){A("body").css("cursor",this.axis+"-resize")}this.propagate("start",J);return true},mouseDrag:function(K){var I=this.helper,E=this.options,C={},M=this,F=this.originalMousePosition,G=this.axis;var L=(K.pageX-F.left)||0,N=(K.pageY-F.top)||0;var B=this._change[G];if(!B){return false}var H=B.apply(this,[K,L,N]),D=A.browser.msie&&A.browser.version<7,J=this.sizeDiff;if(E._aspectRatio||K.shiftKey){H=this._updateRatio(H,K)}H=this._respectSize(H,K);this.propagate("resize",K);I.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!E.helper&&E.proportionallyResize){this._proportionallyResize()}this._updateCache(H);this.element.triggerHandler("resize",[K,this.ui()],this.options["resize"]);return false},mouseStop:function(H){this.options.resizing=false;var E=this.options,K=function(M){return parseInt(M,10)||0},L=this;if(E.helper){var J=E.proportionallyResize,F=J&&(/textarea/i).test(J.get(0).nodeName),C=F&&A.ui.hasScroll(J.get(0),"left")?0:L.sizeDiff.height,I=F?0:L.sizeDiff.width;var G={width:(L.size.width-I),height:(L.size.height-C)},D=(parseInt(L.element.css("left"),10)+(L.position.left-L.originalPosition.left))||null,B=(parseInt(L.element.css("top"),10)+(L.position.top-L.originalPosition.top))||null;if(!E.animate){this.element.css(A.extend(G,{top:B,left:D}))}if(E.helper&&!E.animate){this._proportionallyResize()}}if(E.preserveCursor){A("body").css("cursor","auto")}this.propagate("stop",H);if(E.helper){this.helper.remove()}return false},_updateCache:function(C){var B=this.options;this.offset=this.helper.offset();if(C.left){this.position.left=C.left}if(C.top){this.position.top=C.top}if(C.height){this.size.height=C.height}if(C.width){this.size.width=C.width}},_updateRatio:function(G,F){var C=this.options,E=this.position,B=this.size,D=this.axis;if(G.height){G.width=(B.height/C.aspectRatio)}else{if(G.width){G.height=(B.width*C.aspectRatio)}}if(D=="sw"){G.left=E.left+(B.width-G.width);G.top=null}if(D=="nw"){G.top=E.top+(B.height-G.height);G.left=E.left+(B.width-G.width)}return G},_respectSize:function(D,G){var E=this.helper,B=this.options,L=B._aspectRatio||G.shiftKey,C=this.axis,O=D.width&&B.maxWidth&&B.maxWidth<D.width,K=D.height&&B.maxHeight&&B.maxHeight<D.height,F=D.width&&B.minWidth&&B.minWidth>D.width,J=D.height&&B.minHeight&&B.minHeight>D.height;if(F){D.width=B.minWidth}if(J){D.height=B.minHeight}if(O){D.width=B.maxWidth}if(K){D.height=B.maxHeight}var I=this.originalPosition.left+this.originalSize.width,M=this.position.top+this.size.height;var H=/sw|nw|w/.test(C),P=/nw|ne|n/.test(C);if(F&&H){D.left=I-B.minWidth}if(O&&H){D.left=I-B.maxWidth}if(J&&P){D.top=M-B.minHeight}if(K&&P){D.top=M-B.maxHeight}var N=!D.width&&!D.height;if(N&&!D.left&&D.top){D.top=null}else{if(N&&!D.top&&D.left){D.left=null}}return D},_proportionallyResize:function(){var B=this.options;if(!B.proportionallyResize){return}var E=B.proportionallyResize,C=this.helper||this.element;if(!B.borderDif){var D=[E.css("borderTopWidth"),E.css("borderRightWidth"),E.css("borderBottomWidth"),E.css("borderLeftWidth")],F=[E.css("paddingTop"),E.css("paddingRight"),E.css("paddingBottom"),E.css("paddingLeft")];B.borderDif=A.map(D,function(H,J){var I=parseInt(H,10)||0,G=parseInt(F[J],10)||0;return I+G})}E.css({height:(C.height()-B.borderDif[0]-B.borderDif[2])+"px",width:(C.width()-B.borderDif[1]-B.borderDif[3])+"px"})},_renderProxy:function(){var D=this.element,C=this.options;this.elementOffset=D.offset();if(C.helper){this.helper=this.helper||A('<div style="overflow:hidden;"></div>');var F=A.browser.msie&&A.browser.version<7,B=(F?1:0),E=(F?2:-1);this.helper.addClass(C.helper).css({width:D.outerWidth()+E,height:D.outerHeight()+E,position:"absolute",left:this.elementOffset.left-B+"px",top:this.elementOffset.top-B+"px",zIndex:++C.zIndex});this.helper.appendTo("body");if(C.disableSelection){A.ui.disableSelection(this.helper.get(0))}}else{this.helper=D}},_change:{e:function(C,D,B){return{width:this.originalSize.width+D}},w:function(F,G,E){var C=this.options,D=this.originalSize,B=this.originalPosition;return{left:B.left+G,width:D.width-G}},n:function(F,G,E){var C=this.options,D=this.originalSize,B=this.originalPosition;return{top:B.top+E,height:D.height-E}},s:function(C,D,B){return{height:this.originalSize.height+B}},se:function(C,D,B){return A.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[C,D,B]))},sw:function(C,D,B){return A.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[C,D,B]))},ne:function(C,D,B){return A.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[C,D,B]))},nw:function(C,D,B){return A.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[C,D,B]))}}}));A.extend(A.ui.resizable,{defaults:{cancel:":input",distance:1,delay:0,preventDefault:true,transparent:false,minWidth:10,minHeight:10,aspectRatio:false,disableSelection:true,preserveCursor:true,autoHide:false,knobHandles:false}});A.ui.plugin.add("resizable","containment",{start:function(H,I){var C=I.options,M=A(this).data("resizable"),F=M.element;var L=C.containment,K=(L instanceof A)?L.get(0):(/parent/.test(L))?F.parent().get(0):L;if(!K){return}M.containerElement=A(K);if(/document/.test(L)||L==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(K).offset();M.containerPosition=A(K).position();M.containerSize={height:A(K).innerHeight(),width:A(K).innerWidth()};var D=M.containerOffset,J=M.containerSize.height,E=M.containerSize.width,B=(A.ui.hasScroll(K,"left")?K.scrollWidth:E),G=(A.ui.hasScroll(K)?K.scrollHeight:J);M.parentData={element:K,left:D.left,top:D.top,width:B,height:G}}},resize:function(H,I){var E=I.options,M=A(this).data("resizable"),B=M.containerSize,F=M.containerOffset,L=M.size,J=M.position,K=E._aspectRatio||H.shiftKey,N={top:0,left:0},D=M.containerElement;if(D[0]!=document&&/static/.test(D.css("position"))){N=M.containerPosition}if(J.left<(E.helper?F.left:N.left)){M.size.width=M.size.width+(E.helper?(M.position.left-F.left):(M.position.left-N.left));if(K){M.size.height=M.size.width*E.aspectRatio}M.position.left=E.helper?F.left:N.left}if(J.top<(E.helper?F.top:0)){M.size.height=M.size.height+(E.helper?(M.position.top-F.top):M.position.top);if(K){M.size.width=M.size.height/E.aspectRatio}M.position.top=E.helper?F.top:0}var G=(E.helper?M.offset.left-F.left:(M.position.left-N.left))+M.sizeDiff.width,C=(E.helper?M.offset.top-F.top:M.position.top)+M.sizeDiff.height;if(G+M.size.width>=M.parentData.width){M.size.width=M.parentData.width-G;if(K){M.size.height=M.size.width*E.aspectRatio}}if(C+M.size.height>=M.parentData.height){M.size.height=M.parentData.height-C;if(K){M.size.width=M.size.height/E.aspectRatio}}},stop:function(G,H){var E=H.options,K=A(this).data("resizable"),I=K.position,F=K.containerOffset,J=K.containerPosition,D=K.containerElement;var C=A(K.helper),B=C.offset(),L=C.innerWidth(),M=C.innerHeight();if(E.helper&&!E.animate&&/relative/.test(D.css("position"))){A(this).css({left:(B.left-F.left),top:(B.top-F.top),width:L,height:M})}if(E.helper&&!E.animate&&/static/.test(D.css("position"))){A(this).css({left:J.left+(B.left-F.left),top:J.top+(B.top-F.top),width:L,height:M})}}});A.ui.plugin.add("resizable","grid",{resize:function(F,G){var C=G.options,L=A(this).data("resizable"),K=L.size,I=L.originalSize,E=L.originalPosition,D=L.axis,H=C._aspectRatio||F.shiftKey;C.grid=typeof C.grid=="number"?[C.grid,C.grid]:C.grid;var B=Math.round((K.width-I.width)/(C.grid[0]||1))*(C.grid[0]||1),J=Math.round((K.height-I.height)/(C.grid[1]||1))*(C.grid[1]||1);if(/^(se|s|e)$/.test(D)){L.size.width=I.width+B;L.size.height=I.height+J}else{if(/^(ne)$/.test(D)){L.size.width=I.width+B;L.size.height=I.height+J;L.position.top=E.top-J}else{if(/^(sw)$/.test(D)){L.size.width=I.width+B;L.size.height=I.height+J;L.position.left=E.left-B}else{L.size.width=I.width+B;L.size.height=I.height+J;L.position.top=E.top-J;L.position.left=E.left-B}}}}});A.ui.plugin.add("resizable","animate",{stop:function(H,I){var E=I.options,L=A(this).data("resizable");var J=E.proportionallyResize,F=J&&(/textarea/i).test(J.get(0).nodeName),C=F&&A.ui.hasScroll(J.get(0),"left")?0:L.sizeDiff.height,G=F?0:L.sizeDiff.width;var K={width:(L.size.width-G),height:(L.size.height-C)},D=(parseInt(L.element.css("left"),10)+(L.position.left-L.originalPosition.left))||null,B=(parseInt(L.element.css("top"),10)+(L.position.top-L.originalPosition.top))||null;L.element.animate(A.extend(K,B&&D?{top:B,left:D}:{}),{duration:E.animateDuration||"slow",easing:E.animateEasing||"swing",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(J){J.css({width:M.width,height:M.height})}L._updateCache(M);L.propagate("animate",H)}})}});A.ui.plugin.add("resizable","ghost",{start:function(G,D){var C=D.options,F=A(this).data("resizable"),B=C.proportionallyResize,E=F.size;if(!B){F.ghost=F.element.clone()}else{F.ghost=B.clone()}F.ghost.css({opacity:0.25,display:"block",position:"relative",height:E.height,width:E.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof C.ghost=="string"?C.ghost:"");F.ghost.appendTo(F.helper)},resize:function(F,D){var C=D.options,E=A(this).data("resizable"),B=C.proportionallyResize;if(E.ghost){E.ghost.css({position:"relative",height:E.size.height,width:E.size.width})}},stop:function(F,D){var C=D.options,E=A(this).data("resizable"),B=C.proportionallyResize;if(E.ghost&&E.helper){E.helper.get(0).removeChild(E.ghost.get(0))}}});A.ui.plugin.add("resizable","alsoResize",{start:function(E,C){var B=C.options,D=A(this).data("resizable"),F=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(B.alsoResize)=="object"){if(B.alsoResize.length){B.alsoResize=B.alsoResize[0];F(B.alsoResize)}else{A.each(B.alsoResize,function(G,H){F(G)})}}else{F(B.alsoResize)}},resize:function(F,G){var C=G.options,I=A(this).data("resizable"),H=I.originalSize,E=I.originalPosition;var B={height:(I.size.height-H.height)||0,width:(I.size.width-H.width)||0,top:(I.position.top-E.top)||0,left:(I.position.left-E.left)||0},D=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)+(B[Q]||0);if(P&&P>=0){M[Q]=P||null}});A(this).css(M)})};if(typeof(C.alsoResize)=="object"){A.each(C.alsoResize,function(J,K){D(J,K)})}else{D(C.alsoResize)}},stop:function(C,B){A(this).removeData("resizable-alsoresize-start")}})})(jQuery);(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{init:function(){var K=this,C=this.options,D=typeof C.resizable=="string"?C.resizable:"n,e,s,w,se,sw,ne,nw",I=this.element.addClass("ui-dialog-content").wrap("<div/>").wrap("<div/>"),H=(this.uiDialogContainer=I.parent().addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%",paddingTop:"10px",paddingLeft:"5px",paddingRight:"7px"})),F=C.title||I.attr("title")||"",G=(this.uiDialogTitlebar=B('<div class="ui-dialog-titlebar"/>')).append('<span class="ui-dialog-title">'+F+"</span>").append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>').prependTo(H),J=(this.uiDialog=H.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(C.dialogClass).addClass(I.attr("className")).removeClass("ui-dialog-content").css({position:"absolute",width:C.width,height:C.height,overflow:"hidden",zIndex:C.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(L){if(C.closeOnEscape){var M=27;(L.keyCode&&L.keyCode==M&&K.close())}}).mousedown(function(){K.moveToTop()}),E=(this.uiDialogButtonPane=B("<div/>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(J);this.uiDialogTitlebarClose=B(".ui-dialog-titlebar-close",G).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(L){L.stopPropagation()}).click(function(){K.close();return false});this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function(){B.ui.disableSelection(this)});if(B.fn.draggable){J.draggable({cancel:".ui-dialog-content",helper:C.dragHelper,handle:".ui-dialog-titlebar",start:function(M,L){K.moveToTop();(C.dragStart&&C.dragStart.apply(K.element[0],arguments))},drag:function(M,L){(C.drag&&C.drag.apply(K.element[0],arguments))},stop:function(M,L){(C.dragStop&&C.dragStop.apply(K.element[0],arguments));B.ui.dialog.overlay.resize()}});(C.draggable||J.draggable("disable"))}if(B.fn.resizable){J.resizable({cancel:".ui-dialog-content",helper:C.resizeHelper,maxWidth:C.maxWidth,maxHeight:C.maxHeight,minWidth:C.minWidth,minHeight:C.minHeight,start:function(){(C.resizeStart&&C.resizeStart.apply(K.element[0],arguments))},resize:function(M,L){(C.autoResize&&K.size.apply(K));(C.resize&&C.resize.apply(K.element[0],arguments))},handles:D,stop:function(M,L){(C.autoResize&&K.size.apply(K));(C.resizeStop&&C.resizeStop.apply(K.element[0],arguments));B.ui.dialog.overlay.resize()}});(C.resizable||J.resizable("disable"))}this.createButtons(C.buttons);this.isOpen=false;(C.bgiframe&&B.fn.bgiframe&&J.bgiframe());(C.autoOpen&&this.open())},setData:function(D,C){(A[D]&&this.uiDialog.data(A[D],C));switch(D){case"buttons":this.createButtons(C);break;case"draggable":this.uiDialog.draggable(C?"enable":"disable");break;case"height":this.uiDialog.height(C);break;case"position":this.position(C);break;case"resizable":(typeof C=="string"&&this.uiDialog.data("handles.resizable",C));this.uiDialog.resizable(C?"enable":"disable");break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).text(C);break;case"width":this.uiDialog.width(C);break}B.widget.prototype.setData.apply(this,arguments)},position:function(F){var D=B(window),C=B(document),E=C.scrollTop(),G=C.scrollLeft(),H=E;if(B.inArray(F,["center","top","right","bottom","left"])>=0){F=[F=="right"||F=="left"?F:"center",F=="top"||F=="bottom"?F:"middle"]}if(F.constructor!=Array){F=["center","middle"]}if(F[0].constructor==Number){G+=F[0]}else{switch(F[0]){case"left":G+=0;break;case"right":G+=D.width()-this.uiDialog.width();break;default:case"center":G+=(D.width()-this.uiDialog.width())/2}}if(F[1].constructor==Number){E+=F[1]}else{switch(F[1]){case"top":E+=0;break;case"bottom":E+=D.height()-this.uiDialog.height();break;default:case"middle":E+=(D.height()-this.uiDialog.height())/2}}E=Math.max(E,H);this.uiDialog.css({top:E,left:G})},size:function(){var C=this.uiDialogContainer,D=this.uiDialogTitlebar,G=this.element,E=parseInt(G.css("margin-top"),10)+parseInt(G.css("margin-bottom"),10),F=parseInt(G.css("margin-left"),10)+parseInt(G.css("margin-right"),10);G.height(C.height()-D.outerHeight()-E);G.width(C.width()-F)},open:function(){if(this.isOpen){return}this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length>0)&&this.uiDialog.appendTo("body");this.position(this.options.position);this.uiDialog.show(this.options.show);this.options.autoResize&&this.size();this.moveToTop(true);var C=null;var D={options:this.options};this.uiDialogTitlebarClose.focus();this.element.triggerHandler("dialogopen",[C,D],this.options.open);this.isOpen=true},moveToTop:function(D){if((this.options.modal&&!D)||(!this.options.stack&&!this.options.modal)){return this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)}var C=this.options.zIndex,E=this.options;B(".ui-dialog:visible").each(function(){C=Math.max(C,parseInt(B(this).css("z-index"),10)||E.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++C));this.uiDialog.css("z-index",++C);this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)},close:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide);var C=null;var D={options:this.options};this.element.triggerHandler("dialogclose",[C,D],this.options.close);B.ui.dialog.overlay.resize();this.isOpen=false},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove()},createButtons:function(D){var E=this,F=false,C=this.uiDialogButtonPane;C.empty().hide();B.each(D,function(){return !(F=true)});if(F){C.show();B.each(D,function(H,G){B("<button/>").text(H).click(function(){G.apply(E.element[0],arguments)}).appendTo(C)})}}});B.extend(B.ui.dialog,{defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var G=false;var E=B(this).parents(".ui-dialog");if(E.length){var F=B(".ui-dialog-overlay");if(F.length){var H=parseInt(F.css("z-index"),10);F.each(function(){H=Math.max(H,parseInt(B(this).css("z-index"),10))});G=parseInt(E.css("z-index"),10)>H}else{G=true}}return G})},1);B(document).bind("keydown.dialog-overlay",function(E){var F=27;(E.keyCode&&E.keyCode==F&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div/>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var D=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(C<D){return B(window).height()+"px"}else{return C+"px"}}else{return B(document).height()+"px"}},width:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var C=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(D<C){return B(window).width()+"px"}else{return D+"px"}}else{return B(document).width()+"px"}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);