// tipLite v2.0 by Bruno Bernardino | 2013.03.22 | https://github.com/BrunoBernardino/TipLite (function(){var e,t;e={generateID:function(){var e;e=function(){return((1+window.Math.random())*65536|0).toString(16).substring(1)};return(e()+e()+"-"+e()+"-4"+e().substr(0,3)+"-"+e()+"-"+e()+e()+e()).toLowerCase()}};t={init:function(e){var n;n={dataTooltip:"tiplite",dataPosition:"tiplitePosition",tooltipClass:"tipLite",position:"above",positionMargin:10,animationType:"fade",animationSpeed:"fast",animationEasing:"swing",animationOnComplete:$.noop,followMouse:true};e=$.extend(n,e);return this.each(function(){var n,r;n=$(this);r=n.data("tipLite");if(!r){n.data("tipLite",{target:n});t.create.call(this,e);$(this).on("mouseenter.tipLite",function(){return t.show.call(this,e)});$(this).on("mouseleave.tipLite",function(){return t.hide.call(this,e)});if(e.followMouse){return $(this).on("mousemove.tipLite",function(n){return t.chaseCursor.call(this,n,e)})}}})},destroy:function(){$(window).off(".tipLite");return this.each(function(){var e,t;e=$(this);t=e.data("tipLite");return e.removeData("tipLite")})},create:function(t){var n,r,i,s,o,u,a,f,l,c,h,p;n=$(this);i=n.data("tipLite");r=t.position;h="";if(!n.data(t.dataTooltip)){h=n.attr("title")}else{h=n.data(t.dataTooltip)}n.attr("title","");o=e.generateID.call(this);c="tipLite-"+o;l='
'+h+"
";$(l).appendTo("body");i.tipLiteID=c;if(n.data(t.dataPosition)){r=n.data(t.dataPosition)}if(!t.followMouse){s=n.clone().css({display:"inline",visibility:"hidden"}).appendTo("body");$("#"+c).css({top:n.offset().top+s.outerHeight(),left:n.offset().left});a=(s.outerWidth()-$("#"+c).outerWidth())/2;f=(s.outerHeight()+$("#"+c).outerHeight()+t.positionMargin)*-1;switch(r){case"left":f=s.outerHeight()*-1;a=(s.outerWidth()+t.positionMargin)*-1;break;case"right":f=s.outerHeight()*-1;a=s.outerWidth()+t.positionMargin;break;case"below":f=t.positionMargin;break}$("#"+c).css({"margin-top":f,"margin-left":a});if(n.offset().top+f<0){$("#"+c).css({"margin-top":0})}if(n.offset().top+f+$("#"+c).outerHeight()>$(document).height()){u=$("#"+c).offset().top+$("#"+c).outerHeight()-$(document).height();$("#"+c).css({"margin-top":$("#"+c).css("margin-top")-u})}if(n.offset().left+a<0){$("#"+c).css({"margin-left":0})}if(n.offset().left+a+$("#"+c).outerWidth()>$(document).width()){p=$("#"+c).offset().left+$("#"+c).outerWidth()-$(document).width();$("#"+c).css({"margin-left":$("#"+c).css("margin-left")-p})}i.marginLeft=$("#"+c).css("margin-left");i.marginTop=$("#"+c).css("margin-top");return s.remove()}},show:function(e){var t,n,r,i;t=$(this);n=t.data("tipLite");i=$("#"+n.tipLiteID);switch(e.animationType){case"slide":r=parseInt(n.marginLeft,10);return i.stop().css({opacity:0,display:"block","margin-left":r-e.positionMargin*2}).animate({opacity:1,"margin-left":r},e.animationSpeed,e.animationEasing,e.animationOnComplete);default:return i.stop().fadeIn(e.animationSpeed,e.animationEasing,e.animationOnComplete)}},hide:function(){var e,t;e=$(this);t=e.data("tipLite");return $("#"+t.tipLiteID).stop().hide()},hideAllTipLites:function(e){return $("."+e.tooltipClass).stop().hide()},chaseCursor:function(e,t){var n,r,i,s,o,u;n=$(this);i=n.data("tipLite");r=t.position;u=0;s=0;if(n.data(t.dataPosition)){r=n.data(t.dataPosition)}o=$("#"+i.tipLiteID);s=e.pageX+t.positionMargin;switch(r){case"below":u=e.pageY+t.positionMargin;break;default:u=e.pageY-t.positionMargin-o.outerHeight()}return o.css({top:u,left:s})}};$.fn.tipLite=function(e){if(t[e]){return t[e].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof e==="object"||!e){return t.init.apply(this,arguments)}else{return $.error("Method "+e+" does not exist on jQuery.tipLite")}}}).call(this)