// starting the script on page load
$(document).ready(function(){
	/**
	* Image preview script
	**/
	imagePreview();

});


/**
* Image preview script 
* powered by jQuery (http://www.jquery.com)
* written by Alen Grakalic (http://cssglobe.com)
* for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
**/
this.imagePreview = function(){	

			// these 2 variable determine popup's distance from the cursor
			// you might want to adjust to get the right result
			xOffset = 30;
			yOffset = 15;
		
	$("a.preview").hover(function(e){
		/* CONFIG */




		/* END CONFIG */
		this.t = this.title;
		this.title = "";
		yOffset = (this.rel != "") ? this.rel : yOffset;
		var c = (this.t != "") ? this.t + "<br/>" : "";
		if($.browser.msie) { $("body table tr td select").css("visibility","hidden"); }
		$("body").append("<p id='preview'>"+ c +"<img src='"+ this.href +"' alt='Image preview' /></p>");								 
		if($.browser.msie) {
			yOffset = yOffset + 185;
			$("#preview")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast");
			yOffset = yOffset - 185;
		}
		else { 
			$("#preview")
				.css("top", yOffset + "%")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast");
		}
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
		if($.browser.msie) { $("body table tr td select").css("visibility","visible"); }
    });
	$("a.preview").mousemove(function(e){
		if($.browser.msie) {
			yOffset = yOffset + 185;
			$("#preview")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast");
			yOffset = yOffset - 185;
		}
		else {
			$("#preview")
				.css("top", yOffset + "%")
				.css("left",(e.pageX + xOffset) + "px")
		}
	});			
};
