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