(function(b){function j(a){function c(a){a=a.style;return a.display!="none"&&a.visibility!="hidden"}var d=c(a);d&&b.each(b.dir(a,"parentNode"),function(){return d=c(this)});return d}function k(a,c,d,e){function g(d){d=b[a][c][d]||[];return typeof d=="string"?d.split(/,?\s+/):d}var f=g("getter");e.length==1&&typeof e[0]=="string"&&(f=f.concat(g("getterSetter")));return b.inArray(d,f)!=-1}var l=b.fn.remove;b.fn.remove=function(){b("*",this).add(this).triggerHandler("remove");return l.apply(this,arguments)};
b.extend(b.expr[":"],{data:function(a,c,d){return b.data(a,d[3])},tabbable:function(a){var b=a.nodeName.toLowerCase();return a.tabIndex>=0&&("a"==b&&a.href||/input|select|textarea|button/.test(b)&&"hidden"!=a.type&&!a.disabled)&&j(a)}});b.keyCode={BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,
RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38};b.widget=function(a,c){var d=a.split(".")[0],a=a.split(".")[1];b.fn[a]=function(c){var g=typeof c=="string",f=Array.prototype.slice.call(arguments,1);if(g&&c.substring(0,1)=="_")return this;if(g&&k(d,a,c,f)){var i=b.data(this[0],a);return i?i[c].apply(i,f):void 0}return this.each(function(){var h=b.data(this,a);!h&&!g&&b.data(this,a,new b[d][a](this,c));h&&g&&b.isFunction(h[c])&&h[c].apply(h,f)})};b[d][a]=function(c,g){var f=this;this.widgetName=a;this.widgetEventPrefix=
b[d][a].eventPrefix||a;this.widgetBaseClass=d+"-"+a;this.options=b.extend({},b.widget.defaults,b[d][a].defaults,b.metadata&&b.metadata.get(c)[a],g);this.element=b(c).bind("setData."+a,function(a,b,c){return f._setData(b,c)}).bind("getData."+a,function(a,b){return f._getData(b)}).bind("remove",function(){return f.destroy()});this._init()};b[d][a].prototype=b.extend({},b.widget.prototype,c);b[d][a].getterSetter="option"};b.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},
option:function(a,c){var d=a,e=this;if(typeof a=="string"){if(c===void 0)return this._getData(a);d={};d[a]=c}b.each(d,function(a,b){e._setData(a,b)})},_getData:function(a){return this.options[a]},_setData:function(a,b){this.options[a]=b;if(a=="disabled")this.element[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")},enable:function(){this._setData("disabled",!1)},disable:function(){this._setData("disabled",!0)},_trigger:function(a,c,d){var e=a==this.widgetEventPrefix?a:this.widgetEventPrefix+
a,c=c||b.event.fix({type:e,target:this.element[0]});return this.element.triggerHandler(e,[c,d],this.options[a])}};b.widget.defaults={disabled:!1};b.ui={plugin:{add:function(a,c,d){var a=b.ui[a].prototype,e;for(e in d)a.plugins[e]=a.plugins[e]||[],a.plugins[e].push([c,d[e]])},call:function(a,b,d){if(b=a.plugins[b])for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},cssCache:{},css:function(a){if(b.ui.cssCache[a])return b.ui.cssCache[a];var c=b('<div class="ui-gen">').addClass(a).css({position:"absolute",
top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");b.ui.cssCache[a]=!(/auto|default/.test(c.css("cursor"))&&!/^[1-9]/.test(c.css("height"))&&!/^[1-9]/.test(c.css("width"))&&/none/.test(c.css("backgroundImage"))&&/transparent|rgba\(0, 0, 0, 0\)/.test(c.css("backgroundColor")));try{b("body").get(0).removeChild(c.get(0))}catch(d){}return b.ui.cssCache[a]},disableSelection:function(a){return b(a).attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})},
enableSelection:function(a){return b(a).attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},hasScroll:function(a,c){if(b(a).css("overflow")=="hidden")return!1;var d=c&&c=="left"?"scrollLeft":"scrollTop",e=!1;if(a[d]>0)return!0;a[d]=1;e=a[d]>0;a[d]=0;return e}};b.ui.mouse={_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)});if(b.browser.msie)this._mouseUnselectable=this.element.attr("unselectable"),this.element.attr("unselectable",
"on");this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);b.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable)},_mouseDown:function(a){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,d=a.which==1,e=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:!1;if(!d||e||!this._mouseCapture(a))return!0;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=
setTimeout(function(){c.mouseDelayMet=!0},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=this._mouseStart(a)!==!1,!this._mouseStarted))return a.preventDefault(),!0;this._mouseMoveDelegate=function(a){return c._mouseMove(a)};this._mouseUpDelegate=function(a){return c._mouseUp(a)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return!1},_mouseMove:function(a){if(b.browser.msie&&
!a.button)return this._mouseUp(a);if(this._mouseStarted)return this._mouseDrag(a),!1;if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==!1)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted)this._mouseStarted=!1,this._mouseStop(a);return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-
a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}};b.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);

