/*
 * 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 = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery(".tooltip").hover(function(e){											  
			this.t = this.title;
			this.title = "";
		
			this.r = this.t.split(' - ');
			if(this.r[1]) this.r1 = "<br><i>"+ this.r[1] +"</i>"; else this.r1 = ""; 
			
			this.x = "<p id='tooltip'>"+this.r[0]+this.r1+"</p>";

		jQuery("body").append(this.x);
		jQuery("#tooltip")
			.css("z-index","3000")
			.css("border","3px solid #222")
			.css("padding","5px")
			.css("color","#EEEEEE")
			.css("background-color","#333")
			.css("opacity","0.85")
			.css("position","absolute")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
			
		jQuery("#tooltip i")
			.css("font-size","9px")
			.css("color","#9f9f9f")
			.fadeIn("fast");		
		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });	
	jQuery(".tooltip").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};




