/*
 * Image preview script
 *
 * powered by jQuery (http://www.jquery.com)
 *
 * written by Youssef ELALAOUI(http://jcargoo.org)
 *
 * Details: http://jcargoo.org
 *
 */

this.imagePreview = function(){
	/* CONFIGURATION */
		xOffset = 15;
		yOffset = 15;
	/* END CONFIGURATION */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		var  c ="";
		if(this.t != ""){
			c = "<span class= \"imagetitle\" ><br/>" + this.t + "</span>";
		}
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(1000);
    },
	function(){
		this.title = this.t;
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};