/*
 * Tooltip and 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/1620/image-preview
 *
 */
 

xOffset = 10;
yOffset = 10;

this.imagePreview = function(){	
	$("img.imagePreview").hover(function(e){		
		$("body").append("<div id='image_hover' style='background-image:url(" + this.src + ");'></div>");
		$("#image_hover")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		$("#image_hover").remove();
    });	
};


this.tooltip = function(){	
	$("span.tooltip").hover(function(e){		
		$("body").append("<div id='tooltip_hover' class='" + this.title + "'></div>");
		$("#tooltip_hover")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		$("#tooltip_hover").remove();
    });	
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
	imagePreview();
});
