(function(A){A.widget("ui.draggable",{init:function(){var B=this.options;this.element.mouse({executor:this,delay:B.delay,distance:B.distance,dragPrevention:B.cancel,start:this.start,stop:this.stop,drag:this.drag,condition:function(D){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;if(!C){A(this.options.handle,this.element).each(function(){if(this==D.target){C=true}})}return !(D.target.className.indexOf("ui-resizable-handle")!=-1||this.options.disabled)&&C}});if(B.helper=="original"&&!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}},start:function(E){var G=this.options;if(A.ui.ddmanager){A.ui.ddmanager.current=this}this.helper=A.isFunction(G.helper)?A(G.helper.apply(this.element[0],[E])):(G.helper=="clone"?this.element.clone():this.element);if(!this.helper.parents("body").length){this.helper.appendTo((G.appendTo=="parent"?this.element[0].parentNode:G.appendTo))}if(!this.helper.css("position")||this.helper.css("position")=="static"){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:E.pageX-this.offset.left,top:E.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();this.offset.parent={top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var D=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:D.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:D.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(E);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(G.cursorAt){if(G.cursorAt.left!=undefined){this.offset.click.left=G.cursorAt.left}if(G.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-G.cursorAt.right}if(G.cursorAt.top!=undefined){this.offset.click.top=G.cursorAt.top}if(G.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-G.cursorAt.bottom}}if(G.containment){if(G.containment=="parent"){G.containment=this.helper[0].parentNode}if(G.containment=="document"){this.containment=[0,0,A(document).width(),(A(document).height()||document.body.parentNode.scrollHeight)]}if(!(/^(document|window|parent)$/).test(G.containment)){var C=A(G.containment)[0];var F=A(G.containment).offset();this.containment=[F.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,F.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,F.left+Math.max(C.scrollWidth,C.offsetWidth)-(parseInt(A(C).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),F.top+Math.max(C.scrollHeight,C.offsetHeight)-(parseInt(A(C).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",E);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(A.ui.ddmanager&&!G.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,E)}return false},convertPositionTo:function(C,D){if(!D){D=this.position}var B=C=="absolute"?1:-1;return{top:(D.top+this.offset.relative.top*B+this.offset.parent.top*B-(this.cssPosition=="fixed"?0:this.offsetParent[0].scrollTop)*B+this.margins.top*B),left:(D.left+this.offset.relative.left*B+this.offset.parent.left*B-(this.cssPosition=="fixed"?0:this.offsetParent[0].scrollLeft)*B+this.margins.left*B)}},generatePosition:function(E){var F=this.options;var B={top:(E.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?0:this.offsetParent[0].scrollTop)),left:(E.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?0:this.offsetParent[0].scrollLeft))};if(!this.originalPosition){return B}if(this.containment){if(B.leftthis.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(F.grid){var D=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/F.grid[1])*F.grid[1];B.top=this.containment?(!(Dthis.containment[3])?D:(!(Dthis.containment[2])?C:(!(C').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(D,C){var E=C.options;var B=A(this).data("draggable");E.scrollSensitivity=E.scrollSensitivity||20;E.scrollSpeed=E.scrollSpeed||20;B.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);B.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(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){B.overflowYOffset=B.overflowY.offset()}if(B.overflowX[0]!=document&&B.overflowX[0].tagName!="HTML"){B.overflowXOffset=B.overflowX.offset()}},drag:function(D,C){var E=C.options;var B=A(this).data("draggable");if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){if((B.overflowYOffset.top+B.overflowY[0].offsetHeight)-D.pageY=0;H--){var E=I.snapElements[H].left,B=E+I.snapElements[H].width,R=I.snapElements[H].top,M=R+I.snapElements[H].height;if(!((E-L