/*!
 * jQuery UI Widget 1.9m4
 *
 * 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,l){var m=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(g){return!!a.data(g,b)};a[e]=a[e]||{};a[e][b]=a.extend(function(g,h){if(!this._createWidget)return new a[e][b](g,h);arguments.length&&this._createWidget(g,h)},a[e][b]);var i=new c;i.options=a.extend(true,{},i.options);a.each(d,function(g,
h){if(a.isFunction(h))d[g]=function(){var p=function(j){return c.prototype[j].apply(this,m.call(arguments,1))},q=function(j,k){return c.prototype[j].apply(this,k)};return function(){var j=this._super,k=this._superApply,n;this._super=p;this._superApply=q;n=h.apply(this,arguments);this._super=j;this._superApply=k;return n}}()});a[e][b].prototype=a.extend(true,i,{namespace:e,widgetName:b,widgetEventPrefix:b,widgetBaseClass:f},d);a.widget.bridge(b,a[e][b])};a.widget.bridge=function(b,c){a.fn[b]=function(d){var e=
typeof d==="string",f=m.call(arguments,1),i=this;d=!e&&f.length?a.extend.apply(null,[true,d].concat(f)):d;e?this.each(function(){var g=a.data(this,b);if(!g)return a.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+d+"'");if(!a.isFunction(g[d])||d.charAt(0)==="_")return a.error("no such method '"+d+"' for "+b+" widget instance");var h=g[d].apply(g,f);if(h!==g&&h!==l){i=h;return false}}):this.each(function(){var g=a.data(this,b);g?g.option(d||{})._init():c(d,
this)});return i}};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},_createWidget:function(b,c){c=a(c||this.defaultElement||this)[0];this.element=a(c);this.options=a.extend(true,{},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:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_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;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(c===l)return this.options[b];d={};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)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())}}})(jQuery);

