(function(_){_.ui=_.ui||{};_.extend(_.ui,{plugin:{add:function(D,C,B){var A=_.ui[D].prototype;for(var $ in B){A.plugins[$]=A.plugins[$]||[];A.plugins[$].push([C,B[$]])}},call:function(A,C,$){var B=A.plugins[C];if(!B)return;for(var _=0;_<B.length;_++)if(A.options[B[_][0]])B[_][1].apply(A.element,$)}},cssCache:{},css:function(A){if(_.ui.cssCache[A])return _.ui.cssCache[A];var $=_("<div class=\"ui-resizable-gen\">").addClass(A).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");_.ui.cssCache[A]=!!((!/auto|default/.test($.css("cursor"))||(/^[1-9]/).test($.css("height"))||(/^[1-9]/).test($.css("width"))||!(/none/).test($.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test($.css("backgroundColor"))));try{_("body").get(0).removeChild($.get(0))}catch(B){}return _.ui.cssCache[A]},disableSelection:function($){$.unselectable="on";$.onselectstart=function(){return false};if($.style)$.style.MozUserSelect="none"},enableSelection:function($){$.unselectable="off";$.onselectstart=function(){return true};if($.style)$.style.MozUserSelect=""},hasScroll:function(B,_){var A=/top/.test(_||"top")?"scrollTop":"scrollLeft",$=false;if(B[A]>0)return true;B[A]=1;$=B[A]>0?true:false;B[A]=0;return $}});_.each(["Left","Top"],function($,A){if(!_.fn["scroll"+A])_.fn["scroll"+A]=function($){return $!=undefined?this.each(function(){this==window||this==document?window.scrollTo(A=="Left"?$:_(window)["scrollLeft"](),A=="Top"?$:_(window)["scrollTop"]()):this["scroll"+A]=$}):this[0]==window||this[0]==document?self[(A=="Left"?"pageXOffset":"pageYOffset")]||_.boxModel&&document.documentElement["scroll"+A]||document.body["scroll"+A]:this[0]["scroll"+A]}});var A=_.fn.remove;_.fn.extend({position:function(){var B=this.offset(),_=this.offsetParent(),A=_.offset();return{top:B.top-$(this[0],"marginTop")-A.top-$(_,"borderTopWidth"),left:B.left-$(this[0],"marginLeft")-A.left-$(_,"borderLeftWidth")}},offsetParent:function(){var $=this[0].offsetParent;while($&&(!/^body|html$/i.test($.tagName)&&_.css($,"position")=="static"))$=$.offsetParent;return _($)},mouseInteraction:function($){return this.each(function(){new _.ui.mouseInteraction(this,$)})},removeMouseInteraction:function($){return this.each(function(){if(_.data(this,"ui-mouse"))_.data(this,"ui-mouse").destroy()})},remove:function(){jQuery("*",this).add(this).trigger("remove");return A.apply(this,arguments)}});function $($,A){return parseInt(_.curCSS($.jquery?$[0]:$,A,true))||0}_.ui.mouseInteraction=function($,B){var A=this;this.element=$;_.data(this.element,"ui-mouse",this);this.options=_.extend({},B);_($).bind("mousedown.draggable",function(){return A.click.apply(A,arguments)});if(_.browser.msie)_($).attr("unselectable","on");_($).mouseup(function(){if(A.timer)clearInterval(A.timer)})};_.extend(_.ui.mouseInteraction.prototype,{destroy:function(){_(this.element).unbind("mousedown.draggable")},trigger:function(){return this.click.apply(this,arguments)},click:function(B){if(B.which!=1||_.inArray(B.target.nodeName.toLowerCase(),this.options.dragPrevention||[])!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[B,this.element])))return true;var A=this,$=function(){A._MP={left:B.pageX,top:B.pageY};_(document).bind("mouseup.draggable",function(){return A.stop.apply(A,arguments)});_(document).bind("mousemove.draggable",function(){return A.drag.apply(A,arguments)});if(!A.initalized&&Math.abs(A._MP.left-B.pageX)>=A.options.distance||Math.abs(A._MP.top-B.pageY)>=A.options.distance){if(A.options.start)A.options.start.call(A.options.executor||A,B,A.element);if(A.options.drag)A.options.drag.call(A.options.executor||A,B,this.element);A.initialized=true}};if(this.options.delay){if(this.timer)clearInterval(this.timer);this.timer=setTimeout($,this.options.delay)}else $();return false},stop:function(A){var $=this.options;if(!this.initialized)return _(document).unbind("mouseup.draggable").unbind("mousemove.draggable");if(this.options.stop)this.options.stop.call(this.options.executor||this,A,this.element);_(document).unbind("mouseup.draggable").unbind("mousemove.draggable");this.initialized=false;return false},drag:function(A){var $=this.options;if(_.browser.msie&&!A.button)return this.stop.apply(this,[A]);if(!this.initialized&&(Math.abs(this._MP.left-A.pageX)>=$.distance||Math.abs(this._MP.top-A.pageY)>=$.distance)){if(this.options.start)this.options.start.call(this.options.executor||this,A,this.element);this.initialized=true}else if(!this.initialized)return false;if($.drag)$.drag.call(this.options.executor||this,A,this.element);return false}})})(jQuery)