/*!
 * jQuery UI Widget 1.8.6
 *
 * 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(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var e=0,d;(d=b[e])!=null;e++)a(d).triggerHandler("remove");c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){if(!c)(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return d.call(a(this),b,c)})}}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(true,{},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(c,d){a.fn[c]=function(e){var f=typeof e==="string",h=Array.prototype.slice.call(arguments,1),g=this;e=!f&&h.length?a.extend.apply(null,[true,e].concat(h)):e;if(f&&e.charAt(0)==="_")return g;if(f)this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,h):d;if(f!==d&&f!==b){g=f;return false}});else this.each(function(){var b=a.data(this,c);if(b)b.option(e||{})._init();else a.data(this,c,new d(e,this))});return g}};a.Widget=function(b,a){arguments.length&&this._createWidget(b,a)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(c,b){a.data(b,this.widgetName,this);this.element=a(b);this.options=a.extend(true,{},this.options,this._getCreateOptions(),c);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_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,e){var d=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c==="string"){if(e===b)return this.options[c];d={};d[c]=e}this._setOptions(d);return this},_setOptions:function(b){var c=this;a.each(b,function(b,a){c._setOption(b,a)});return this},_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)