/*
 * 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(C,D){return this.each(function(){if(!D){if(!C||B.filter(C,[this]).length){B("*",this).add(this).each(function(){B(this).triggerHandler("remove")})}}return A.call(B(this),C,D)})};B.widget=function(D,F,C){var E=D.split(".")[0],H;D=D.split(".")[1];H=E+"-"+D;if(!C){C=F;F=B.Widget}B.expr[":"][H]=function(I){return !!B.data(I,D)};B[E]=B[E]||{};B[E][D]=function(I,J){if(arguments.length){this._createWidget(I,J)}};var G=new F();G.options=B.extend({},G.options);B[E][D].prototype=B.extend(true,G,{namespace:E,widgetName:D,widgetEventPrefix:B[E][D].prototype.widgetEventPrefix||D,widgetBaseClass:H},C);B.widget.bridge(D,B[E][D])};B.widget.bridge=function(D,C){B.fn[D]=function(G){var E=typeof G==="string",F=Array.prototype.slice.call(arguments,1),H=this;G=!E&&F.length?B.extend.apply(null,[true,G].concat(F)):G;if(E&&G.substring(0,1)==="_"){return H}if(E){this.each(function(){var I=B.data(this,D),J=I&&B.isFunction(I[G])?I[G].apply(I,F):I;if(J!==I&&J!==undefined){H=J;return false}})}else{this.each(function(){var I=B.data(this,D);if(I){if(G){I.option(G)}I._init()}else{B.data(this,D,new C(G,this))}})}return H}};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(E,F){var D=E,C=this;if(arguments.length===0){return B.extend({},C.options)}if(typeof E==="string"){if(F===undefined){return this.options[E]}D={};D[E]=F}B.each(D,function(G,H){C._setOption(G,H)});return C},_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(D,E,F){var H=this.options[D];E=B.Event(E);E.type=(D===this.widgetEventPrefix?D:this.widgetEventPrefix+D).toLowerCase();F=F||{};if(E.originalEvent){for(var C=B.event.props.length,G;C;){G=B.event.props[--C];E[G]=E.originalEvent[G]}}this.element.trigger(E,F);return !(B.isFunction(H)&&H.call(this.element[0],E,F)===false||E.isDefaultPrevented())}}})(jQuery);
