/*!
 * jQuery UI Widget 1.8a2
 *
 * Copyright (c) 2009 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
 */
/*
 * jQuery UI Widget 1.8a2
 *
 * Copyright (c) 2009 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(){b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return a.apply(this,arguments)};b.widget=function(d,c){var e=d.split(".")[0],f;d=d.split(".")[1];f=e+"-"+d;b.expr[":"][f]=function(g){return !!b.data(g,d)};b.fn[d]=function(i){var g=(typeof i=="string"),h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.substring(0,1)=="_"){return j}(g?this.each(function(){var k=b.data(this,d),l=(k&&b.isFunction(k[i])?k[i].apply(k,h):k);if(l!==k&&l!==undefined){j=l;return false}}):this.each(function(){(b.data(this,d)||b.data(this,d,new b[e][d](this,i))._init())}));return j};b[e]=b[e]||{};b[e][d]=function(i,h){var g=this;this.namespace=e;this.widgetName=d;this.widgetEventPrefix=b[e][d].eventPrefix||d;this.widgetBaseClass=f;this.options=b.extend(true,{},b.widget.defaults,b[e][d].defaults,b.metadata&&b.metadata.get(i)[d],h);this.element=b(i).bind("setData."+d,function(k,j,l){if(k.target==i){return g._setData(j,l)}}).bind("getData."+d,function(k,j){if(k.target==i){return g._getData(j)}}).bind("remove."+d,function(){return g.destroy()})};b[e][d].prototype=b.extend({},b.widget.prototype,c)};b.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled");return this},option:function(e,f){var d=e,c=this;if(typeof e=="string"){if(f===undefined){return this._getData(e)}d={};d[e]=f}b.each(d,function(g,h){c._setData(g,h)});return c},_getData:function(c){return this.options[c]},_setData:function(c,d){this.options[c]=d;if(c=="disabled"){this.element[d?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",d)}},enable:function(){this._setData("disabled",false);return this},disable:function(){this._setData("disabled",true);return this},_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())}};b.widget.defaults={disabled:false}})(jQuery);