/* Wayfarer Tooltip
 * Version 0.9.2
 * Author Abel Mohler
 * URI: http://www.wayfarerweb.com/wtooltip.php
 * Released under MIT License: http://www.wayfarerweb.com/mit.php
 */
(function(a){a.fn.wTooltip=function(h,i){h=a.extend({content:null,ajax:null,appendTip:"body",degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(){},callAfter:function(){},delay:0},h||{});h.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",maxWidth:"350px",textAlign:"left"},h.style||{});if(typeof i=="function"){h.callAfter=i||h.callAfter}h.style.display="none",h.style.position="fixed";var e,d=document.createElement("div"),c=document.getElementsByTagName("html")[0],b=(typeof document.body.style.maxWidth=="undefined")?true:false;if(b){h.style.position="absolute"}if(h.id){d.id=h.id}if(h.className){d.className=h.className}h.degrade=(h.degrade&&b)?true:false;for(var g in h.style){d.style[g]=h.style[g]}function f(j){if(j){if(h.degrade){a(d).html(h.content.replace(/<\/?[^>]+>/gi,""))}else{a(d).html(h.content)}}}if(h.ajax){a.get(h.ajax,function(j){if(j){h.content=j}f(h.content)})}f(h.content&&!h.ajax);a(d).appendTo(h.appendTip);return this.each(function(){this.onmouseover=function(j){if(this.title&&!h.degrade){h.title=this.title;this.title=""}if(h.content&&h.degrade){this.title=d.innerHTML}e=setTimeout(function(){if(typeof h.callBefore=="function"){h.callBefore()}var l=(j)?j:window.event;var k;if(h.content){if(!h.degrade){k="block"}}else{if(h.title&&!h.degrade){a(d).html(h.title);k="block"}else{k="none"}}d.style.display=k},h.delay)};this.onmouseout=function(j){clearTimeout(e);if(typeof h.callAfter=="function"){h.callAfter()}var k=(j)?j:window.event;if(h.title){this.title=h.title;h.title=null}d.style.display="none"};this.onmousemove=function(l){var o=(l)?l:window.event;var j=(b)?c.scrollTop:0;var k=(b)?c.scrollLeft:0;var n={top:o.clientY+j+h.offsetY+"px",left:o.clientX+k+h.offsetX+"px"};for(var m in n){d.style[m]=n[m]}}})}})(jQuery);