/*
 * 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 */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
}; 
	/*********************************/
this.tooltip2 = function(){	
	/* CONFIG */		
		xOffset2 = 40;
		yOffset2 = -35;				
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */	
		$("area.tooltip_map").hover(function(e){											  
		this.t2 = this.id;
		this.id = "";									  
		$("body").append("<p id='tooltip_map'>"+ this.t2 +"</p>");
		$("#tooltip_map")
			.css("top",(e.pageY - xOffset2) + "px")
			.css("left",(e.pageX + yOffset2) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.id = this.t2;		
		$("#tooltip_map").remove();
    });	
	$("area.tooltip_map").mousemove(function(e){
		$("#tooltip_map")
			.css("top",(e.pageY - xOffset2) + "px")
			.css("left",(e.pageX + yOffset2) + "px");
	});		
	/*********************************/
};

this.tooltip3 = function(){	
	/* CONFIG */		
		xOffset3 = 180;
		yOffset3 = -50;				
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip_comment").hover(function(e){											  
		this.t3 = this.title;
		this.title = "";									  
		$("body").append("<div id='tooltip_comment'><table width='100%'><tr><td style='padding:5px;vertical-align:top;'>"+ this.t3 +"</td></tr></table></div>");
		$("#tooltip_comment")
			.css("top",(e.pageY - xOffset3) + "px")
			.css("left",(e.pageX + yOffset3) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t3;		
		$("#tooltip_comment").remove();
    });	
	$("a.tooltip_comment").mousemove(function(e){
		$("#tooltip_comment")
			.css("top",(e.pageY - xOffset3) + "px")
			.css("left",(e.pageX + yOffset3) + "px");
	});	
}; 
	/*********************************/

this.screenshotPreview = function(){	
	/* CONFIG */
		
		xOffset4 = 230;
		yOffset4 = 10;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset4) + "px")
			.css("left",(e.pageX + yOffset4) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset4) + "px")
			.css("left",(e.pageX + yOffset4) + "px");
	});			
};




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