/*
 * Url 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.screenshotPreview = 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 */
	$("area%20shape.screenshot").hover(function(e){
    console.log( this.title  );
		this.t = this.title;
  	this.ii = this.rel;  //http://www.wiki.piwo.org/images/thumb/Slod.jpg/200px-Slod.jpg
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : ""; // "+ this.rel +"
     console.log( this.id  ); 
    if( this.id != "") 		$("body").append("<p id='screenshot' style='margin: 10px; width: 600px;'><img src=' "+ this.id +"' alt=' ' style='float: left; padding: 10px;'/><span style='text-align:left;'>"+ c +" </span></p>");
    else    	            $("body").append("<p id='screenshot' style='margin: 10px; width: 450px;'><span style='text-align:left; '>"+ c +" </span></p>");
     								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("area%20shape.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	screenshotPreview();
});
