this.imagePreview = function(){	
	/* CONFIG */
		xOffset = 150;
		yOffset = 20;
		// these 2 variable determine popup's distance from the cursor
	/* END CONFIG */
	$("div.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var foot = (this.id != "") ? "<br/>" + this.id : "";	
		$("body").append("<p id='preview'><img src='"+ this.t +"' alt='Image preview' />"+ foot +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("div.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

// starting the script on page load
$(document).ready(function(){
	imagePreview();
});
