 $(document).ready(function(){  	
  
 	$("img.rollOver").mouseover(function (){this.src = this.src.replace("_0","_1");});
	$("img.rollOver").mouseout(function (){this.src = this.src.replace("_1","_0");});
	
	//$(".btOver").mouseover(function (){img = this.getElementsByTagName('img');img[0].src = img[0].src.replace("_0","_1");});
	//$(".btOver").mouseout(function (){img = this.getElementsByTagName('img');img[0].src = img[0].src.replace("_1","_0");});
	
	//$(".btSottomenuOver").mouseover(function (){img = this.getElementsByTagName('img');img[0].src = img[0].src.replace("_0","_1");});
	//$(".btSottomenuOver").mouseout(function (){img = this.getElementsByTagName('img');img[0].src = img[0].src.replace("_1","_0");});
	
 
 });
 

jQuery.preloadImages = function(){

  for(var i = 0; i<arguments.length; i++){
    jQuery("<img>").attr("src", arguments[i]);
  }

}

function animazione_entrata(idDiv, idNext){
	
	if (i<(entrata.length-1)) {
		$("#" + idDiv).animate({"left": "-=20px", "opacity": "show"}, 250, function(){ i++; animazione_entrata(entrata[i][0], entrata[i][1]); });
	}
	else $("#" + idDiv).animate({"left": "-=20px", "opacity": "show"}, 250);
	
}

function entrata_1(idDiv){
	
	$("#" + idDiv).animate({"left": "-=20px", "opacity": "show"}, 500);
	
}

function entrata_template1(){
	
	a = setInterval(function() { $("#sfondoMenu").animate({"opacity": "show"}, 500); clearInterval(a)}, 200);
	
	f = setInterval(function() { $("#right").animate({"opacity": "show"}, 500, function(){ $('.scroll-pane').jScrollPane({scrollbarMargin: 10}); }); clearInterval(f)}, 200);
	
	c = setInterval(function() { $("#titoloImg").animate({"opacity": "show"}, 500); clearInterval(c)}, 400);
	b = setInterval(function() { $("#up").animate({"opacity": "show"}, 500); clearInterval(b)}, 500);
	d = setInterval(function() { $("#down").animate({"opacity": "show"}, 500); clearInterval(d)}, 600);
	e = setInterval(function() { $("#menu").show("slow"); clearInterval(e)}, 900);
	
}

function entrata_template1NoScroll(){
	
	a = setInterval(function() { $("#sfondoMenu").animate({"opacity": "show"}, 500); clearInterval(a)}, 200);
	
	f = setInterval(function() { $("#right").animate({"opacity": "show"}, 500); clearInterval(f)}, 200);
	
	c = setInterval(function() { $("#titoloImg").animate({"opacity": "show"}, 500); clearInterval(c)}, 400);
	b = setInterval(function() { $("#up").animate({"opacity": "show"}, 500); clearInterval(b)}, 500);
	d = setInterval(function() { $("#down").animate({"opacity": "show"}, 500); clearInterval(d)}, 600);
	e = setInterval(function() { $("#menu").show("slow"); clearInterval(e)}, 900);
	
}

function entrata_template2(){
	
	a = setInterval(function() { $("#sfondoMenu").animate({"opacity": "show"}, 500); clearInterval(a)}, 200);
	f = setInterval(function() { $("#right").animate({"opacity": "show"}, 500, function(){ $('.scroll-pane').jScrollPane(); }); clearInterval(f)}, 200);
	e = setInterval(function() { $("#menu").show("slow"); clearInterval(e)}, 500);
	
}

function gotoPge(page, idDiv, offSet){
	
	for (i=1; i<=(nPag+1); i++){
		if ((i-1)==page) $("#page_" + i).html('[' + i + ']');
		else $("#page_" + i).html(i);
	}
	
	if (page == 0) $("#leftF").hide();
	else $("#leftF").show();
	
	if (page == (nPag -1 )) $("#rightF").hide();
	else $("#rightF").show();
	
	gotoX = -page * offSet;
	
	$("#" + idDiv).animate({"left": gotoX + "px"}, 500, "swing");
	
}