/*
VECCHIA PREVIEW!!
this.screenshotPreview = function(){	
	//xOffset = -20;
	//yOffset = -120;	

	$(".screenshot").hover(function(e){
		$("body").append("<p id='screenshot'><img src='"+ $(this).attr("rel") +"' alt='Anteprima immagine' /></p>");	
		$("#screenshot")
			.css("top",(getHScreen($("#screenshot img").attr("height"),e.pageY)) + "px")
			.css("left",(getWScreen($("#screenshot img").attr("width"),e.pageX)) + "px")
			.fadeIn("fast");
    },
	function(){
		$("#screenshot").remove();
    });	
	$(".screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(getHScreen($("#screenshot img").attr("height"),e.pageY)) + "px")
			.css("left",(getWScreen($("#screenshot img").attr("width"),e.pageX)) + "px")
	});			
};

function getHScreen(hei,curY)
{
	if ((curY+hei+30)>$(window).height())
		return curY-15+(hei*(-1));
	else
		return curY+15;
}

function getWScreen(wid,curX)
{
	if ((curX+wid+30)>$(window).width())
		return curX-15+(wid*(-1));
	else
		return curX+15;
}

$(document).ready(function(){
	screenshotPreview();
});
*/

if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPad/i))||(navigator.userAgent.match(/iPod/i)) || navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i))
{

}
else
{
	$(document).ready(function() {
		$(".screenshot").hover(function(e){
			$("body").append("<p id='screenshot'><img src='"+ $(this).attr("rel") +"' alt='Anteprima immagine' /></p>");
			var mousex = e.pageX + 20; //Get X coodrinates
			var mousey = e.pageY + 20; //Get Y coordinates
			var tipWidth = $("#screenshot").width(); //Find width of tooltip
			var tipHeight = $("#screenshot").height(); //Find height of tooltip
			var tipVisX = $(window).width() - (mousex + tipWidth);
			var tipVisY = $(window).height() - (mousey + tipHeight);
			if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
				mousex = e.pageX - tipWidth - 20;
			} if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
				mousey = e.pageY - tipHeight - 20;
			}
			$("#screenshot").css({  top: mousey, left: mousex });		
			$("#screenshot").fadeIn(600);
			
		}, function() {
			$("#screenshot").remove();
		}).mousemove(function(e) {
			var mousex = e.pageX + 20; //Get X coodrinates
			var mousey = e.pageY + 20; //Get Y coordinates
			var tipWidth = $("#screenshot").width(); //Find width of tooltip
			var tipHeight = $("#screenshot").height(); //Find height of tooltip
			var tipVisX = $(window).width() - (mousex + tipWidth);
			var tipVisY = $(window).height() - (mousey + tipHeight);
			if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
				mousex = e.pageX - tipWidth - 20;
			} if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
				mousey = e.pageY - tipHeight - 20;
			}
			$("#screenshot").css({  top: mousey, left: mousex });
		});
	});
	
	$(document).ready(function() {
		$(".screenshotTool").hover(function(e){
			$("body").append("<img border='0' id='screenshotTool' src='"+ $(this).attr("rel") +"' />");
			var mousex = e.pageX + 10; //Get X coodrinates
			var mousey = e.pageY + 10; //Get Y coordinates
			var tipWidth = $("#screenshotTool").width(); //Find width of tooltip
			var tipHeight = $("#screenshotTool").height(); //Find height of tooltip
			var tipVisX = $(window).width() - (mousex + tipWidth);
			var tipVisY = $(window).height() - (mousey + tipHeight);
			if ( tipVisX < 10 ) { //If tooltip exceeds the X coordinate of viewport
				mousex = e.pageX - tipWidth - 10;
			} if ( tipVisY < 10 ) { //If tooltip exceeds the Y coordinate of viewport
				mousey = e.pageY - tipHeight - 10;
			}
			$("#screenshotTool").css({  top: mousey, left: mousex });		
			$("#screenshotTool").fadeIn(600);
			
		}, function() {
			$("#screenshotTool").remove();
		}).mousemove(function(e) {
			var mousex = e.pageX + 10; //Get X coodrinates
			var mousey = e.pageY + 10; //Get Y coordinates
			var tipWidth = $("#screenshotTool").width(); //Find width of tooltip
			var tipHeight = $("#screenshotTool").height(); //Find height of tooltip
			var tipVisX = $(window).width() - (mousex + tipWidth);
			var tipVisY = $(window).height() - (mousey + tipHeight);
			if ( tipVisX < 10 ) { //If tooltip exceeds the X coordinate of viewport
				mousex = e.pageX - tipWidth - 10;
			} if ( tipVisY < 10 ) { //If tooltip exceeds the Y coordinate of viewport
				mousey = e.pageY - tipHeight - 10;
			}
			$("#screenshotTool").css({  top: mousey, left: mousex });
		});
	});}

