(function(b){var a=0;b.widget("ui.tooltip",{options:{items:"[title]",content:function(){return b(this).attr("title")},position:{my:"left center",at:"right center",offset:"15 0"}},_create:function(){var c=this;this.tooltip=b("<div></div>").attr("id","ui-tooltip-"+a++).attr("role","tooltip").attr("aria-hidden","true").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content").appendTo(document.body).hide();this.tooltipContent=b("<div></div>").addClass("ui-tooltip-content").appendTo(this.tooltip);this.opacity=this.tooltip.css("opacity");this.element.bind("focus.tooltip mouseover.tooltip",function(d){c.open(d)}).bind("blur.tooltip mouseout.tooltip",function(d){c.close(d)})},enable:function(){this.options.disabled=false},disable:function(){this.options.disabled=true},destroy:function(){this.tooltip.remove();b.Widget.prototype.destroy.apply(this,arguments)},widget:function(){return this.element.pushStack(this.tooltip.get())},open:function(e){var f=b(e&&e.target||this.element).closest(this.options.items);if(this.current&&this.current[0]==f[0]){return}var c=this;this.current=f;this.currentTitle=f.attr("title");var d=this.options.content.call(f[0],function(g){setTimeout(function(){if(c.current==f){c._show(e,f,g)}},13)});if(d){c._show(e,f,d)}},_show:function(d,e,c){if(!c){return}e.attr("title","");if(this.options.disabled){return}this.tooltipContent.html(c);this.tooltip.css({top:0,left:0}).show().position(b.extend({of:e},this.options.position)).hide();this.tooltip.attr("aria-hidden","false");e.attr("aria-describedby",this.tooltip.attr("id"));this.tooltip.stop(false,true).fadeIn();this._trigger("open",d)},close:function(c){if(!this.current){return}var d=this.current.attr("title",this.currentTitle);this.current=null;if(this.options.disabled){return}d.removeAttr("aria-describedby");this.tooltip.attr("aria-hidden","true");this.tooltip.stop(false,true).fadeOut();this._trigger("close",c)}})})(jQuery);
