/*
 * jQuery easy-tooltip plugin
 * Examples and documentation at: http://www.easy-tuts.com/downloads/jquery-plugins/
 * version 1.3 (22-APR-2011)
 * Requires jQuery v1.4.3 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Author: alexander@easy-tuts.com
 */

(function($){$.fn.tooltip=function(o){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).tooltip(o);});}return this;}$(document).ready(function(){$('[data-tooltipfor]').each(function(){var $height,$width,$tip,$elem;if($(this).html()==''){$(this).remove();return;}$tip=$(this).wrap('<div />').parent();$tip.hide();$height=$tip.outerHeight();$width=$tip.outerWidth();$elem=$('#'+$(this).data('tooltipfor'));$(this).removeAttr('data-tooltipfor');$tip.appendTo('body').css('position','absolute').css({'left':'-9000px'}).hide();$elem.mousemove(function(e){setPosition($tip,e.pageX+12,e.pageY+12);}).hover(function(e){$tip.appendTo('body');setPosition($tip,e.pageX+12,e.pageY+12);$tip.clearQueue().stop().css('opacity',1.0).hide().fadeIn(o.durationIn);},function(e){$tip.clearQueue().stop().css('opacity',1.0).show().fadeOut(o.durationOut,function(){$(this).css({'left':'-9000px'}).hide();});});});});return this.each(function(){var $this=$(this),$tooltip,$content=$('<span />'),$title=$(this).attr('title'),$width,$height,$temp,$temp2,$animations,randomIn,randomOut;if($title!==undefined&&$title!==''){$this.attr('title','');if(o===undefined){o={};}if(o.delay===undefined){o.delay=0;}if(o.animation!==undefined){o.animationIn=o.animation;o.animationOut=o.animation;}if(o.duration!==undefined){o.durationIn=o.duration;o.durationOut=o.duration;}if(o.animationIn===undefined){o.animationIn='fade';}if(o.durationIn===undefined){o.durationIn='medium';}if(o.animationOut===undefined){o.animationOut='none';}if(o.durationOut===undefined){o.durationOut='fast';}if(o.animationIn=='random'){randomIn=true;}else{randomIn=false;}if(o.animationOut=='random'){randomOut=true;}else{randomOut=false;}if(o.className===undefined){o.className='easy-tooltip-default';}$content.appendTo('body').addClass(o.className).css(o).css({'position':'relative','display':'block'}).hide();if(o.separator!==undefined){var $temp=$title.indexOf(o.separator);if($temp!=-1&&$temp!=0&&$temp!=$title.length-$temp.length){$temp2=$('<span />').addClass(o.titleClass).addClass('easy-tooltip-title').html($title.substring(0,$temp));if(o.titleStyle!==undefined)$temp2.css(o.titleStyle);$temp2.appendTo($content);$temp2=$('<span />').addClass(o.textClass).addClass('easy-tooltip-text').html($title.substring($temp+o.separator.length));if(o.textStyle!==undefined)$temp2.css(o.textStyle);$temp2.appendTo($content);}else{$temp2=$('<span />').addClass(o.textClass).addClass('easy-tooltip-text').html($title);if(o.textStyle!==undefined)$temp.css(o.textStyle);$temp2.appendTo($content);}}else{$temp2=$('<span />').addClass(o.textClass).addClass('easy-tooltip-text').html($title);if(o.textStyle!==undefined)$temp.css(o.textStyle);$temp2.appendTo($content);}$width=$content.outerWidth();$height=$content.outerHeight();$tooltip=$content.wrap('<div />').parent().width($width).height($height).css({'position':'absolute','overflow':'hidden','left':'-9000px'}).hide();if(o.wrapperClass===undefined){o.wrapperClass='easy-tooltip-wrapper';}$tooltip.addClass(o.wrapperClass);$animations={names:new Array('none','fade','slide','racer','bounce'),cssNormal:{left:0,top:0},noneIn:{},noneOut:{},fadeIn:{css:{opacity:'0.0'},animate:new Array({css:{opacity:'1.0'},duration:o.durationIn})},fadeOut:{animate:new Array({css:{opacity:'0.0'},duration:o.durationOut})},slideIn:{css:{top:$height},animate:new Array({css:{top:0},duration:o.durationIn})},slideOut:{animate:new Array({css:{top:$height},duration:o.durationOut})},racerIn:{css:{left:0-$width},animate:new Array({css:{left:0},duration:o.durationIn})},racerOut:{animate:new Array({css:{left:$width},duration:o.durationOut})},bounceIn:{css:{top:$height},animate:new Array({css:{top:0},duration:o.durationIn},{css:{top:'+=8'},duration:200},{css:{top:'-=8'},duration:200})},bounceOut:{animate:new Array({css:{top:$height},duration:o.durationOut},{css:{top:'-=8'},duration:200},{css:{top:'+=8'},duration:200})}};$this.mousemove(function(e){setPosition($tooltip,e.pageX+12,e.pageY+12);}).hover(function(e){$tooltip.appendTo('body');setPosition($tooltip,e.pageX+12,e.pageY+12);if(randomIn===true){o.animationIn=$animations.names[Math.round(Math.random()*($animations.names.length-1))];}effect('in',o,$content,$animations);},function(e){if(randomOut===true){o.animationOut=$animations.names[Math.round(Math.random()*($animations.names.length-1))];}effect('out',o,$content,$animations);});}});function setPosition($tooltip,$x,$y){var $width=$tooltip.width(),$height=$tooltip.height(),$maxWidth=$(window).width()+$(window).scrollLeft(),$maxHeight=$(window).height()+$(window).scrollTop();if($y-12-$height>=0+$(window).scrollTop())$y=$y-12-$height;if($y+$height>$maxHeight&&$y-12-$height>=0){$y=$y-12-$height;}if($x+$width>$maxWidth&&$x-12-$width>=0){$x=$x-12-$width;}$tooltip.css({top:$y,left:$x});}function effect(inOut,o,$content,$animations){var css,animate;if(inOut=='in'){if(o.animationIn=='none'){$content.clearQueue().stop().show().parent().show();}else if(o.animationIn=='fade'){$content.clearQueue().stop().show().parent().hide().fadeIn(o.durationIn,function(){$content.parent().show();});}else{css=$animations[o.animationIn+'In'].css;animate=$animations[o.animationIn+'In'].animate;$content.parent().show();$content.clearQueue().stop().css($animations.cssNormal).queue(function(){if(css!==undefined)$(this).css(css);$(this).dequeue();}).show().queue(function(){if(animate!==undefined)animation($content,animate);$(this).dequeue();}).queue(function(){$(this).css($animations.cssNormal);$(this).dequeue();});}}else{if(o.animationIn=='none'){$content.clearQueue().stop().hide().parent().hide().css({'left':'-9000px'});}else if(o.animationOut=='fade'){$content.clearQueue().stop().show().parent().show().fadeOut(o.durationOut,function(){$content.parent().hide().css({'left':'-9000px'});$content.hide();});}else{animate=$animations[o.animationOut+'Out'].animate;$content.parent().show();$content.clearQueue().stop().css($animations.cssNormal).show().delay(o.delay).queue(function(){if(animate!==undefined)animation($content,animate);$(this).dequeue();}).queue(function(){$(this).queue(function(){$(this).hide().parent().css({'left':'-9000px'}).hide();}).css($animations.cssNormal);$(this).dequeue();});}}}function animation($content,animate){for(var i=0;i<animate.length;i++){$content.animate(animate[i].css,animate[i].duration);}}}})(jQuery);
