(function(e){var d={},b,h,l,i=e.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),k=false;e.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){e.tooltip.blocked=!e.tooltip.blocked}};e.fn.extend({tooltip:function(p){p=e.extend({},e.tooltip.defaults,p);n(p);return this.each(function(){e.data(this,"tooltip",p);this.tOpacity=d.parent.css("opacity");this.tooltipText=this.title;e(this).removeAttr("title");this.alt=""}).mouseover(f).mouseout(g).click(g)},fixPNG:i?function(){return this.each(function(){var p=e(this).css("backgroundImage");if(p.match(/^url\(["']?(.*\.png)["']?\)$/i)){p=RegExp.$1;e(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+p+"')"}).each(function(){var q=e(this).css("position");if(q!="absolute"&&q!="relative"){e(this).css("position","relative")}})}})}:function(){return this},unfixPNG:i?function(){return this.each(function(){e(this).css({filter:"",backgroundImage:""})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){e(this)[e(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}});function n(p){if(d.parent){return}d.parent=e('<div id="'+p.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if(e.fn.bgiframe){d.parent.bgiframe()}d.title=e("h3",d.parent);d.body=e("div.body",d.parent);d.url=e("div.url",d.parent)}function o(p){return e.data(p,"tooltip")}function j(p){if(o(this).delay){l=setTimeout(m,o(this).delay)}else{m()}k=!!o(this).track;e(document.body).bind("mousemove",a);a(p)}function f(){if(e.tooltip.blocked||this==b||(!this.tooltipText&&!o(this).bodyHandler)){return}b=this;h=this.tooltipText;if(o(this).bodyHandler){d.title.hide();var q=o(this).bodyHandler.call(this);if(q.nodeType||q.jquery){d.body.empty().append(q)}else{d.body.html(q)}d.body.show()}else{if(o(this).showBody){var s=h.split(o(this).showBody);d.title.html(s.shift()).show();d.body.empty();for(var r=0,p;(p=s[r]);r++){if(r>0){d.body.append("<br/>")}d.body.append(p)}d.body.hideWhenEmpty()}else{d.title.html(h).show();d.body.hide()}}if(o(this).showURL&&e(this).url()){d.url.html(e(this).url().replace("http://","")).show()}else{d.url.hide()}d.parent.addClass(o(this).extraClass);if(o(this).fixPNG){d.parent.fixPNG()}j.apply(this,arguments)}function m(){l=null;if((!i||!e.fn.bgiframe)&&o(b).fade){if(d.parent.is(":animated")){d.parent.stop().show().fadeTo(o(b).fade,b.tOpacity)}else{d.parent.is(":visible")?d.parent.fadeTo(o(b).fade,b.tOpacity):d.parent.fadeIn(o(b).fade)}}else{d.parent.show()}a()}function a(s){if(e.tooltip.blocked){return}if(s&&s.target.tagName=="OPTION"){return}if(!k&&d.parent.is(":visible")){e(document.body).unbind("mousemove",a)}if(b==null){e(document.body).unbind("mousemove",a);return}d.parent.removeClass("viewport-right").removeClass("viewport-bottom");var t=d.parent[0].offsetLeft;var q=d.parent[0].offsetTop;if(s){t=s.pageX+o(b).left;q=s.pageY+o(b).top;var u="auto";if(o(b).positionLeft){u=e(window).width()-t;t="auto"}d.parent.css({left:t,right:u,top:q})}var r=c(),p=d.parent[0];if(r.x+r.cx<p.offsetLeft+p.offsetWidth){t-=p.offsetWidth+20+o(b).left;d.parent.css({left:t+"px"}).addClass("viewport-right")}if(r.y+r.cy<p.offsetTop+p.offsetHeight){q-=p.offsetHeight+20+o(b).top;d.parent.css({top:q+"px"}).addClass("viewport-bottom")}}function c(){return{x:e(window).scrollLeft(),y:e(window).scrollTop(),cx:e(window).width(),cy:e(window).height()}}function g(q){if(e.tooltip.blocked){return}if(l){clearTimeout(l)}b=null;var r=o(this);function p(){d.parent.removeClass(r.extraClass).hide().css("opacity","")}if((!i||!e.fn.bgiframe)&&r.fade){if(d.parent.is(":animated")){d.parent.stop().fadeTo(r.fade,0,p)}else{d.parent.stop().fadeOut(r.fade,p)}}else{p()}if(o(this).fixPNG){d.parent.unfixPNG()}}})(jQuery);
