/*
 * 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(){	
	// 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
		
		moved = false;
		
	// END CONFIG
		
		
	$("a.preview").click(function(){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		var ml = $('body').css('margin-left');
		var offset = parseInt($('body').css('margin-left').replace('px', ''));
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
		    //.text('woah!')
            .css("z-index","200")
			.css("top", $(window).scrollTop() + 100 +'px')
			.css("left","410px")
			.fadeIn("slow")
			.click(function(){moved=false;$('#preview').remove();})


    });
/*	function(){
		this.title = this.t;	
		if(!saved)$("#preview").fadeOut(20,function(){$("#preview").remove();}); 
    });	*/
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("left","410px");
	});
	$("a.preview").click(function(){return false;});
	
};




