/*****************************************\
| funzioni per versione v5  -  13-06-2007 |  25-06-08 - agg.30-06-08
\*****************************************/



var posi = 0;
var l = "", rf;

var imgsfondo, numfoto;

//var imgmenu = parent.document.images;
//var imgbottoni = parent.document.images;
var imgbottoni = parent.document;

var tempogiro

function dove(cosa) {
	percorso = new String(document.URL);
	//alert(percorso);
	lung = percorso.length;
	var c = 0;
	if (percorso.lastIndexOf("/it/") != -1) {
		c = percorso.lastIndexOf("/it/");
		l = "/it/";
	}
	if (percorso.lastIndexOf("/en/") != -1) {
		c = percorso.lastIndexOf("/en/");
		l = "/en/";
	}
	if (percorso.lastIndexOf("/es/") != -1) {
		c = percorso.lastIndexOf("/es/");
		l = "/es/";
	}
	if (c == 0) {
		parte = percorso.lastIndexOf("/"); //cerca l'ultima barra
		primaparte = percorso.substring(0,parte); //tutto tranne il nome di questo documento
		pagina = percorso.substring(parte,lung); //solo il nome di questo documento
		
		//alert("c = 0 : tutto meno nome doc");
	} else {
		if (posi != 0) {
			primaparte = percorso.substring(0,posi);
			//alert("posi != 0 : posi=\n" + posi);
		} else {
			primaparte = percorso.substring(0,c);
			//primaparte = percorso.lastIndexOf(0,c);
			//alert("nelle cartelle, da 0 a c: "+c);
			pagina = percorso.substring(c,lung); //solo il nome di questo documento
		}
		//ultima = percorso.substring(c,lung); //ultima parte meno la cartella percorso
		//alert("si trova nella cartelle IT \n>" + c + "\n\n>" + primaparte); // + "\n\n>>" + ultima
		//alert("percorso:\n" +percorso+ "\n\n pos it: " +c+ "\n\n posi= " + posi + "\n\n>" + primaparte);
	}
	
	if (cosa == "pagina") {
		return pagina;
	} else {
		return primaparte;
	}
}






function sopra() {
	var sopra, fascione, seiqui, apriPagina;
		//try {
	sopra = new String(window.parent.location);
	//fascione = sopra.lastIndexOf("index.");
	fascione = (sopra.substring(sopra.length-1) != "/") ? sopra.lastIndexOf("index.") : sopra.lastIndexOf("/");
	if (fascione == -1) {
		seiqui = dove("cartella"); //cartella del sito
		apriPagina = dove("pagina"); //pagina da far aprire
		
		if (window.parent.location.protocol == "file:") {
			window.parent.location = seiqui + "/index.html?pag=" + apriPagina;	//IN LOCALE
		} else {
			//SUL SERVER
			stats(296986); //phpTrafficA reminder
			var rf = document.referrer;
			if (rf.lastIndexOf("?") != -1) {
				dato = escape(rf + "&RF=" + history.length);
			} else {
				dato = escape(rf + "/RF" + history.length);
			}
			document.cookie = "provrf=" + dato + "; path=/";
			window.parent.location = seiqui + "/index.php?pag=" + apriPagina;	
		}	
	}
		//} catch(err) {
		//	alert("Errore: " + err.description + "\n\n")
		//}
}
sopra();



function strisciaBottoni(im,mappa) {
	f=parent.document.forms;
	rif = f[0].pag.value;
	if (rif != im + l) {
		ind = dove("cartella");
		//alert("ind:\n" + ind);
		//imgbottoni = parent.document.images;
		
		//imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
		if (mappa == "") {
			imgbottoni.getElementById("pulsanti").useMap = "";
		} else {
			sigla = l.substring(1, 3);
			imgbottoni.getElementById("pulsanti").useMap = mappa + "_" + sigla;
		}
		
		f[0].pag.value = im + l;
		
		switch (im) {
			case "Benvenuti" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Location" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Location.jpg";
				break;
			case "Residences" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/THULE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Hotel" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/NIGRITELLA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Scuolasci" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SCUOLASCI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
		    case "Scuolasci_home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SCUOLASCI_HOME.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Vertical" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/VERTICALSKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Verticalski.jpg";
				break;
			case "Flora" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/FLORA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Gastronomia" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GASTRONOMIA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Gastronomia.jpg";
				break;
			case "Staulanza" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/STAULANZA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Vfuoco" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/Vfuoco.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Vfuoco.jpg";
				break;
			case "Ginepro" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GINEPRO.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Home.jpg";
				break;
			case "Salander" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SALANDER.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Belvedere" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/BELVEDERE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Aquileia" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/AQUILEIA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Aquileia.jpg";
				break;
			case "Ladinia" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNILADINIA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_Ladinia.jpg";
				break;
			case "Fertazza" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/FERTAZZA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Fertazza.jpg";
				break;	
			case "August" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/AUGUST.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Estate.jpg";
				break;	
			case "Alloggiare" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Benvenuti.jpg";
				break;	
			case "Ongaro" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNIONGARO.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_Ongaro.jpg";
				break;
			case "Servizi" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Fedare" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/FEDARE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Fedare_Home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/FEDARE_HOME.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/" + im + ".jpg";
				break;
			case "Camping" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/CAMPING.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Camping.jpg";
				break;
			case "Taxi" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/TAXI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Taxi.jpg";
				break;
			case "Guide" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GUIDE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Guide.jpg";
				break;
			case "Skiservice" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SKISERVICE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Skiservice.jpg";
				break;
			case "Barbianco" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/BARBIANCO.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Barbianco.jpg";
				break;
			case "Fondo" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/FONDO.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Fondo.jpg";
				break;
			case "Orizzonti" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Benvenuti.jpg";
				break;
			case "LaStua" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNILASTUA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_LaStua.jpg";
				break;
			case "Barance" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNIBARANCE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_Barance.jpg";
				break;
			case "Rondine" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNILARONDINE.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_LaRondine.jpg";
				break;
			case "Apt_Aquileia" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/APT_AQUILEIA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Apt_Aquileia.jpg";
				break;
			case "Rosalpina" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/APT_ROSALPINA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Apt_Rosalpina.jpg";
				break;
			case "Apt_Cristal" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/CRISTAL.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Apt_Cristal.jpg";
				break;
			case "Giau" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GIAU.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Giau.jpg";
				break;
			case "Giau_int" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GIAU_INT.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Giau_int.jpg";
				break;
		    case "Giau_home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GIAU_HOME.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Giau_home.jpg";
				break;
			case "Garni_Civetta" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/GARNICIVETTA.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Garni_Civetta.jpg";
				break;
			case "Agenzia_Valfiorentina_Est" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/AGENZIA_VALFIORENTINA_EST.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Agenzia_Valfiorentina_Est.jpg";
				break;
			case "Agenzia_Valfiorentina_Inv" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/AGENZIA_VALFIORENTINA_INV.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Agenzia_Valfiorentina_Inv.jpg";
				break;
			case "Cavalli" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ZOLDOMOUNTAINS.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Zoldomountains.jpg";
				break;
			case "Valpiccola_Home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/VALPICCOLA_HOME.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Valpiccola_Home.jpg";
				break;
			case "Valpiccola" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/VALPICCOLA.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Valpiccola.jpg";
				break;
			case "Scuolasci_Civetta" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SCUOLASCI_CIVETTA_HOME.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Scuolasci_Civetta.jpg";
				break;
			case "Valgranda_home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/VALGRANDA_HOME.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Valgranda_home.jpg";
				break;
			case "Valgranda" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/VALGRANDA.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Valgranda.jpg";
				break;
			case "Corona_home" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/CORONA_HOME.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Corona_home.jpg";
				break;
			case "Corona" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/CORONA.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Corona.jpg";
				break;
			case "De_Michiel" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/DE_MICHIEL.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/De_Michiel.jpg";
				break;
			case "Sciovie_Santa_Fosca" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/SCIOVIE_SANTA_FOSCA.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Sciovie_Santa_Fosca.jpg";
				break;
			case "Beta" :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/BETA/ISKI.jpg";
			    imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/BETA/Benvenuti.jpg";
				break;
	
			
			default :
				imgbottoni.getElementById("fascione").src = ind + "/Immagini/corniceLegno/ISKI.jpg";
				imgbottoni.getElementById("pulsanti").src = ind + l + "pulsanti/Home.jpg";
		}
	}
}


function sottofondo(cartella,musica) {
	if (musica != "nessuno") {
		musicainplay = parent.document.getElementById("ctrlmusica").src;
		if (musicainplay.search("silenzio") != -1)
		parent.document.getElementById("ctrlmusica").src = "Musica/" + cartella + "/" + musica + ".html";
		parent.document.getElementById("musica").style.visibility = "visible";
	} else {
		parent.document.getElementById("musica").style.visibility = "hidden";
		parent.document.getElementById("ctrlmusica").src = "Musica/silenzio.html";
	}
}


function cambiaMenu(quale) {
	//
	parent.document.getElementById("visbanner").style.visibility="visible";
	switch (quale) {
		case "Benvenuti" :
			strisciaBottoni(quale,"#benvenuti");
			sottofondo(quale,"nessuno");
			break;
		case "Residences" :
			strisciaBottoni(quale,"#residence");
			sottofondo(quale,"nessuno");
			parent.document.getElementById("visbanner").style.visibility="hidden";
			break;
		case "Hotel" :
			strisciaBottoni(quale,"#hotel");
			sottofondo(quale,"nessuno");
			break;
		case "Scuolasci" :
			strisciaBottoni(quale,"#scuolasci");
			sottofondo(quale,"nessuno");
			break;
		case "Scuolasci_home" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Inverno" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Estate" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Apreski" :
			strisciaBottoni("Inverno","#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Offerte" :
			strisciaBottoni("Home","#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Dovesiamo" :
			strisciaBottoni("Home","#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Location" :
			strisciaBottoni(quale,"#location");
			sottofondo(quale,"nessuno");
			break;
		case "Home" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Vertical" :
			strisciaBottoni(quale,"#Verticalski");
			sottofondo(quale,"nessuno");
			break;
		case "Guide" :
			strisciaBottoni(quale,"#guide");
			sottofondo(quale,"nessuno");
			break;
		case "Salander" :
			strisciaBottoni(quale,"#salander");
			sottofondo(quale,"nessuno");
			break;
		case "Skitest" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Skicivetta" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;	
		case "Fondo" :
			strisciaBottoni(quale,"#fondo");
			sottofondo(quale,"nessuno");
			break;
		case "Flora" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Gastronomia" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Staulanza" :
			strisciaBottoni(quale,"#Staulanza");
			sottofondo(quale,"nessuno");
			break;
		case "Vfuoco" :
			strisciaBottoni(quale,"#Vfuoco");
			sottofondo(quale,"nessuno");
			break;
		case "Ginepro" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Belvedere" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"Fisarmonica");
			break;
		case "Aquileia" :
			strisciaBottoni(quale,"#Aquileia");
			sottofondo(quale,"nessuno");
			break;
		case "Ladinia" :
			strisciaBottoni(quale,"#Garni_Ladinia");
			sottofondo(quale,"nessuno");
			break;
		case "Fertazza" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;	
		case "August" :
			strisciaBottoni(quale,"#August");
			sottofondo(quale,"nessuno");
			break;	
		case "Alloggiare" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Ongaro" :
			strisciaBottoni(quale,"#Garni_Ongaro");
			sottofondo(quale,"nessuno");
			break;
		case "Servizi" :
			strisciaBottoni(quale,"#Servizi");
			sottofondo(quale,"nessuno");
			break;
		case "Fedare" :
			strisciaBottoni(quale,"#Fedare");
			sottofondo(quale,"nessuno");
			break;
		case "Fedare_Home" :
			strisciaBottoni(quale,"#Fedare");
			sottofondo(quale,"nessuno");
			break;
		case "Camping" :
			strisciaBottoni(quale,"#Camping");
			sottofondo(quale,"nessuno");
			break;
		case "Taxi" :
			strisciaBottoni(quale,"#Taxi");
			sottofondo(quale,"nessuno");
			break;
		case "Guide" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Skiservice" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Barbianco" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Orizzonti" :
			strisciaBottoni(quale,"#benvenuti");
			sottofondo(quale,"nessuno");
			break;
		case "LaStua" :
			strisciaBottoni(quale,"#Garni_LaStua");
			sottofondo(quale,"nessuno");
			break;
		case "Barance" :
			strisciaBottoni(quale,"#Garni_Barance");
			sottofondo(quale,"nessuno");
			break;
		case "Rondine" :
			strisciaBottoni(quale,"#Garni_LaRondine");
			sottofondo(quale,"nessuno");
			break;
		case "Apt_Aquileia" :
			strisciaBottoni(quale,"#Apt_Aquileia");
			sottofondo(quale,"nessuno");
			break;
		case "Rosalpina" :
			strisciaBottoni(quale,"#Apt_Rosalpina");
			sottofondo(quale,"nessuno");
			break;
		case "Apt_Cristal" :
			strisciaBottoni(quale,"#Apt_Cristal");
			sottofondo(quale,"nessuno");
			break;
	    case "Giau" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Giau_int" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Giau_home" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Garni_Civetta" :
			strisciaBottoni(quale,"#Garni_Civetta");
			sottofondo(quale,"nessuno");
			break;
		case "Agenzia_Valfiorentina_Est" :
			strisciaBottoni(quale,"#Agenzia_Valfiorentina");
			sottofondo(quale,"nessuno");
			break;
		case "Agenzia_Valfiorentina_Inv" :
			strisciaBottoni(quale,"#Agenzia_Valfiorentina");
			sottofondo(quale,"nessuno");
			break;
		case "Cavalli" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			break;
		case "Valpiccola_Home" :
			strisciaBottoni(quale,"#homebase");
			sottofondo(quale,"nessuno");
			parent.document.getElementById("visbanner").style.visibility="hidden";
			break;
		case "Valpiccola" :
			strisciaBottoni(quale,"#Valpiccola");
			sottofondo(quale,"nessuno");
			parent.document.getElementById("visbanner").style.visibility="hidden";
			break;
		case "Scuolasci_Civetta" :
			strisciaBottoni(quale,"#Scuolasci_Civetta");
			sottofondo(quale,"nessuno");
			break;
		case "Valgranda_home" :
			strisciaBottoni(quale,"#Valgranda_home");
			sottofondo(quale,"nessuno");
			break;
		case "Valgranda" :
			strisciaBottoni(quale,"#Valgranda");
			sottofondo(quale,"nessuno");
			break;
		case "Corona_home" :
			strisciaBottoni(quale,"#Corona_home");
			sottofondo(quale,"nessuno");
			break;
		case "Corona" :
			strisciaBottoni(quale,"#Corona");
			sottofondo(quale,"nessuno");
			break;
		case "De_Michiel" :
			strisciaBottoni(quale,"#De_Michiel");
			sottofondo(quale,"nessuno");
			break;
		case "Sciovie_Santa_Fosca" :
			strisciaBottoni(quale,"#Sciovie_Santa_Fosca");
			sottofondo(quale,"nessuno");
			break;
		default : 
			strisciaBottoni("Home","#homebase");
			//parent.document.images['bf'].src = "Immagini/mappa.gif";
	} 
}


function cartellaImmagini() {
	ind_img = new String(document.images[0].src);
	//l_ind = ind_img.length;
	posCartella = ind_img.lastIndexOf("/Immagini/");
	cartella = ind_img.substring(0,posCartella+10);
	return cartella;
}






//******************************************************************************************************
// IXF1.11 :: Image cross-fade 
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
//******************************************************
//global object
var ixf = { 'clock' : null, 'count' : 1 }
/*******************************************************



/*****************************************************************************
 List the images that need to be cached
*****************************************************************************/
/*
var nFotoSfondo = 2;//SuccessivaFotoSfondo();
ixf.imgs = [
	nFotoSfondo,
	nFotoSfondo+1,
	nFotoSfondo+2
	];
*/
//ixf.imgs = ['/Immagini/sfondi/Info/Infoit1.jpg'];

/*****************************************************************************
*****************************************************************************/


/*
//cache the images
ixf.imgsLen = ixf.imgs.length;
ixf.cache = [];
for(var i=0; i<ixf.imgsLen; i++)
{
	ixf.cache[i] = new Image;
	ixf.cache[i].src = ixf.imgs[i];
}
*/

//crossfade setup function
function crossfade()
{
	//if the timer is not already going
	if(ixf.clock == null)
	{
		//copy the image object 
		ixf.obj = arguments[0];
		
		//copy the image src argument 
		ixf.src = arguments[1];
		
		//store the supported form of opacity
		if(typeof ixf.obj.style.opacity != 'undefined')
		{
			ixf.type = 'w3c';
		}
		else if(typeof ixf.obj.style.MozOpacity != 'undefined')
		{
			ixf.type = 'moz';
		}
		else if(typeof ixf.obj.style.KhtmlOpacity != 'undefined')
		{
			ixf.type = 'khtml';
		}
		else if(typeof ixf.obj.filters == 'object')
		{
			//weed out win/ie5.0 by testing the length of the filters collection (where filters is an object with no data)
			//then weed out mac/ie5 by testing first the existence of the alpha object (to prevent errors in win/ie5.0)
			//then the returned value type, which should be a number, but in mac/ie5 is an empty string
			ixf.type = (ixf.obj.filters.length > 0 && typeof ixf.obj.filters.alpha == 'object' && typeof ixf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		}
		else
		{
			ixf.type = 'none';
		}
		
		//change the image alt text if defined
		if(typeof arguments[3] != 'undefined' && arguments[3] != '')
		{
			ixf.obj.alt = arguments[3];
		}
		
		//if any kind of opacity is supported
		if(ixf.type != 'none')
		{
			//create a new image object and append it to body
			//detecting support for namespaced element creation, in case we're in the XML DOM
			ixf.newimg = document.getElementsByTagName('body')[0].appendChild((typeof document.createElementNS != 'undefined') ? document.createElementNS('http://www.w3.org/1999/xhtml', 'img') : document.createElement('img'));

			//set positioning classname
			ixf.newimg.className = 'idupe';
			
			//set src to new image src
			ixf.newimg.src = ixf.src

			//move it to superimpose original image
			ixf.newimg.style.left = ixf.getRealPosition(ixf.obj, 'x') + 'px';
			ixf.newimg.style.top = ixf.getRealPosition(ixf.obj, 'y') + 'px';
			
			//copy and convert fade duration argument 
			ixf.length = parseInt(arguments[2], 10) * 1000;
			
			//create fade resolution argument as 20 steps per transition
			ixf.resolution = parseInt(arguments[2], 10) * 20;
			
			//start the timer
			ixf.clock = setInterval('ixf.crossfade()', ixf.length/ixf.resolution);
		}
		
		//otherwise if opacity is not supported
		else
		{
			//just do the image swap
			ixf.obj.src = ixf.src;
		}
		
	}
};


//crossfade timer function
ixf.crossfade = function()
{
	//decrease the counter on a linear scale
	ixf.count -= (1 / ixf.resolution);
	
	//if the counter has reached the bottom
	if(ixf.count < (1 / ixf.resolution))
	{
		//clear the timer
		clearInterval(ixf.clock);
		ixf.clock = null;
		
		//reset the counter
		ixf.count = 1;
		
		//set the original image to the src of the new image
		ixf.obj.src = ixf.src;
	}
	
	//set new opacity value on both elements
	//using whatever method is supported
	switch(ixf.type)
	{
		case 'ie' :
			ixf.obj.filters.alpha.opacity = ixf.count * 100;
			ixf.newimg.filters.alpha.opacity = (1 - ixf.count) * 100;
			break;
			
		case 'khtml' :
			ixf.obj.style.KhtmlOpacity = ixf.count;
			ixf.newimg.style.KhtmlOpacity = (1 - ixf.count);
			break;
			
		case 'moz' : 
			//restrict max opacity to prevent a visual popping effect in firefox
			ixf.obj.style.MozOpacity = (ixf.count == 1 ? 0.9999999 : ixf.count);
			ixf.newimg.style.MozOpacity = (1 - ixf.count);
			break;
			
		default : 
			//restrict max opacity to prevent a visual popping effect in firefox
			ixf.obj.style.opacity = (ixf.count == 1 ? 0.9999999 : ixf.count);
			ixf.newimg.style.opacity = (1 - ixf.count);
	}
	
	//now that we've gone through one fade iteration 
	//we can show the image that's fading in
	ixf.newimg.style.visibility = 'visible';
	
	//keep new image in position with original image
	//in case text size changes mid transition or something
	ixf.newimg.style.left = ixf.getRealPosition(ixf.obj, 'x') + 'px';
	ixf.newimg.style.top = ixf.getRealPosition(ixf.obj, 'y') + 'px';
	
	//if the counter is at the top, which is just after the timer has finished
	if(ixf.count == 1)
	{
		//remove the duplicate image
		ixf.newimg.parentNode.removeChild(ixf.newimg);
	}
};



//get real position method
ixf.getRealPosition = function()
{
	this.pos = (arguments[1] == 'x') ? arguments[0].offsetLeft : arguments[0].offsetTop;
	this.tmp = arguments[0].offsetParent;
	while(this.tmp != null)
	{
		this.pos += (arguments[1] == 'x') ? this.tmp.offsetLeft : this.tmp.offsetTop;
		this.tmp = this.tmp.offsetParent;
	}
	
	return this.pos;
};
//******************************************************************************************************





function SuccessivaFotoSfondo() {
	imgsfondo = parent.document.getElementById("imgsfondo").value;
	numfoto = parseInt(parent.document.getElementById("numfoto").value);
	urlimg = imgsfondo.substring(0,imgsfondo.lastIndexOf(";"));
	numero = parseInt(imgsfondo.substring(imgsfondo.lastIndexOf(";")+1,imgsfondo.length));
	nrimg = (numfoto == numero) ? 1 : numfoto+1;
	parent.document.getElementById("numfoto").value = nrimg;
	return (urlimg + nrimg + ".jpg");
}

function girafoto() {
	var fotosuccessiva = SuccessivaFotoSfondo();
	crossfade(document.getElementById('fsfondo'), fotosuccessiva, '4', 'ciao')
	tempogiro = setTimeout("girafoto()",10000);
}

function fotoSfondo(nome,numero) {
	pimg = cartellaImmagini();
	var nrimg = -10;
	if (numero > 0) {
		while (nrimg <= 0) {
			nrcs = Math.random();
			nrimg = Math.round(nrcs * numero);
		}
		click = (numero == 1) ? 'usemap="#Sfondo"' : 'onClick="altrafoto()" title="click per vedere un\'altra foto\nclick to view more photos"';
		document.write('<img id="fsfondo" name="fsfondo" src="' + pimg + 'sfondi/' + nome + nrimg + '.jpg" border="0" '+ click +'>'); //alt="foto ' + nome + nrimg +'..."
		//
		parent.document.getElementById("imgsfondo").value = pimg + "sfondi/" + nome + ";" + numero;
		parent.document.getElementById("numfoto").value = nrimg;
		//document.forms[0].nomefoto.value = nome;
		//document.forms[0].numerofoto.value = numero;
		var attesainiz = (numero == 1) ? '' : setTimeout("girafoto()",6000);
	} else {
		document.write('<img id="fsfondo" name="fsfondo" src="' + pimg + 'sfondi/' + nome + '.jpg" usemap="#Sfondo" border="0">'); //' + mappa + '>'); //alt="foto ' + nome + '..."
		//width="791" height="333"
	}
	
	if (window.parent.location.protocol == "http:") {
		//per thule
		//document.writeln('<br><img src="http://stat.superstat.info/spider.php?u=9954" width="1" height="1"> <script type="text/javascript" language="JavaScript"  src="http://stat.superstat.info/counter.php?user=9954"> <\/script>');
		
		document.writeln('<script language="javascript" type="text/javascript">\n<!-- \nstats(296986); \n//-->\n</script>');
		
		document.writeln('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">\n</script>\n<script type="text/javascript">\n_uacct = "UA-1134947-1";\nurchinTracker();\n</script>');
	}
}


function attesaCaricamento(n) {
	if (n == 1) {
		parent.document.getElementById("caricaFoto").style.visibility = "visible";
	} else {
		parent.document.getElementById("caricaFoto").style.visibility = "hidden";
	}
}

function altrafoto() {
	attesaCaricamento(1);
	clearTimeout(tempogiro);
	imgsfondo = parent.document.getElementById("imgsfondo").value;
	numfoto = parseInt(parent.document.getElementById("numfoto").value);
	urlimg = imgsfondo.substring(0,imgsfondo.lastIndexOf(";"));
	numero = parseInt(imgsfondo.substring(imgsfondo.lastIndexOf(";")+1,imgsfondo.length));
	
	nrimg = (numfoto == numero) ? 1 : numfoto+1;
	parent.document.getElementById("numfoto").value = nrimg;
	//document.getElementById("fsfondo").src = urlimg + nrimg + ".jpg";
	

	var successiva = urlimg + nrimg + ".jpg";
	crossfade(document.getElementById('fsfondo'), successiva, '4', 'iSki')
	
	var t = setTimeout("attesaCaricamento(0)",4000);
	//window.location.reload();
	//alert(document.getElementById("fsfondo").src);
}


function nuovaFinestra(pag) {
	winOpts ="menubar=yes,status=no,Toolbar=no,location=no,scrollbars=yes,resizable=yes,width=650,height=500";
        window.open(pag,"documento",winOpts);
}

function mostra(n_info) {
	document.getElementById(n_info).style.visibility = "visible";
}


function nascondi(n_info) {
	document.getElementById(n_info).style.visibility = "hidden";
}


function apriPagina(linkpag) {
	window.open(linkpag, "nuovafinestra", "status=no,toolbar=yes,location=no,directories=no,resizable=yes,scrollbars=yes,menubar=no,height=550,width=744");
	
}





/*
function cambia(lingua) {
	percorso = new String(fr.document.URL);
	alert("TEST> " + percorso)
	
	lung = percorso.length;
	var l = 0;
	if (percorso.search("/it/") != -1) l = percorso.search("/it/");
	if (percorso.search("/en/") != -1) l = percorso.search("/en/");
	if (percorso.search("/es/") != -1) l = percorso.search("/es/");
	primaparte = percorso.substring(0,l+1);
	pag = percorso.substring(l+3,lung);
	
	imgmenu[1].src = primaparte + lingua + "/pulsanti/menu_" + lingua + ".jpg";   //it/pulsanti/menu_it.jpg
	imgmenu[1].useMap = "#MENU" + lingua;
	parent.document.getElementById("pag").src = primaparte + lingua + pag;
	parent.document.getElementById("strisciapulsanti").src = primaparte + lingua + "/pulsanti_" + lingua + ".html";
	//imgbottoni[00].useMap =
	
}



function aprimlist(paginaml) {
	window.open(paginaml, "mailinglist", "status=no,toolbar=no,location=no,directories=no,resizable=yes,scrollbars=yes,menubar=no,height=345,width=550");
	
}
*/




window.focus();





//parte per statistiche
/***************************************************************************
 phpTrafficA @soft.ZoneO.net
 Copyright (C) 2004-2007 ZoneO-soft, Butchu (email: "butchu" with the domain "zoneo.net")

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
****************************************************************************/

function encode64(inp){
var key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var chr1,chr2,chr3,enc3,enc4,i=0,out="";
while(i<inp.length){
chr1=inp.charCodeAt(i++);if(chr1>127) chr1=88;
chr2=inp.charCodeAt(i++);if(chr2>127) chr2=88;
chr3=inp.charCodeAt(i++);if(chr3>127) chr3=88;
if(isNaN(chr3)) {enc4=64;chr3=0;} else enc4=chr3&63
if(isNaN(chr2)) {enc3=64;chr2=0;} else enc3=((chr2<<2)|(chr3>>6))&63 
out+=key.charAt((chr1>>2)&63)+key.charAt(((chr1<<4)|(chr2>>4))&63)+key.charAt(enc3)+key.charAt(enc4);
}
return encodeURIComponent(out);
}

function stats(sid){
var referer=encode64(document.referrer);
var thispage=encode64(window.location.pathname+location.search);
var date=new Date()
var time=date.getTime();
document.writeln("<img src=\"http://icekey.it/statistiche/phpTrafficA-144/count.php?sid="+sid+"&p="+thispage+"&r="+referer+"&t="+time+"\" alt=\"\" border=\"0\" />\n");
}





