this.imagePreview = function(){	
	/* CONFIG */
		
		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.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='' /></p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	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");
	});			
	$("a.preview").click(function(e){
		return false;
	});			
};




$(document).ready(function(){
	
	/*
	// fade in messages
	$('.success').hide();
	$('.success').fadeIn(500);
	$('#errorMsg p').hide();
	$('#errorMsg p').fadeIn(1500);
	*/
	
	$("#product-listing li .img-prod img").hover(
		function () {
			$($(this).parent().find('.large').get(0)).show();
		}, 
		function () {
			$($(this).parent().find('.large').get(0)).hide();
		}
	);
	
	imagePreview();
	
	$("#product-listing .img-prod a").click(function(){
		return false;
	});
	
	$('.close-message').click(function(){
		$('.successMsg').fadeOut(700);
		return false;
	});
});

