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

