(function(a){a.fn.tipsy=function(e){e=a.extend({},a.fn.tipsy.defaults,e);return this.each(function(){var d=a.fn.tipsy.elementOptions(this,e);a(this).hover(function(){a.data(this,"cancel.tipsy",!0);var c=a.data(this,"active.tipsy");c||(c=a('<div class="tipsy"><div class="tipsy-inner"/></div>'),c.css({position:"absolute",zIndex:1E5}),a.data(this,"active.tipsy",c));if(a(this).attr("title")||"string"!=typeof a(this).attr("original-title"))a(this).attr("original-title",a(this).attr("title")||"").removeAttr("title");
    var b;"string"==typeof d.title?b=a(this).attr("title"==d.title?"original-title":d.title):"function"==typeof d.title&&(b=d.title.call(this));c.find(".tipsy-inner")[d.html?"html":"text"](b||d.fallback);b=a.extend({},a(this).offset(),{width:this.offsetWidth,height:this.offsetHeight});c.get(0).className="tipsy";c.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var e=c[0].offsetWidth,f=c[0].offsetHeight;switch(("function"==typeof d.gravity?d.gravity.call(this):
        d.gravity).charAt(0)){case "n":c.css({top:b.top+b.height,left:b.left+b.width/2-e/2}).addClass("tipsy-north");break;case "s":c.css({top:b.top-f,left:b.left+b.width/2-e/2}).addClass("tipsy-south");break;case "e":c.css({top:b.top+b.height/2-f/2,left:b.left-e}).addClass("tipsy-east");break;case "w":c.css({top:b.top+b.height/2-f/2,left:b.left+b.width}).addClass("tipsy-west")}d.fade?c.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:0.8}):c.css({visibility:"visible"})},function(){a.data(this,
    "cancel.tipsy",!1);var c=this;setTimeout(function(){if(!a.data(this,"cancel.tipsy")){var b=a.data(c,"active.tipsy");d.fade?b.stop().fadeOut(function(){a(this).remove()}):b.remove()}},100)})})};a.fn.tipsy.elementOptions=function(e,d){return a.metadata?a.extend({},d,a(e).metadata()):d};a.fn.tipsy.defaults={fade:!1,fallback:"",gravity:"n",html:!1,title:"title"};a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"};a.fn.tipsy.autoWE=function(){return a(this).offset().left>
    a(document).scrollLeft()+a(window).width()/2?"e":"w"}})(jQuery);
