// JavaScript Document
this.zoomPreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		styleBg = 'url(/img/fd_zoom.png) no-repeat';
		
	/* END CONFIG */
	$("a.zoom-preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='zoom-preview'><img src='"+ this.rel +"' alt='zoom' />"+ c +"</p>");									
		if (jQuery.browser.msie){
			if(parseInt(jQuery.browser.version, 10) > 6){
				// IE7 + 
				$("#zoom-preview")
					.css("top",(e.pageY - xOffset) + "px")
					.css("left",(e.pageX + yOffset) + "px")
					.fadeIn("fast",function(){$("#zoom-preview").css("background", styleBg);});
			}
			else{
				// IE6
				$("#zoom-preview")
					.css("top",(e.pageY - xOffset) + "px")
					.css("left",(e.pageX + yOffset) + "px")
					.fadeIn("fast");			
			}
		}
		else{
				// standard browsers
				$("#zoom-preview")
					.css("background", styleBg)
					.css("top",(e.pageY - xOffset) + "px")
					.css("left",(e.pageX + yOffset) + "px")
					.fadeIn("fast");			
		}
    },
	function(){
		this.title = this.t;
		$("#zoom-preview").css("background", "none");
		$("#zoom-preview").remove();
    });	
	$("a.zoom-preview").mousemove(function(e){
		$("#zoom-preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

// starting the script on page load
$(document).ready(function(){
	zoomPreview();
});