/*!
 * jQuery UI Widget 1.9m5
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(a,k){var l=Array.prototype.slice,o=a.cleanData;a.cleanData=function(b){for(var c=0,d;(d=b[c])!=null;c++)a(d).triggerHandler("remove");o(b)};a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1];f=e+"-"+b;if(!d){d=c;c=a.Widget}a.expr[":"][f]=function(h){return!!a.data(h,b)};a[e]=a[e]||{};a[e][b]=a.extend(function(h,i){if(!this._createWidget)return new a[e][b](h,i);arguments.length&&this._createWidget(h,i)},a[e][b]);var g=new c;g.options=a.widget.extend({},g.options);a.each(d,
function(h,i){if(a.isFunction(i))d[h]=function(){var p=function(j){return c.prototype[j].apply(this,l.call(arguments,1))},q=function(j,m){return c.prototype[j].apply(this,m)};return function(){var j=this._super,m=this._superApply,n;this._super=p;this._superApply=q;n=i.apply(this,arguments);this._super=j;this._superApply=m;return n}}()});a[e][b].prototype=a.widget.extend(g,{namespace:e,widgetName:b,widgetEventPrefix:b,widgetBaseClass:f},d);a.widget.bridge(b,a[e][b])};a.widget.extend=function(b){for(var c=
l.call(arguments,1),d=0,e=c.length,f,g;d<e;d++)for(f in c[d]){g=c[d][f];if(c[d].hasOwnProperty(f)&&g!==k)b[f]=a.isPlainObject(g)?a.widget.extend({},b[f],g):g}return b};a.widget.bridge=function(b,c){a.fn[b]=function(d){var e=typeof d==="string",f=l.call(arguments,1),g=this;d=!e&&f.length?a.widget.extend.apply(null,[d].concat(f)):d;e?this.each(function(){var h=a.data(this,b);if(!h)return a.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+d+"'");if(!a.isFunction(h[d])||
d.charAt(0)==="_")return a.error("no such method '"+d+"' for "+b+" widget instance");var i=h[d].apply(h,f);if(i!==h&&i!==k){g=i.jquery?g.pushStack(i.get()):i;return false}}):this.each(function(){var h=a.data(this,b);h?h.option(d||{})._init():c(d,this)});return g}};a.Widget=function(b,c){if(!this._createWidget)return new a[namespace][name](b,c);arguments.length&&this._createWidget(b,c)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,create:null},
_createWidget:function(b,c){c=a(c||this.defaultElement||this)[0];this.element=a(c);this.options=a.widget.extend({},this.options,this._getCreateOptions(),b);this.bindings=a();this.hoverable=a();this.focusable=a();if(c!==this){a.data(c,this.widgetName,this);this._bind({remove:"destroy"})}this._create();this._trigger("create");this._init()},_getCreateOptions:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy();this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+
this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled");this.bindings.unbind("."+this.widgetName);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(b,c){var d=b,e,f,g;if(arguments.length===0)return a.widget.extend({},this.options);if(typeof b==="string"){if(c===k)return this.options[b];d={};e=b.split(".");b=e.shift();if(e.length){f=d[b]=
a.widget.extend({},this.options[b]);for(g=0;g<e.length-1;g++){f[e[g]]=f[e[g]]||{};f=f[e[g]]}f[e.pop()]=c}else d[b]=c}this._setOptions(d);return this},_setOptions:function(b){var c=this;a.each(b,function(d,e){c._setOption(d,e)});return this},_setOption:function(b,c){this.options[b]=c;if(b==="disabled"){this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled",!!c).attr("aria-disabled",c);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_bind:function(b,c){if(c){b=a(b);this.bindings=this.bindings.add(b)}else{c=b;b=this.element}var d=this;a.each(c,function(e,f){b.bind(e+"."+d.widgetName,function(){if(!(d.options.disabled===true||a(this).hasClass("ui-state-disabled")))return(typeof f==="string"?d[f]:f).apply(d,arguments)})})},_hoverable:function(b){this.hoverable=this.hoverable.add(b);this._bind(b,{mouseenter:function(c){a(c.currentTarget).addClass("ui-state-hover")},
mouseleave:function(c){a(c.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b);this._bind(b,{focusin:function(c){a(c.currentTarget).addClass("ui-state-focus")},focusout:function(c){a(c.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(b,c,d){var e=this.options[b];c=a.Event(c);c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();d=d||{};if(c.originalEvent){b=a.event.props.length;for(var f;b;){f=a.event.props[--b];
c[f]=c.originalEvent[f]}}this.element.trigger(c,d);d=a.isArray(d)?[c].concat(d):[c,d];return!(a.isFunction(e)&&e.apply(this.element[0],d)===false||c.isDefaultPrevented())}};a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){e=e||{};var g=!a.isEmptyObject(e),h=e.effect||c;e.complete=f;e.delay&&d.delay(e.delay);if(g&&a.effects&&(a.effects.effect[h]||a.uiBackCompat!==false&&a.effects[h]))d[b](e);else if(h!==b&&d[h])d[h](e.duration,e.easing,f);else d.queue(function(){a(this)[b]();
f&&f.call(d[0])})}});if(a.uiBackCompat!==false)a.Widget.prototype._getCreateOptions=function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]}})(jQuery);

