/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com) * 
 * based on a script written by Alen Grakalic (http://cssglobe.com) *
 * modified by websiteUK Ltd (http://www.websiteuk.net) *
 *
 */

this.tooltip = function(){	
	/* CONFIG */		
		var timeout;
		xOffset = 30;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("[title],[title!='']").hover(function(e){	
		clearTimeout(timeout); 
		this.t = this.title;
		this.title = "";									  
		$("body").append("<div id='tooltip'><p><img src='script-images/tooltip.png' class='tooltip' title='' />"+ this.t +"</p></div>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");
		timeout = setTimeout(function() {
			$("#tooltip").fadeOut("fast")}, 4500); 
    },
	function(){	
		clearTimeout(timeout); 
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("[title],[title!='']").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
	
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});