/*!
 * jQuery UI Widget 1.8.2
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(a){var d="disabled",f="ui-state-disabled",e="aria-disabled",c=false,b=true,g=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){var d=this;if(!c)(!b||a.filter(b,[d]).length)&&a("*",d).add(d).each(function(){a(this).triggerHandler("remove")});return g.call(a(d),b,c)})};a.widget=function(c,h,f){var d=c.split(".")[0],g;c=c.split(".")[1];g=d+"-"+c;if(!f){f=h;h=a.Widget}a.expr[":"][g]=function(b){return!!a.data(b,c)};a[d]=a[d]||{};a[d][c]=function(b,a){arguments.length&&this._createWidget(b,a)};var e=new h;e.options=a.extend({},e.options);a[d][c].prototype=a.extend(b,e,{"namespace":d,widgetName:c,widgetEventPrefix:a[d][c].prototype.widgetEventPrefix||c,widgetBaseClass:g},f);a.widget.bridge(c,a[d][c])};a.widget.bridge=function(d,e){a.fn[d]=function(f){var g=typeof f==="string",i=Array.prototype.slice.call(arguments,1),h=this;f=!g&&i.length?a.extend.apply(null,[b,f].concat(i)):f;if(g&&f.substring(0,1)==="_")return h;if(g)this.each(function(){var b=a.data(this,d),e=b&&a.isFunction(b[f])?b[f].apply(b,i):b;if(e!==b&&e!==undefined){h=e;return c}});else this.each(function(){var b=a.data(this,d);if(b){f&&b.option(f);b._init()}else a.data(this,d,new e(f,this))});return h}};a.Widget=function(b,a){arguments.length&&this._createWidget(b,a)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:c},_createWidget:function(e,d){var c=this;c.element=a(d).data(c.widgetName,c);c.options=a.extend(b,{},c.options,a.metadata&&a.metadata.get(d)[c.widgetName],e);var f=c;c.element.bind("remove."+c.widgetName,function(){f.destroy()});c._create();c._init()},_create:function(){},_init:function(){},destroy:function(){var a=this;a.element.unbind("."+a.widgetName).removeData(a.widgetName);a.widget().unbind("."+a.widgetName).removeAttr(e).removeClass(a.widgetBaseClass+"-disabled "+f)},widget:function(){return this.element},option:function(b,e){var c=b,d=this;if(arguments.length===0)return a.extend({},d.options);if(typeof b==="string"){if(e===undefined)return this.options[b];c={};c[b]=e}a.each(c,function(b,a){d._setOption(b,a)});return d},_setOption:function(c,b){var a=this;a.options[c]=b;c===d&&a.widget()[b?"addClass":"removeClass"](a.widgetBaseClass+"-disabled "+f).attr(e,b);return a},enable:function(){return this._setOption(d,c)},disable:function(){return this._setOption(d,b)},_trigger:function(f,b,e){var d=this,h=d.options[f];b=a.Event(b);b.type=(f===d.widgetEventPrefix?f:d.widgetEventPrefix+f).toLowerCase();e=e||{};if(b.originalEvent)for(var i=a.event.props.length,g;i;){g=a.event.props[--i];b[g]=b.originalEvent[g]}d.element.trigger(b,e);return!(a.isFunction(h)&&h.call(d.element[0],b,e)===c||b.isDefaultPrevented())}}})(jQuery);
