/*
 * 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 = -20; /*parametro modificato successivamente in base al codice*/
		yOffset = -240;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	
	
	$("a.preview").hover(function(e){
		this.n = this.name;
		this.t = this.title;
		this.i = this.rel;
		//xOffset = this.i;
		xOffset = -20;
		this.name = "";	
		this.title = "";
		this.tabindex = "";
		var boxtitolo = "<div id='boxtitolo'>" + this.t + "</div>";
		var boxtesto = "<div id='boxtesto'>" + boxtitolo + this.n + "</div><div id='boxclear'></div>"
		
		//alert(boxtesto);
		
		$("body").append("<div id='preview'><div class='left'><img src='images/band/"+ this.id +"' alt='Dettagli Band' /></div>"+ boxtesto +"</div>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;
		this.name = this.n;	
		this.rel = this.i;	
		$("#preview").remove();
    });	
	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


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



$(document).ready(function(){
	
	//fade thumb images
	$('#bandthumb img').hover(function() {
		$(this).fadeTo("slow", 0.5);
	}, function() {
		$(this).fadeTo("slow", 1);
		//$(this).css("margin", "0px");
	});
	
	/*$('#bandthumb li').hover(function() {
		$(this).css("background-color", "#9ad020");
	}, function() {
		$(this).css("background-color", "#666");
	});*/
	
}); //close doc ready



