(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(0>=c("#tiptip_holder").length){var e=c('<div id="tiptip_holder" style="max-width:'+a.maxWidth+';"></div>'),s=c('<div id="tiptip_content"></div>'),q=c('<div id="tiptip_arrow"></div>');c("body").append(e.html(s).prepend(q.html('<div id="tiptip_arrow_inner"></div>')))}else e=
c("#tiptip_holder"),s=c("#tiptip_content"),q=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;"hover"==a.activation?(g.hover(function(){k()},function(){a.keepAlive||d()}),a.keepAlive&&e.hover(function(){},function(){d()})):"focus"==a.activation?g.focus(function(){k()}).blur(function(){d()}):"click"==a.activation&&(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");q.removeAttr("style");var i=parseInt(g.offset().top),f=parseInt(g.offset().left),l=parseInt(g.outerWidth()),d=parseInt(g.outerHeight()),m=e.outerWidth(),j=e.outerHeight(),r=Math.round((l-m)/2),k=Math.round((d-j)/2),o=Math.round(f+r),h=Math.round(i+d+a.edgeOffset),b="",p="",t=Math.round(m-12)/2;"bottom"==a.defaultPosition?b="_bottom":"top"==a.defaultPosition?
b="_top":"left"==a.defaultPosition?b="_left":"right"==a.defaultPosition&&(b="_right");var v=r+f<parseInt(c(window).scrollLeft()),w=m+f>parseInt(c(window).width());if(v&&0>r||"_right"==b&&!w||"_left"==b&&f<m+a.edgeOffset+5)b="_right",p=Math.round(j-13)/2,t=-12,o=Math.round(f+l+a.edgeOffset),h=Math.round(i+k);else if(w&&0>r||"_left"==b&&!v)b="_left",p=Math.round(j-13)/2,t=Math.round(m),o=Math.round(f-(m+a.edgeOffset+5)),h=Math.round(i+k);f=i+d+a.edgeOffset+j+8>parseInt(c(window).height()+c(window).scrollTop());
l=0>i+d-(a.edgeOffset+j+8);if(f||"_bottom"==b&&f||"_top"==b&&!l)b="_top"==b||"_bottom"==b?"_top":b+"_top",p=j,h=Math.round(i-(j+5+a.edgeOffset));else if(l|("_top"==b&&l)||"_bottom"==b&&!f)b="_top"==b||"_bottom"==b?"_bottom":b+"_bottom",p=-12,h=Math.round(i+d+a.edgeOffset);if("_right_top"==b||"_left_top"==b)h+=5;else if("_right_bottom"==b||"_left_bottom"==b)h-=5;if("_left_top"==b||"_left_bottom"==b)o+=5;q.css({"margin-left":t+"px","margin-top":p+"px"});e.css({"margin-left":o+"px","margin-top":h+"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);

