/*
 * Image preview script 
 * powered by jQuery
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 200;
		yOffset = 420;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("img.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.src +"' alt='Image preview'  />"+ c +"</p>");
		$("#preview")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX - xOffset) + "px")
			.fadeIn("slow");						
    },
    
	function(){
		this.title = this.t;	
		$("#preview").remove();
  });	
	
		
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});
