/*
 * 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
 * 
 * Optimized for http://interaktiv.com.ua
 * by Alex Baskov (http://www.devtrix.net)
 * -- fixed x/y positions logic to meet the desired needs and make it more obvious.
 */
 
this.tooltip = function(){
	/* CONFIG */		
		xOffset = 20;
		yOffset = 10;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	
	$(".tooltip").live("mouseover", function(e) {
		this.t = this.title;
		this.title = "";
		$(this).addClass("tooltip_over");
		var xNew = (e.pageX + xOffset) + "px";
		var yNew = (e.pageY + yOffset) + "px";
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top", xNew)
			.css("left",yNew)
			.fadeIn("fast");		
	});
	
	$(".tooltip").live("mouseout", function(e) {
		$(this).removeClass("tooltip_over");
		this.title = this.t;		
		$("#tooltip").remove();
 	});	
	
	$(".tooltip").live("mousemove", function(e){
		$("#tooltip")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
});