var speechbubbles_tooltip={loadcontent:function(a,d,e,c){var b=e.url.replace(/^http:\/\/[^\/]+\//i,"http://"+window.location.hostname+"/");a.ajax({url:b,async:true,error:function(a){alert("Error fetching Ajax content.<br />Server Response: "+a.responseText)},success:function(b){a(document.body).append(b);c(d);a(b).remove()}})},buildtooltip:function(d,a){var b="$arrowparts",c=a.speechid?d("div#"+a.speechid).html():a.speechtext;if(c){$speech=d('<div class="speechbubbles">'+c+"</div>").appendTo(document.body);$speech.addClass("speechbubbles").append('<div class="speechbubbles-arrow-border"></div>\n<div class="speechbubbles-arrow"></div>');$speech.data(b,$speech.find("div.speechbubbles-arrow, div.speechbubbles-arrow-border"));var e=window.XMLHttpRequest?$speech.data(b).eq(0).outerHeight():10;$speech.data("measure",{w:$speech.outerWidth(),h:$speech.outerHeight()+e,arroww:$speech.data(b).eq(0).outerWidth()});$speech.css({display:"none",visibility:"visible"});a.$speech=$speech}return a.$speech},positiontip:function(h,i,q,p){var m="downversion",f=q.$speech,o=i.offset(),g={w:h(window).width(),h:h(window).height(),left:h(document).scrollLeft(),top:h(document).scrollTop()},a={w:i.outerWidth(),h:i.outerHeight(),left:o.left,top:o.top},b={w:f.data("measure").w,h:f.data("measure").h},d=a.left,c=a.top+a.h;d=d+b.w>g.left+g.w-3?d-b.w+a.w-5:d;c=c+b.h>g.top+g.h?c-b.h-a.h-10:c+10;var l=d!=a.left,n=c!=a.top+a.h+10;f.removeClass(m).addClass(n?m:"");var e=l?b.w-(a.left+a.w-p.pageX)-25:p.pageX-a.left-25;if(e>b.w-25)e=b.w-40;else e=l?Math.max(a.left-d+10,e):Math.max(15,e);f.data("$arrowparts").css("left",e);var j={opacity:0,left:d,top:n?c-b.h-10:c+b.h+10},k={opacity:1,top:c+10};if(document.all&&!window.msPerformance){delete j.opacity;delete k.opacity}f.css(j).show().animate(k)},init:function(c,b,d){var a={speechtext:b.attr("title"),speechid:b.attr("rel")};c.extend(a,d);if(this.buildtooltip(c,a)){a.speechtext&&b.attr("title","");b.mouseenter(function(d){if(a.$speech.queue().length==0){clearTimeout(a.hidetimer);speechbubbles_tooltip.positiontip(c,b,a,d)}});b.mouseleave(function(){a.hidetimer=setTimeout(function(){a.$speech.stop(true,true).hide()},200)})}}};jQuery.fn.speechbubble=function(a){var b=jQuery;function c(c){return c.each(function(){var c=b(this);speechbubbles_tooltip.init(b,c,a)})}if(a&&a.url)speechbubbles_tooltip.loadcontent(b,this,a,c);else c(this)};
