(function(b){b.fn.wTooltip=function(B,H){B=b.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:"body",degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(c,d,e){},callAfter:function(c,d,e){},clickAction:function(c,d){b(c).hide();},delay:0,timeout:0,cloneable:false},B||{});
if(!B.style&&typeof B.style!="object"){B.style={};B.style.zIndex="1000";}else{B.style=b.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},B.style||{});}if(typeof H=="function"){B.callAfter=H||B.callAfter;}B.style.display="none",B.style.position="absolute";
var p,u,a,E,v={},F=true,C=false,o=false,G=document.createElement("div"),y=document.getElementsByTagName("html")[0],A=(typeof document.body.style.maxWidth=="undefined")?true:false,w=(typeof b.talk=="function"&&typeof b.listen=="function")?true:false;if(B.id){G.id=B.id;}if(B.className){G.className=B.className;
}B.degrade=(B.degrade&&A)?true:false;for(var D in B.style){G.style[D]=B.style[D];}function x(c){if(c){if(B.degrade){b(G).html(B.content.replace(/<\/?[^>]+>/gi,""));}else{b(G).html(B.content);}}}if(B.ajax){b.get(B.ajax,function(c){if(c){B.content=c;}x(B.content);});}function z(d){function c(f){if(p&&!B.content){f.title=p;
p=null;}}function e(){if(!C&&B.auto){clearInterval(E);if(B.fadeOut){b(G).fadeOut(B.fadeOut,function(){c(d);});}else{c(d);G.style.display="none";}}if(typeof B.callAfter=="function"){B.callAfter(G,d,B);}if(w){B=b.listen(B);}}if(B.timeout>0){a=setTimeout(function(){e();},B.timeout);}else{e();}}b(G).hover(function(){C=true;
},function(){C=false;z(v);});if(w){B.key=G;B.plugin="wTooltip";B.channel="wayfarer";b.talk(B);}x(B.content&&!B.ajax);b(G).appendTo(B.appendTip);return this.each(function(){this.onmouseover=function(c){var d=this;clearTimeout(a);if(this.title&&!B.degrade&&!B.content){p=this.title;this.title="";}if(B.content&&B.degrade){this.title=G.innerHTML;
}function e(){if(typeof B.callBefore=="function"){B.callBefore(G,d,B);}if(w){B=b.listen(B);}if(B.auto){var f;if(B.content){if(!B.degrade){f="block";}}else{if(p&&!B.degrade){b(G).html(p);f="block";}else{f="none";}}if(f=="block"&&B.fadeIn){b(G).fadeIn(B.fadeIn);}else{G.style.display=f;}}}if(B.delay>0){u=setTimeout(function(){e();
},B.delay);}else{e();}};this.onmousemove=function(g){var i=(g)?g:window.event,j=this;v=this;if(B.follow||F){var f=y.scrollTop;var e=y.scrollLeft;var h=i.clientY+f+B.offsetY;var c=i.clientX+e+B.offsetX;var d=b(window).width()+e-b(G).outerWidth();var k=b(window).height()+f-b(G).outerHeight();o=(h>k||c>d)?true:false;
if(c-e<=0&&B.offsetX<0){c=e;}else{if(c>d){c=d;}}if(h-f<=0&&B.offsetY<0){h=f;}else{if(h>k){h=k;}}G.style.top=h+"px";G.style.left=c+"px";F=false;}};this.onmouseout=function(){clearTimeout(u);var c=this;F=true;if(!B.follow||o||(B.offsetX<0&&B.offsetY<0)){setTimeout(function(){E=setInterval(function(){z(c);
},1);},1);}else{z(this);}};if(typeof B.clickAction=="function"){this.onclick=function(){B.clickAction(G,this);};}});};})(jQuery);
