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