/*
 * Url preview 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.screenshotPreview = function(){	
	xOffset = 10;
	yOffset = 30;
	
	$("a.infobulles").hover(function(e)	{
	
		this.t = this.title; this.title = "";
		this.r = this.rel; this.rel = "";	
		
		var image = (this.r != "") ? "<img src='"+this.r+"' alt='' /><br />" : "";
		var commentaire = (this.t != "") ? "<span>"+this.t+"</span>" : "";
		
		$("body").append("<p id='infobulles'>"+image+commentaire+"</p>");								 
		$("#infobulles")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
		},
		
		function()
		{
			this.title = this.t;	
			this.rel = this.r;	
			$("#infobulles").remove();
	    }
	);	
	
	$("a.infobulles").mousemove(function(e) {
		$("#infobulles")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


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