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