/*
 * 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 b=a.fn.remove;a.fn.remove=function(c,d){return this.each(function(){if(!d)(!c||a.filter(c,[this]).length)&&a("*",this).add(this).each(function(){a(this).triggerHandler("remove")});return b.call(a(this),c,d)})};a.widget=function(b,g,e){var c=b.split(".")[0],f;b=b.split(".")[1];f=c+"-"+b;if(!e){e=g;g=a.Widget}a.expr[":"][f]=function(c){return!!a.data(c,b)};a[c]=a[c]||{};a[c][b]=function(b,a){arguments.length&&this._createWidget(b,a)};var d=new g;d.options=a.extend({},d.options);a[c][b].prototype=a.extend(true,d,{"namespace":c,widgetName:b,widgetEventPrefix:a[c][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},e);a.widget.bridge(b,a[c][b])};a.widget.bridge=function(b,c){a.fn[b]=function(d){var e=typeof d==="string",g=Array.prototype.slice.call(arguments,1),f=this;d=!e&&g.length?a.extend.apply(null,[true,d].concat(g)):d;if(e&&d.substring(0,1)==="_")return f;if(e)this.each(function(){var c=a.data(this,b),e=c&&a.isFunction(c[d])?c[d].apply(c,g):c;if(e!==c&&e!==undefined){f=e;return false}});else this.each(function(){var e=a.data(this,b);if(e){d&&e.option(d);e._init()}else a.data(this,b,new c(d,this))});return f}};a.Widget=function(b,a){arguments.length&&this._createWidget(b,a)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(c,b){this.element=a(b).data(this.widgetName,this);this.options=a.extend(true,{},this.options,a.metadata&&a.metadata.get(b)[this.widgetName],c);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},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(b,a){this.options[b]=a;b==="disabled"&&this.widget()[a?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",a);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(d,b,c){var f=this.options[d];b=a.Event(b);b.type=(d===this.widgetEventPrefix?d:this.widgetEventPrefix+d).toLowerCase();c=c||{};if(b.originalEvent)for(var g=a.event.props.length,e;g;){e=a.event.props[--g];b[e]=b.originalEvent[e]}this.element.trigger(b,c);return!(a.isFunction(f)&&f.call(this.element[0],b,c)===false||b.isDefaultPrevented())}}})(jQuery);
