(function(c){c.fn.tipTip=function(x){var a=c.extend({activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},x);if(c("#tiptip_holder").length<=0){var e=c('<div id="tiptip_holder" style="max-width:'+a.maxWidth+';"></div>'),s=c('<div id="tiptip_content"></div>'),p=c('<div id="tiptip_arrow"></div>');c("body").append(e.html(s).prepend(p.html('<div id="tiptip_arrow_inner"></div>')))}else e=
c("#tiptip_holder"),s=c("#tiptip_content"),p=c("#tiptip_arrow");return this.each(function(){var g=c(this),u=a.content?a.content:g.attr(a.attribute);if(u!=""){a.content||g.removeAttr(a.attribute);var n=!1;a.activation=="hover"?(g.hover(function(){k()},function(){a.keepAlive||d()}),a.keepAlive&&e.hover(function(){},function(){d()})):a.activation=="focus"?g.focus(function(){k()}).blur(function(){d()}):a.activation=="click"&&(g.click(function(){k();return!1}).hover(function(){},function(){a.keepAlive||
d()}),a.keepAlive&&e.hover(function(){},function(){d()}));var k=function(){a.enter.call(this);s.html(u);e.hide().removeAttr("class").css("margin","0");p.removeAttr("style");var h=parseInt(g.offset().top),f=parseInt(g.offset().left),l=parseInt(g.outerWidth()),d=parseInt(g.outerHeight()),m=e.outerWidth(),i=e.outerHeight(),q=Math.round((l-m)/2),k=Math.round((d-i)/2),r=Math.round(f+q),j=Math.round(h+d+a.edgeOffset),b="",o="",t=Math.round(m-12)/2;a.defaultPosition=="bottom"?b="_bottom":a.defaultPosition==
"top"?b="_top":a.defaultPosition=="left"?b="_left":a.defaultPosition=="right"&&(b="_right");var v=q+f<parseInt(c(window).scrollLeft()),w=m+f>parseInt(c(window).width());if(v&&q<0||b=="_right"&&!w||b=="_left"&&f<m+a.edgeOffset+5)b="_right",o=Math.round(i-13)/2,t=-12,r=Math.round(f+l+a.edgeOffset),j=Math.round(h+k);else if(w&&q<0||b=="_left"&&!v)b="_left",o=Math.round(i-13)/2,t=Math.round(m),r=Math.round(f-(m+a.edgeOffset+5)),j=Math.round(h+k);f=h+d+a.edgeOffset+i+8>parseInt(c(window).height()+c(window).scrollTop());
l=h+d-(a.edgeOffset+i+8)<0;if(f||b=="_bottom"&&f||b=="_top"&&!l)b=="_top"||b=="_bottom"?b="_top":b+="_top",o=i,j=Math.round(h-(i+5+a.edgeOffset));else if(l|(b=="_top"&&l)||b=="_bottom"&&!f)b=="_top"||b=="_bottom"?b="_bottom":b+="_bottom",o=-12,j=Math.round(h+d+a.edgeOffset);if(b=="_right_top"||b=="_left_top")j+=5;else if(b=="_right_bottom"||b=="_left_bottom")j-=5;if(b=="_left_top"||b=="_left_bottom")r+=5;p.css({"margin-left":t+"px","margin-top":o+"px"});e.css({"margin-left":r+"px","margin-top":j+
"px"}).attr("class","tip"+b);n&&clearTimeout(n);n=setTimeout(function(){e.stop(!0,!0).fadeIn(a.fadeIn)},a.delay)},d=function(){a.exit.call(this);n&&clearTimeout(n);e.fadeOut(a.fadeOut)}}})}})(jQuery);

