var TitoloPagina = "Villaggio Ca\' Laguna";
var piedeSx = " Copyright 2004-2005 Villaggio Ca\' Laguna<br>Strada Provinciale per Monfalcone - 34073 Grado Gorizia Italy<br>Telefono 0431.877145, 339.7385679 - Fax. 0431. 1980190 - e-mail: <a href=\"mailto:info@calaguna.it\">info@calaguna.it</a><br>";
var piedeDx = " Project \"Ca' Laguna\"<br>Copyright 2004-2005 Team CARRUBE  ver 2.1<br>";
var profondita = 2;

function makeDatabase() {
	alberoMenu = new makeArray(25);		
	alberoMenu[0] = new Item('<A class="vocemenu" HREF="javascript:toggle(\'promozioni.htm\')" style="text-decoration: none">Promozioni / Buoni Vacanza</A>', 0, 'albero');
	alberoMenu[1] = new Item('Villaggio e foto', 5, 'albero');
	alberoMenu[2] = new Item('<A HREF="javascript:toggle(\'villette_Villaggio_Ca_Laguna_Grado.htm\')">Villette</A>', 0, 'voce');
	alberoMenu[3] = new Item('<A HREF="javascript:toggle(\'ristorante_Villaggio_Ca_Laguna_Grado.htm\')">Ristorante/Bar</A>', 0, 'voce');
	alberoMenu[4] = new Item('<A HREF="javascript:toggle(\'parcoacquatico_Villaggio_Ca_Laguna_Grado.htm\')">Parco Acquatico</A>', 0, 'voce');
	alberoMenu[5] = new Item('<A HREF="javascript:toggle(\'campisportivi_Villaggio_Ca_Laguna_Grado.htm\')">Campi sportivi</A>', 0, 'voce');
	alberoMenu[6] = new Item('<A HREF="javascript:toggle(\'areabimbi_Villaggio_Ca_Laguna_Grado.htm\')">Area Bimbi</A>', 0, 'voce');
	alberoMenu[7] = new Item('Animazione', 2, 'albero');
	alberoMenu[8] = new Item('<A HREF="javascript:toggle(\'inagurazione_Villaggio_Ca_Laguna_Grado.htm\')">Inaugurazione</A>', 0, 'voce');
	alberoMenu[9] = new Item('<A HREF="javascript:toggle(\'animazione_Villaggio_Ca_Laguna_Grado.htm\')">Servizio di animazione</A>', 0, 'voce');
	alberoMenu[10] = new Item('Prezzi', 4, 'albero');
	alberoMenu[11] = new Item('<A HREF="javascript:toggle(\'tipologiavillette_Villaggio_Ca_Laguna_Grado.htm\')">Villette</A>', 0, 'voce');
	alberoMenu[12] = new Item('<A HREF="javascript:toggle(\'ristoprezzi_Villaggio_Ca_Laguna_Grado.htm\')">Servizio di ristorazione</A>', 0, 'voce');
	alberoMenu[13] = new Item('<A HREF="javascript:toggle(\'ingressoparco_Villaggio_Ca_Laguna_Grado.htm\')">Parco acquatico</A></A>', 0, 'voce');
	alberoMenu[14] = new Item('<A HREF="javascript:toggle(\'optional_Villaggio_Ca_Laguna_Grado.htm\')">Optional</A>', 0, 'voce');
	alberoMenu[15] = new Item('Prenotazioni', 2, 'albero');
	alberoMenu[16] = new Item('<A HREF="javascript:toggle(\'contratti_Villaggio_Ca_Laguna_Grado.htm\')">Contratti/Condizioni</A>', 0, 'voce');
	alberoMenu[17] = new Item('<A HREF="javascript:toggle(\'prenota1.php\')">Prenota OnLine</A>', 0, 'voce');
	alberoMenu[18] = new Item('Informazioni', 5, 'albero');
	alberoMenu[19] = new Item('<A HREF="javascript:toggle(\'mappa_Villaggio_Ca_Laguna_Grado.htm\')">Come raggiungerci</A>', 0, 'voce');
	alberoMenu[20] = new Item('<A HREF="javascript:toggle(\'contatti_Villaggio_Ca_Laguna_Grado.htm\')">Contattaci</A>', 0, 'voce');
	alberoMenu[21] = new Item('<A HREF="javascript:toggle(\'volantini_Villaggio_Ca_Laguna_Grado.htm\')">Volantini e depliant</A>', 0, 'voce');
	alberoMenu[22] = new Item('<A HREF="javascript:toggle(\'staff.htm\')">Staff</A>', 0, 'voce');
	alberoMenu[23] = new Item('<A HREF="javascript:toggle(\'globus_Villaggio_Ca_Laguna_Grado.htm\')">Globus SCARL</A>', 0, 'voce');
	alberoMenu[24] = new Item('<A class="vocemenu" HREF="javascript:toggle(\'indexI.htm\')" style="text-decoration: none">Pagina iniziale</A>', 0, 'albero');
}

function Item(collegamento, numFigli, ident) {
        this.collegamento = collegamento;
        this.numFigli = numFigli;
        this.ident = ident;
}

function makeArray(length) {
        this.length = length;
}

function controllaResize() {
	
		exFrameWidth = frameWidth;
		exFrameHeight = frameHeight;
		dimensioni();
			
		if ((exFrameWidth != frameWidth) || (exFrameHeight != frameHeight)) toggle(indirizzo);

}

function checkcontained(e){

	cur=(ns6? e.target : event.srcElement);
	if (cur.id!="albero") cur=(ns6? cur.parentNode : cur.parentElement);
	
	if (cur.id=="albero"){
		var foldercontent=ns6? cur.nextSibling : cur.all.tags("UL")[0];
		if (foldercontent.style.display=="none"){
			foldercontent.style.display="list-item";
		}
		else{
			foldercontent.style.display="none";
		}
		if (cur.style.listStyleImage == "url(immagini/exploded.gif)") cur.style.listStyleImage = "url(immagini/collapsd.gif)";
		else if (cur.style.listStyleImage == "url(immagini/collapsd.gif)") cur.style.listStyleImage = "url(immagini/exploded.gif)";
	}	
		
}

function dimensioni()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth - 16;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return;
	
}

function leggi_sit_menu() {
	situazione = "0000000";	
	var inizio = indirizzo.indexOf('?');
	var fine = indirizzo.length;
	if (inizio != -1) situazione = indirizzo.substring(inizio + 1, fine);	
	if (inizio != -1) indirizzo = indirizzo.substring(0, inizio);	
}

function menuSetting(num) {

	if (opera) return 'list-item';
	return ((situazione.charAt(num) == '1')?'list-item':'none');		
		
}

function setStorage() {
	situazione = ""

    var cur = document.getElementsByTagName('LI');
    for (var i = 0; i < cur.length; i++) {
	    var foldercontent=ns6? cur[i].nextSibling : cur[i].all.tags("UL")[0];
		if (cur[i].id == 'albero') situazione += (foldercontent.style.display == 'none'?"0":"1");
	}
        
}

function toggle(collegamento) {
        if (!opera) setStorage();
        
        // reload page
        window.location.href = collegamento + "?" + situazione;
}

function caricaImmagine(num) {
	if (num==0) return 'immagini/news.gif';
	if (num==6) return 'immagini/home.gif';
	return ((situazione.charAt(num) == '1')?'immagini/exploded.gif':'immagini/collapsd.gif');
}

indirizzo = window.location.toString();
indirizzo = indirizzo.substring(indirizzo.lastIndexOf('/') + 1);

var ns6=document.getElementById&&!document.all;
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var opera = !(ie4||ns6);

if (!opera) document.onclick=checkcontained;

dimensioni();
controllaResize();
leggi_sit_menu();

eyeWidth = Math.max(frameWidth, 645);
spHeight = frameHeight + "px";

if (frameHeight > 485) {
	princHeight = (frameHeight - 200) + "px";
	menuHeight = (frameHeight - 220) + "px";	
	topFooterA = "top: " + (frameHeight - 136) + "px";
	topFooterB = "top: " + (frameHeight - 51) + "px";
	topFooterSx = "top: " + (frameHeight - 48) + "px";
	topFooterDx = "top: " + (frameHeight - 37) + "px";
} else {
	princHeight = "315px";
	menuHeight = "295px";
	topFooterA = "top: 345px";
	topFooterB = "top: 430px";
	topFooterSx = "top: 435px";
	topFooterDx = "top: 449px";
}

topFooterA += ";left: " + (eyeWidth - 170) + "px";
topFooterB += ";left: 0px";

if (frameWidth > 645) {
	princWidth = (frameWidth - 250) + "px";
	spWidth = (frameWidth - 210) + "px";
}
else {
	princWidth = "395px";
	spWidth = "435px";	
}

makeDatabase();

document.write('<head>');
document.write('<link rel="stylesheet" href="css/calaguna.css" type="text/css" >');
document.write('<meta name="Author" content="Team CARRUBE">');
document.write('<meta name="keywords" content="villaggio, turistico, villaggi, mare, grado, friuli, turismo, vacanza">');
document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
document.write('<title>' + TitoloPagina + '</title>');
document.write('</head>');
document.write('<body onResize="controllaResize()" background="immagini/Colore_sfondo_menu.gif">');
document.write('<img src="immagini/testaB.gif" class="testa" width=' + eyeWidth + ' height=75px>');
document.write('<img src="immagini/testaA.gif" class="testa" width=150px height=150px>');
document.write('<A HREF="index.html"><img src="immagini/logo.gif" name="imaglogo" ID="logo" height=100px border=0 alt="Logo Ca\' Laguna"></A>');
document.write('<img src="immagini/scritta2.gif" name="titolo" ID="titolo" height=64px border=0 alt="Villaggio Ca\' Laguna">');
document.write('<div id="tendina" style="height: ' + menuHeight + ';">');
document.write('<UL id="contenitore" style="cursor:hand;">');

var indiceMenu = 0;
var contatore = new Array(profondita);
for (var i = 0; i < profondita; i++) contatore[i] = 0;

for (var i = 0; i < alberoMenu.length; i++) {

	if (alberoMenu[i].ident == 'albero') document.write('<LI id="albero" style="list-style-image: url(' + caricaImmagine(indiceMenu) + ');">');
	if (alberoMenu[i].ident == 'voce') document.write('<LI id="voce">');
	document.write(alberoMenu[i].collegamento + '</LI>');

	if (alberoMenu[i].ident == 'albero') {
		document.write('<UL style="list-style: none; display: ' + menuSetting(indiceMenu++) + ';">');
		if (alberoMenu[i].numFigli == 0) document.write('</UL>');
		else {
			var j = 0;
			while (contatore[j] != 0) j++;
			contatore[j] = alberoMenu[i].numFigli + 1;
		}
	}

	var ancora = true;
	while (ancora) {
		var j = profondita - 1;
		while (contatore[j] == 0 && j > 0) j--;
		if (contatore[j] == 1) document.write('</UL>');
		if (contatore[j] != 1) ancora = false;
		if (contatore[j] > 0) contatore[j]--;
	}
				
}

document.write('</UL>');
document.write('<div align=center>');
document.write('<HR>');
//document.write('<A HREF="javascript:toggle(\'indexE.htm\')" style="text-decoration: none;">eng <IMG src="immagini/bandiera_inglese.gif" border=0></A>');
document.write('<A HREF="javascript:toggle(\'http://www.calaguna.it/villaggio-grado/en\')" style="text-decoration: none;">eng <IMG src="immagini/bandiera_inglese.gif" border=0 alt="Bandiera inglese"></A>');
document.write('&nbsp');
//document.write('<A HREF="javascript:toggle(\'indexD.htm\')" style="text-decoration: none;"><IMG src="immagini/bandiera_tedesca.gif" border=0> deu</A>');
document.write('<A HREF="javascript:toggle(\'http://www.calaguna.it/villaggio-grado/de\')" style="text-decoration: none;"><IMG src="immagini/bandiera_tedesca.gif" border=0 alt="Bandiera tedesca"> deu</A>');
document.write('<HR>');
document.write('<a href=\"mailto:info@calaguna.it\">info@calaguna.it</a>');
//document.write('<HR>');
document.write('<HR>');
document.write('<BR>');
document.write('<BR>');
document.write('<a class="vocemenu" style="text-decoration: none;" href=\"http://www.calaguna.it/villaggio-grado\">NUOVO SITO WEB!!!</a>');
document.write('<BR>');
document.write('<BR>');
document.write('<a class="vocemenu" style="text-decoration: none;" href=\"http://www.gradopineta.com\">METTICI A CONFRONTO</a>');
//document.write('<a href="villaggi_turistici_grado_residence_webcam.html" target="villaggi_turistici_grado_residence_webcam"onclick="window.open('villaggi_turistici_grado_residence_webcam.html','villaggi_turistici_grado_residence_webcam','height=240,width=320,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no'); return false;"><IMG src="immagini/villaggi_turistici_grado_residence_webcam.jpeg" border=0 alt="Villaggi turistici grado webcam"></A>');
//document.write('<A HREF="javascript:toggle(\'lowcost.htm\')">Tariffe Low Cost</A>');
//document.write('<HR>');
document.write('</div>');
document.write('</div>');
document.write('<div id="sfondopagina" style="height: ' + spHeight + '; width: ' + spWidth + ';">');
document.write('</div>');
document.write('<div id="principale" style="height: ' + princHeight + '; width: ' + princWidth + ';">');

function termina(){ 
 document.write('</div>'); 
 document.write('<div id="info1" style="' + topFooterSx + '">');
 document.write(piedeSx);
 document.write('</div>');
 document.write('<div id="info2" style="' + topFooterDx + '">'); 
 document.write(piedeDx);
 document.write('</div>');
 document.write('<img src="immagini/piedeB.gif" class="piede" style="' + topFooterB + '; width: ' + eyeWidth + 'px; height: 51px">');
 document.write('<img src="immagini/piedeA.gif" class="piede" style="' + topFooterA + '; width: 170px; height: 135px">');
 document.write('</body>');
 }
