$(function(){

	xOffset = 10;
	yOffset = 30;		
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result
	
	/* END CONFIG */
	$("a.previewimage").bind('mouseover', function(event){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='previewimage'><img src='"+ event.target.src +"' alt='Image preview' />"+ c +"</p>");								 
		$("#previewimage")
			.css("top",(event.pageY - xOffset) + "px")
			.css("left",(event.pageX + yOffset) + "px")
			.fadeIn("fast");		
	})
	$("a.previewimage").bind('mouseout', function(event){
		$("#previewimage").remove();		
	})	
	
	$("a.previewimage").mousemove(function(e){
		$("#previewimage")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});

})