(function(b){function a(e,d){var g=b("<div></div>").addClass(d.className).html(e.attr("title")).insertAfter(e);g.hide();e.removeAttr("title");function c(i,h){g.css({left:i,top:h})}function f(i){var j=g.outerWidth();var m=g.outerHeight();var l=b(window);var h=l.width()+l.scrollLeft();var o=l.height()+l.scrollTop();var n=i.pageX+d.offset[0];var k=i.pageY+d.offset[1];if(n+j>h){n=h-j}if(k+m>o){k=i.pageY-d.offset[1]-m}c(n,k)}e.hover(function(h){f(h);d.show(g)},function(){d.hide(g)})}b.fn.hovertip=function(c){var d={offset:[10,10],className:"hovertip",show:function(e){e.fadeIn(150)},hide:function(e){e.fadeOut(150)}};b.extend(d,c);this.each(function(){var e=new a(b(this),d);b(this).data("hovertip",e)})}})(jQuery);