/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 *
 *edited by Bruno-Pierre Campeau (http://www.cirquedusoleil.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *and http://zworkshop.wordpress.com
 */
 


this.tooltip = function(){	
	/* CONFIG */		
		var posiX = -10;
		var posiY = 30;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		var posiToolTip = $(this).offset();//Creates the object that will return the coordinates of the hovered link
		this.t = this.title; //Pinpoints the title elements of the link, which will be displayed into the tooltip
		this.title = ""; //This is the default value of the tooltip in case none are inserted into the link							  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");//This will contain the tool tip, it can be anything
		$("#tooltip")
			//DECOMENT THIS TO HAVE A CONSTANT TRACKING OF THE MOUSE WHILE IT HOVERS ON THE LINK
			// .css("top",(e.pageY - xOffset) + "px")
			// .css("left",(e.pageX + yOffset) + "px")
			//COMMENT THIS TO HAVE A CONSTANT TRACKING OF THE MOUSE WHILE IT HOVERS ON THE LINK
			.css("top",(posiToolTip.top - posiY) + "px")//Positionnement sur les Y
			.css("left",(posiToolTip.left + this.offsetWidth/2 + posiX) + "px")//Positionnement sur les X
			
			.fadeIn("normal");//The fade-in animation of the tool tip		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });
	//DECOMMENT THIS TO HAVE A CONSTANT TRACKING OF THE MOUSE WHILE IT HOVERS ON THE LINK
	// $("a.tooltip").mousemove(function(e){
		// $("#tooltip")
			// .css("top",(e.pageY - xOffset) + "px")
			// .css("left",(e.pageX + yOffset) + "px");
	// });			
};