/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 


this.tooltip = function(){	
	/* CONFIG */		
	
		xOffset = 115;
		yOffset = 160;
		t_ecran=document.body.clientWidth;
		marge=(t_ecran-990)/2;
		
		
		// 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 elements = document.documentElement.getElementsByTagName('select');
		//alert(e.parentNode);
		
		this.t = this.title;
		//alert(this.t);
		this.title = "";									  
		$("#content").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - yOffset ) + "px")
			.css("left",(e.pageX - xOffset) + "px")
			.fadeIn("fast");	
			
    },
	function(){
		$("#tooltip").remove();
		this.title = this.t;
		var elements = document.documentElement.getElementsByTagName('select');
		/*for (var i=0; i<elements.length; i++) {
            elements[i].style.visibility = "visible";
        }*/
    });	
	$("a.tooltip").mousemove(function(e){
		posX=e.pageX - xOffset - marge;	
		gauche=e.pageX - xOffset - marge;
		//alert(gauche);
		if(gauche<260 )gauche=260;
		//alert(gauche);
		$("#tooltip")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",gauche + "px")
			.css("width","230px");
	});			
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});
