(function($){$.fn.myTooltip=function(options){var opts=$.extend({},$.fn.myTooltip.defaults,options);return this.each(function(){var obj=$(this);var plainClassName=opts.tooltip.replace(/./,"");obj.mouseover(function(e){var position=obj.offset();var windowWidth=$(window).width();var windowHeight=$(window).height();var windowScrollHeight=$(window).scrollTop();var classWidth=opts.tooltipWidth;var classHeight=opts.tooltipHeight;if(e.pageX+classWidth>windowWidth)
{var offsetLeft=classWidth;}
else
{var offsetLeft=opts.offsetLeft;}
var offsetTop=0;if((classHeight+opts.offsetTop+windowScrollHeight)>e.pageY)
{offsetTop=0;}
else if((e.pageY+classHeight)>windowHeight)
{offsetTop=opts.offsetTop+classHeight;}
else
{offsetTop=opts.offsetTop;}
if(opts.attribute=='')
{var content=$("<div>").html($(obj).next($(opts.target)).html());}
else
{var content=$("<div>").html($(obj).attr(opts.attribute));}
content.addClass(plainClassName).css({width:classWidth,height:classHeight,left:(position.left-offsetLeft),top:(position.top-offsetTop)}).appendTo("body");tip=setTimeout("$('"+opts.tooltip+"').show('drop',{direction:'up'});",opts.timeout);});obj.mouseout(function(e){clearTimeout(tip);$(opts.tooltip).remove().fadeOut("slow");});});};$.fn.myTooltip.defaults={tooltip:'.tooltipSnippets',tooltipWidth:200,tooltipHeight:100,offsetLeft:0,offsetTop:0,target:'div',timeout:750,attribute:'',opacity:1.0};})(jQuery);
