;(function(c){var l=c.fn.remove;c.fn.remove=function(){c("*",this).add(this).triggerHandler("remove");return l.apply(this,arguments)};function m(d){function f(a){var b=a.style;return(b.display!='none'&&b.visibility!='hidden')}var g=f(d);(g&&c.each(c.dir(d,'parentNode'),function(){return(g=f(this))}));return g}c.extend(c.expr[':'],{data:function(a,b,d){return c.data(a,d[3])},tabbable:function(a,b,d){var f=a.nodeName.toLowerCase();return(a.tabIndex>=0&&(('a'==f&&a.href)||(/input|select|textarea|button/.test(f)&&'hidden'!=a.type&&!a.disabled))&&m(a))}});c.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};function n(d,f,g,i){function h(a){var b=c[d][f][a]||[];return(typeof b=='string'?b.split(/,?\s+/):b)}var k=h('getter');if(i.length==1&&typeof i[0]=='string'){k=k.concat(h('getterSetter'))}return(c.inArray(g,k)!=-1)}c.widget=function(h,k){var j=h.split(".")[0];h=h.split(".")[1];c.fn[h]=function(b){var d=(typeof b=='string'),f=Array.prototype.slice.call(arguments,1);if(d&&b.substring(0,1)=='_'){return this}if(d&&n(j,h,b,f)){var g=c.data(this[0],h);return(g?g[b].apply(g,f):undefined)}return this.each(function(){var a=c.data(this,h);(!a&&!d&&c.data(this,h,new c[j][h](this,b)));(a&&d&&c.isFunction(a[b])&&a[b].apply(a,f))})};c[j][h]=function(f,g){var i=this;this.widgetName=h;this.widgetEventPrefix=c[j][h].eventPrefix||h;this.widgetBaseClass=j+'-'+h;this.options=c.extend({},c.widget.defaults,c[j][h].defaults,c.metadata&&c.metadata.get(f)[h],g);this.element=c(f).bind('setData.'+h,function(a,b,d){return i._setData(b,d)}).bind('getData.'+h,function(a,b){return i._getData(b)}).bind('remove',function(){return i.destroy()});this._init()};c[j][h].prototype=c.extend({},c.widget.prototype,k);c[j][h].getterSetter='option'};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(d,f){var g=d,i=this;if(typeof d=="string"){if(f===undefined){return this._getData(d)}g={};g[d]=f}c.each(g,function(a,b){i._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',false)},disable:function(){this._setData('disabled',true)},_trigger:function(a,b,d){var f=(a==this.widgetEventPrefix?a:this.widgetEventPrefix+a);b=b||c.event.fix({type:f,target:this.element[0]});return this.element.triggerHandler(f,[b,d],this.options[a])}};c.widget.defaults={disabled:false};c.ui={plugin:{add:function(a,b,d){var f=c.ui[a].prototype;for(var g in d){f.plugins[g]=f.plugins[g]||[];f.plugins[g].push([b,d[g]])}},call:function(a,b,d){var f=a.plugins[b];if(!f){return}for(var g=0;g<f.length;g++){if(a.options[f[g][0]]){f[g][1].apply(a.element,d)}}}},cssCache:{},css:function(a){if(c.ui.cssCache[a]){return c.ui.cssCache[a]}var b=c('<div class="ui-gen">').addClass(a).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');c.ui.cssCache[a]=!!((!(/auto|default/).test(b.css('cursor'))||(/^[1-9]/).test(b.css('height'))||(/^[1-9]/).test(b.css('width'))||!(/none/).test(b.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(b.css('backgroundColor'))));try{c('body').get(0).removeChild(b.get(0))}catch(e){}return c.ui.cssCache[a]},disableSelection:function(a){c(a).attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false})},enableSelection:function(a){c(a).attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui')},hasScroll:function(a,b){var d=(b&&b=='left')?'scrollLeft':'scrollTop',f=false;if(a[d]>0){return true}a[d]=1;f=(a[d]>0);a[d]=0;return f}};c.ui.mouse={_mouseInit:function(){var b=this;this.element.bind('mousedown.'+this.widgetName,function(a){return b._mouseDown(a)});if(c.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on')}this.started=false},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);(c.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable))},_mouseDown:function(b){(this._mouseStarted&&this._mouseUp(b));this._mouseDownEvent=b;var d=this,f=(b.which==1),g=(typeof this.options.cancel=="string"?c(b.target).parents().add(b.target).filter(this.options.cancel).length:false);if(!f||g||!this._mouseCapture(b)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=(this._mouseStart(b)!==false);if(!this._mouseStarted){b.preventDefault();return true}}this._mouseMoveDelegate=function(a){return d._mouseMove(a)};this._mouseUpDelegate=function(a){return d._mouseUp(a)};c(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false},_mouseMove:function(a){if(c.browser.msie&&!a.button){return this._mouseUp(a)}if(this._mouseStarted){this._mouseDrag(a);return false}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,a)!==false);(this._mouseStarted?this._mouseDrag(a):this._mouseUp(a))}return!this._mouseStarted},_mouseUp:function(a){c(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._mouseStop(a)}return false},_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(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
