(function(b){b.ui={plugin:{add:function(g,f,d){var e=b.ui[g].prototype;for(var h in d){e.plugins[h]=e.plugins[h]||[];e.plugins[h].push([f,d[h]])}},call:function(h,f,g){var d=h.plugins[f];if(!d){return}for(var e=0;e<d.length;e++){if(h.options[d[e][0]]){d[e][1].apply(h.element,g)}}}},cssCache:{},css:function(f){if(b.ui.cssCache[f]){return b.ui.cssCache[f]}var e=b('<div class="ui-gen">').addClass(f).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");b.ui.cssCache[f]=!!((!(/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(d){}return b.ui.cssCache[f]},disableSelection:function(d){b(d).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(d){b(d).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(d,f){var g=/top/.test(f||"top")?"scrollTop":"scrollLeft",e=false;if(d[g]>0){return true}d[g]=1;e=d[g]>0?true:false;d[g]=0;return e}};var c=b.fn.remove;b.fn.remove=function(){b("*",this).add(this).triggerHandler("remove");return c.apply(this,arguments)};function a(f,e,d){var g=b[f][e].getter||[];g=(typeof g=="string"?g.split(/,?\s+/):g);return(b.inArray(d,g)!=-1)}b.widget=function(e,f){var d=e.split(".")[0];e=e.split(".")[1];b.fn[e]=function(g){var i=(typeof g=="string"),h=Array.prototype.slice.call(arguments,1);if(i&&a(d,e,g)){var j=b.data(this[0],e);return(j?j[g].apply(j,h):undefined)}return this.each(function(){var k=b.data(this,e);if(i&&k&&b.isFunction(k[g])){k[g].apply(k,h)}else{if(!i){b.data(this,e,new b[d][e](this,g))}}})};b[d][e]=function(g,h){var i=this;this.widgetName=e;this.widgetBaseClass=d+"-"+e;this.options=b.extend({},b.widget.defaults,b[d][e].defaults,h);this.element=b(g).bind("setData."+e,function(j,l,k){return i.setData(l,k)}).bind("getData."+e,function(j,k){return i.getData(k)}).bind("remove",function(){return i.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(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var f=this,d=(e.which==1),g=(typeof this.options.cancel=="string"?b(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!d||g||!this.mouseCapture(e)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){f._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true}}this._mouseMoveDelegate=function(h){return f.mouseMove(h)};this._mouseUpDelegate=function(h){return f.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);