﻿function assegnaClasse(idLink) {
    try {
        eliminaClasse();
        //
        var num;
        if (idLink < 10)
            num = "0" + idLink;
        else
            num = idLink;
        var elemento = document.getElementById("link" + num);
        if (elemento != null) {
            //elemento.setAttribute("class", "selezionato");
            elemento.className = "menu_sel";
        }
        var elemento2 = document.getElementById("linkBasso" + num);
        if (elemento2 != null) {
            //elemento.setAttribute("class", "selezionato");
            elemento2.className = "menu_sel";
        }
        //
        var elemento3 = document.getElementById("imglink" + num);
        if (elemento3 != null) {
            if (idLink < 10)
                elemento3.className = "img_menuSelezionato";
            else
                elemento3.className = "img_menuBassoSelezionato";
        }
    }
    catch (error) {
        //fai nulla
    }
}

function eliminaClasse() {
    try {
        for (i = 1; i <= 15; i++) {
            var num;
            if (i < 10)
                num = "0" + i;
            else
                num = i;
            var elemento = document.getElementById("link" + num);
            if (elemento != null)
                elemento.className = null;
            //
            var elemento2 = document.getElementById("linkBasso" + num);
            if (elemento2 != null)
                elemento2.className = null;
            //
            var elemento3 = document.getElementById("imglink" + num);
            if (elemento3 != null)
                elemento3.className = "img_menu";
        }
    }
    catch (error) {
        //fai nulla
    }
}



function seleziona(id, nomeDiv, nomeClasse) {
    var elemento = document.getElementById(nomeDiv + id);
    if (elemento != null) {
        elemento.className = nomeClasse;
    }
    var navigatore = navigator.appName;

    var boxGrigio = document.getElementById("box" + id);
    if (boxGrigio != null) {
        elemento.style.top = boxGrigio.offsetTop + 'px';
        if (nomeDiv != "ombra")
            elemento.style.left = boxGrigio.offsetLeft - 13 + 'px';
        else
            elemento.style.left = boxGrigio.offsetLeft - 10 + 'px';
        elemento.style.width = 65 + 'px'; //boxGrigio.offsetWidth + 'px';
        elemento.style.height = 65 + 'px'; //boxGrigio.offsetHeight + 'px';
    }
}

function deseleziona(nomeClasse) {
    try {
        var elemento = document.getElementsByTagName("div");
        for (i = 1; i < elemento.length; i++)
            if (elemento[i].className == nomeClasse)
                elemento[i].className = "trasparente";

        /*
        for (i = 1; i <= 20; i++) {
        var elemento = document.getElementById(nomeDiv + i);
        elemento.className = "trasparente";
        }
        */
    }
    catch (error) {
        //fai nulla
    }
}

function vaiapagina(pagina) {
    document.location.href = pagina;
}

function anteprima(modello, prezzo, prezzoIVA, nomeProdotto, descrizione, bordo, sfondoScuro, immagine) {
    try {
        var elContenitoreOriginale = document.getElementById("contenitoreDettaglioProdotto");
        var elNomeProdSelezionato = document.getElementById("nomeProdottoSelezionato");

        var elContenitore = document.getElementById("contenitoreAnteprimaProdotto");
        var elDivImgProdotto = document.getElementById("divImgAnteprimaProdotto");
        var elImgProdotto = document.getElementById("imgAnteprimaProdotto");
        var elNomeProdotto = document.getElementById("nomeAnteprimaProdotto");
        var elDescrProdotto = document.getElementById("descrizioneAnteprimaProdotto");
        var elPrezzoProdotto = document.getElementById("prezzoAnteprimaProdotto");
        var elModelloProdotto = document.getElementById("modelloAnteprimaProdotto");
        //
        var nomeProdottoSelezionato = elNomeProdSelezionato.innerText;
        if (nomeProdottoSelezionato == undefined)
            nomeProdottoSelezionato = elNomeProdotto.textContent;

        if (nomeProdottoSelezionato.valueOf().trim() != modello.valueOf()) {
            elContenitoreOriginale.style.visibility = "hidden";
            elContenitore.style.visibility = "visible";
            elImgProdotto.setAttribute("src", immagine);
            elImgProdotto.setAttribute("alt", nomeProdotto);
            var presenzaBordo = (bordo == "true");
            if (presenzaBordo) {
                elDivImgProdotto.setAttribute("style", "width:398px;height:398px;background-color:White;position:absolute;top:190px;padding:1px 1px 1px 1px;");
                elImgProdotto.setAttribute("style", "width:398px;height:398px;");
            }
            else {
                elDivImgProdotto.setAttribute("style", "width:400px;height:400px;position:absolute;top:190px;padding:0px 0px 0px 0px;");
                elImgProdotto.setAttribute("style", "width:400px;height:400px;");
            }
            if(elNomeProdotto.innerText != undefined)
                elNomeProdotto.innerText = nomeProdotto.toString().toUpperCase();
            else
                elNomeProdotto.textContent = nomeProdotto.toString().toUpperCase();
            //
            if(elDescrProdotto.innerHTML!=undefined)
                elDescrProdotto.innerHTML = descrizione;
            else
                elDescrProdotto.textContent = descrizione;
            //
            if (elPrezzoProdotto.innerHTML != undefined)
                elPrezzoProdotto.innerHTML = prezzo + "<br />" + prezzoIVA;
            else
                elPrezzoProdotto.textContent = prezzo + "<br />" + prezzoIVA;
            //
            if(elModelloProdotto.innerText != undefined)
                elModelloProdotto.innerText = modello;
            else
                elModelloProdotto.textContent = modello;
            //
            elModelloProdotto.style.color = "#ffcc66";
            /*
            if (sfondoScuro.valueOf() == "true")
                elModelloProdotto.style.color = "white";
            else
                elModelloProdotto.style.color = "#333333";
            */
        }
        else {
            elContenitoreOriginale.style.visibility = "visible";
            elContenitore.style.visibility = "hidden";
        }
    }
    catch (Error) {
        //alert("Errore: " + Error);
    }
}

function annullaAnteprima() {
    var elContenitoreOriginale = document.getElementById("contenitoreDettaglioProdotto");
    var elContenitore = document.getElementById("contenitoreAnteprimaProdotto");
    elContenitoreOriginale.style.visibility = "visible";
    elContenitore.style.visibility = "hidden";
}


function ridimensionaItemDetails() {

    var elContenitoreDettaglio = document.getElementById("intestazionePagina");
    var elContenitoreImmagini = document.getElementById("divPannelloImmagini");
    try {
        elContenitoreDettaglio.style.height = elContenitoreImmagini.offsetHeight + 770 + 'px';
    }
    catch (Error) { }
    

}

//funzioni della pagina squadra

function visualizzaScheda(idScheda) {
    var el01 = document.getElementById("panel01");
    //
    var elemento = document.getElementById("panel0" + idScheda);
    if (elemento != null) {
        elemento.className = "visibile";
        //elemento.style.top = el01.style.top;
        elemento.style.height = "auto";
    }
    //contenitoreAjax
    //divDettaglioAtleta
    //contenitorePannelli
    var elemento2 = document.getElementById("contenitorePannelli");
    var elemento3 = document.getElementById("divDettaglioAtleta");
    var elemento4 = document.getElementById("contenitoreAjax");
    var elemento5 = document.getElementById("divDescrizDettaglio");
    
    try {

        try {
            if (idScheda == 1) {
                elemento5.style.height = "100%";
                var elemento6 = document.getElementById("divImmagineAtleta");
                elemento6.style.height = "100%";
            }
            else
                elemento5.style.height = "0";
        }
        catch (Error) { }
        /*
        if (idScheda == 4) {
        elemento.style.height = "650px";
        elemento2.style.height = "650px";
        elemento3.style.height = "950px";
        elemento4.style.height = "100%";
        }
        if (idScheda == 3) {
        elemento.style.height = "750px";
        elemento2.style.height = "750px";
        elemento3.style.height = "1050px";
        elemento4.style.height = "100%";
        }
        */
        if (idScheda < 5) {
            if (elemento2 != null) {
                elemento2.style.height = elemento.offsetHeight + 'px';
                elemento3.style.height = elemento2.offsetHeight + elemento2.offsetTop + 'px';
                elemento4.style.height = "110%";
            }
        }
    }
    catch (Error) {
    }
}


function tastoPremuto(idTasto) {
    deselezionaTasti("visibile");
    //
    var elemento2 = document.getElementById("btnDettaglio0" + idTasto);
    elemento2.className = "tastoSelezionato";
    //
    if (idTasto == 3)
        visualizzaFotografie();
    if (idTasto == 4)
        visualizzaFilmato();
    //
    visualizzaScheda(idTasto);
}

function deselezionaTasti(nomeClasse) {
    try {
        var elemento = document.getElementsByTagName("div");
        for (i = 1; i < elemento.length; i++)
            if (elemento[i].className == nomeClasse)
                elemento[i].className = "nascosto";
        //        
        for (i = 1; i <= 4; i++) {
        var elemento2 = document.getElementById("btnDettaglio0" + i);
        elemento2.className = "tastoDeselezionato";
        //elemento2.style.backgroundColor = "#e7e7dd";
        //elemento2.style.color = "#000000";
        }
    }
    catch (error) {
        //fai nulla
    }
}


//funzione per visualizzare il filmato video del corridore selezionato
function visualizzaFilmato() {
    try
    {
        var nomeFilmFLV = document.getElementById("nomeFilmato");
        var nomeFileFLV = "";
        if (nomeFilmFLV != null) 
        {
            var spanFile = nomeFilmFLV.childNodes[0];
            if (spanFile != null)
            {
                nomeFileFLV = spanFile.innerHTML;
                //alert("Nome file FLV= " + spanFile.innerHTML);
            }
            else 
            {
                nomeFileFLV = "";
                //alert("spanFile nullo!");
            }
        }
        //alert(nomeFileFLV);
        var fo = new SWFObject("./flash/video/VideoFLV.swf", "VideoFLV", "750px", "540px", "9", "#ffffff");
        fo.addParam("wmode", "transparent");
        fo.addParam("FlashVars", "nomeFilmato=" + nomeFileFLV);
        fo.write("flash_gallery");
    }
    catch (error)
    {
        //fai nulla
    }
}

function visualizzaFotografie() {
    try {
        //nomeGalleria
        var nomeGalleria = document.getElementById("nomeGalleria");
        var nomeFileGalleria = "";
        if (nomeGalleria != null) {
            var spanFile = nomeGalleria.childNodes[0];
            if (spanFile != null)
                nomeFileGalleria = spanFile.innerHTML;
            else
                nomeFileGalleria = "";
        }
        //percorsoGalleria
        var percorsoGalleria = document.getElementById("percorsoGalleria");
        var percorsoFileGalleria = "";
        if (percorsoGalleria != null) {
            var spanFile2 = percorsoGalleria.childNodes[0];
            if (spanFile2 != null)
                percorsoFileGalleria = spanFile2.innerHTML;
            else
                percorsoFileGalleria = "";
        }
        //
        var fo = new SWFObject("/flash/Azienda.swf", "Azienda", "475px", "510px", "9", "#ffffff");
        fo.addParam("wmode", "transparent");
        fo.addParam("FlashVars", "nomeGalleria=" + nomeFileGalleria + "&percorsoGalleria=" + percorsoFileGalleria);
        fo.write("divFotografie");
    }
    catch (error) {
        //fai nulla
    }
}

function visualizzaGalleriaFotografica() {

    //try {
        var fo = new SWFObject("./flash/galleria/viewer.swf", "viewer", "780px", "860px", "8", "#ffffff");

        //percorsoGalleria
        var percorsoGalleria = document.getElementById("percorsoGalleria");
        var percorsoFileGalleria = "";
        if (percorsoGalleria != null) {
            var spanFile2 = percorsoGalleria.childNodes[0];
            if (spanFile2 != null)
                percorsoFileGalleria = spanFile2.innerHTML;
            else
                percorsoFileGalleria = "";
        }

        // SIMPLEVIEWER CONFIGURATION OPTIONS
        // To use an option, uncomment it by removing the "//" at the start of the line
        // For a description of config options, go to: 
        // http://www.airtightinteractive.com/simpleviewer/options.html

        //fo.addVariable("xmlDataPath", "gallery.xml");
        //fo.addVariable("firstImageIndex", "5");	
        //fo.addVariable("langOpenImage", "Open Image in New Window");
        //fo.addVariable("langAbout", "About");	
        //fo.addVariable("preloaderColor", "0x000000");
        fo.addVariable("preloaderColor", "0x000000");
        fo.addVariable("xmlDataPath", percorsoFileGalleria);
        fo.addParam("wmode", "transparent");
        fo.write("flash_gallery");
    //}
    //catch (error) {
        //fai nulla
        //}
    }


    function visualizzaSottomenu(nomeSottomenu, indiceLinkMenu) {
        var percorsoSottomenu = document.getElementById(nomeSottomenu);
        if (percorsoSottomenu != null) {
            var percorsoMenu = document.getElementById("link0" + indiceLinkMenu);
            if (percorsoMenu != null) {
                percorsoSottomenu.style.left = (+90 + percorsoMenu.offsetLeft) + 'px';
            }
            percorsoSottomenu.style.visibility = "visible";
        }

    }


    function cancellaSottomenu() {
        var percorsoSottomenu = document.getElementById("sottomenuChiSiamo");
        if (percorsoSottomenu != null) {
            percorsoSottomenu.style.visibility = "hidden";
        }
        percorsoSottomenu = document.getElementById("sottomenuOrganizzazione");
        if (percorsoSottomenu != null) {
            percorsoSottomenu.style.visibility = "hidden";
        }
        percorsoSottomenu = document.getElementById("sottomenuProgetti");
        if (percorsoSottomenu != null) {
            percorsoSottomenu.style.visibility = "hidden";
        }
        percorsoSottomenu = document.getElementById("sottomenuProdotti");
        if (percorsoSottomenu != null) {
            percorsoSottomenu.style.visibility = "hidden";
        }
        percorsoSottomenu = document.getElementById("sottomenuNotizie");
        if (percorsoSottomenu != null) {
            percorsoSottomenu.style.visibility = "hidden";
        }
    }

    function selezionaVoce(idLink) {
        try {
            deselezionaVoce();
            //
            var num;
            if (idLink < 10)
                num = "0" + idLink;
            else
                num = idLink;
            var elemento = document.getElementById("link" + num);
            if (elemento != null) {
                //elemento.setAttribute("class", "selezionato");
                elemento.className = "menuSelezionato";
            }

            var elDiv = document.getElementById("ContenitorePagina");
            var elDivH = document.getElementById("colonnaDx");
            if (idLink == 1) {
                if ((elDiv != null) & (elDivH != null)) {
                    elDiv.style.height = (elDivH.offsetHeight + 22) + "px";
                }
            }
            else {
                if ((elDiv != null) & (elDivH != null)) {
                    elDiv.style.height = (elDivH.offsetHeight + 100) + "px";
                }
            }
            //
            //
            sistemaAltriElementiGrafici();
        }
        catch (error) {
            //fai nulla
        }
    }

    function deselezionaVoce() {
        try {
            for (i = 1; i <= 15; i++) {
                var num;
                if (i < 10)
                    num = "0" + i;
                else
                    num = i;
                var elemento = document.getElementById("link" + num);
                if (elemento != null)
                    elemento.className = null;
            }
        }
        catch (error) {
            //fai nulla
        }
    }



    function sistemaAltriElementiGrafici() {

        var browserName;
        var majorVersion;
        var navigatore = new Array();
        
        navigatore = determinaVersioneNavigatore();
        //
        if (navigatore[0] == "Microsoft Internet Explorer" && navigatore[1] <= 7) {
            var elTriangolinoDX = document.getElementById("triangolinoDx");
            var elTriangolinoSX = document.getElementById("triangolinoSx");
            var elmentoAlto = document.getElementById("menuAltoHomePage");

            //elmentoAlto = elmentoAlto.childNodes[4];
            elmentoAlto = document.getElementById("ulMenu");
            if (elmentoAlto != null)
                elmentoAlto.style.top = 12 + "px";
            
            //<div id="triangolinoDx"></div>
            //<div id="triangolinoSx"></div>
            //menuAltoHomePage ul
        }

    }

    function determinaVersioneNavigatore() {
        var nVer = navigator.appVersion;
        var nAgt = navigator.userAgent;
        var browserName = navigator.appName;
        var fullVersion = '' + parseFloat(navigator.appVersion);
        var majorVersion = parseInt(navigator.appVersion, 10);
        var nameOffset, verOffset, ix;

        //In Internet Explorer la versione reale si trova dopo "MSIE" nell'userAgent  
        if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
            browserName = "Microsoft Internet Explorer";
            fullVersion = nAgt.substring(verOffset + 5);
        }
        // In Opera, la versione reale si trova dopo "Opera"  
        else if ((verOffset = nAgt.indexOf("Opera")) != -1) {
            browserName = "Opera";
            fullVersion = nAgt.substring(verOffset + 6);
        }
        // In Chrome, la versione reale si trova dopo "Chrome"  
        else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
            browserName = "Chrome";
            fullVersion = nAgt.substring(verOffset + 7);
        }
        // In Safari, la versione reale si trova "Safari"  
        else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
            browserName = "Safari";
            fullVersion = nAgt.substring(verOffset + 7);
        }
        // In Firefox, la versione reale si trova dopo "Firefox"  
        else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
            browserName = "Firefox";
            fullVersion = nAgt.substring(verOffset + 8);
        }
        // Nella maggior parte dei browser, "name/version" è alla fine dell'userAgent  
        else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
            browserName = nAgt.substring(nameOffset, verOffset);
            fullVersion = nAgt.substring(verOffset + 1);
            if (browserName.toLowerCase() == browserName.toUpperCase()) {
                browserName = navigator.appName;
            }
        }
        // "taglia" la string fullVersion se è presente uno spazio  
        if ((ix = fullVersion.indexOf(";")) != -1) fullVersion = fullVersion.substring(0, ix);
        if ((ix = fullVersion.indexOf(" ")) != -1) fullVersion = fullVersion.substring(0, ix);
        majorVersion = parseInt('' + fullVersion, 10);
        if (isNaN(majorVersion)) {
            fullVersion = '' + parseFloat(navigator.appVersion);
            majorVersion = parseInt(navigator.appVersion, 10);
        }
        return new Array(browserName, majorVersion);
    }
   
    function visualizzaFilmatoHomePage() {
        try {
            //var nomeFilmFLV = document.getElementById("nomeFilmato");
            var nomeFileFLV = "ProductsHomePage";
            //alert(nomeFileFLV);
            var fo = new SWFObject("./flash/video/ProductsHomePage.swf", "ProductsHomePage", "850px", "600px", "9", "#ffffff");
            fo.addParam("wmode", "transparent");
            fo.addParam("FlashVars", "nomeFilmato=" + nomeFileFLV);
            fo.write("flash_gallery");
        }
        catch (error) {
            //fai nulla
        }
    }


    function selezionaImmagine(numImmagine) {
        var contenitoreImmagine = document.getElementById("fotoSelezionata");
        if (contenitoreImmagine != null) {
            contenitoreImmagine.innerHTML = "<img src=\"images/negozio/Immagine0" + numImmagine +".jpg\" alt=\"L'ISOLA, the Carlo Moretti showroom in Venice\"/>";
        }

    }



    function impostaPagina(idPagina) {
        if (idPagina != null) {
            var segnaPostoPagina = document.getElementById("segnaPosto");
            var filmatoONomePagina = document.getElementById("filmatoONomePagina");
            //
            if (idPagina != 1) {
                filmatoONomePagina.style.width = "900px";
                filmatoONomePagina.style.height = "34px";
                filmatoONomePagina.style.lineHeight = "34px";
                filmatoONomePagina.style.paddingLeft = "10px";
                swfobject = null;
            }
            else {
                filmatoONomePagina.height = "495px";
                filmatoONomePagina.style.width = "900px";
            }
            //
            switch(idPagina) {
                case 1: //Home Page
                    segnaPostoPagina.style.visibility = "hidden";
                    filmatoONomePagina.innerHTML = "Codice filmato";
                    fo.write("filmatoONomePagina");
                    //New SWFObjects (troppi errori...) swfobject.embedSWF("/flash/LoaderProjectsHomePage.swf", "filmatoONomePagina", "910", "495", "9.0.0", false, flashvars, params);
                    break;
                case 2: //Chi Siamo
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "130px";
                    segnaPostoPagina.style.width = "127px";
                    segnaPostoPagina.style.backgroundColor = "#832422";
                    filmatoONomePagina.innerHTML = "Chi Siamo / <a id=\"aDoveSiamo\" href=\"#\" title=\"DOVE SIAMO\" class=\"linkChiSiamo\" style=\"text-decoration:'underline'\" onclick=\"selezionaTab('tabDoveSiamo')\">Dove Siamo</a>";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 3: //Porte
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "261px";
                    segnaPostoPagina.style.width = "130px";
                    segnaPostoPagina.style.backgroundColor = "#ce6126";
                    filmatoONomePagina.innerHTML = "Porte e Portoncini";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 4: //Scale
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "395px";
                    segnaPostoPagina.style.width = "125px";
                    segnaPostoPagina.style.backgroundColor = "#829829";
                    filmatoONomePagina.innerHTML = "Scale interne";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 5: //Arredamenti
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "524px";
                    segnaPostoPagina.style.width = "126px";
                    segnaPostoPagina.style.backgroundColor = "#ce6126";
                    filmatoONomePagina.innerHTML = "Arredamenti su misura e Boiseries";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 6: //Restauri
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "654px";
                    segnaPostoPagina.style.width = "126px";
                    segnaPostoPagina.style.backgroundColor = "#f9b32f";
                    filmatoONomePagina.innerHTML = "Restauri";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 7: //Contatti
                    segnaPostoPagina.style.visibility = "visible";
                    segnaPostoPagina.style.left = "784px";
                    segnaPostoPagina.style.width = "126px";
                    segnaPostoPagina.style.backgroundColor = "#6F9ACC";
                    filmatoONomePagina.innerHTML = "Contatti";
                    filmatoONomePagina.style.backgroundColor = segnaPostoPagina.style.backgroundColor;
                    break;
                case 8: //Mappa
                    segnaPostoPagina.style.visibility = "hidden";
                    filmatoONomePagina.innerHTML = "";
                    filmatoONomePagina.style.backgroundColor = "White";
                    selezionaCollegamento('Mappa',8);
                    break;
                case 9: //Credits
                    segnaPostoPagina.style.visibility = "hidden";
                    filmatoONomePagina.innerHTML = "";
                    filmatoONomePagina.style.backgroundColor = "White";
                    selezionaCollegamento('Credits', 9);
                    break;
                case 10: //Privacy
                    segnaPostoPagina.style.visibility = "hidden";
                    filmatoONomePagina.innerHTML = "";
                    filmatoONomePagina.style.backgroundColor = "White";
                    selezionaCollegamento('Privacy', 10);
                    break;
                case 11: //Condizioni
                    segnaPostoPagina.style.visibility = "hidden";
                    filmatoONomePagina.innerHTML = "";
                    filmatoONomePagina.style.backgroundColor = "White";
                    selezionaCollegamento('Condizioni', 11);
                    break;
            }
        }


    } //fine metodo


    function selezionaCollegamento(nomeCollegamento, idPagina) {
        var elCredits = document.getElementById("imgCredits");
        var elMappa = document.getElementById("imgMappa");
        var elCondizioni = document.getElementById("imgCondizioni");
        var elPrivacy = document.getElementById("imgPrivacy");
        //
        deselezionaAltriCollegamenti(idPagina);
        //
        switch (nomeCollegamento) {
            case "Mappa":
                elMappa.setAttribute("src", "./img/Mappa02.png");
                break;
            case "Credits":
                elCredits.setAttribute("src", "./img/Credits02.png");
                break;
            case "Privacy":
                elPrivacy.setAttribute("src", "./img/Privacy02.png");
                break;
            case "Condizioni":
                elCondizioni.setAttribute("src", "./img/CondizioniUso02.png");
                break;
        }
    }

    function deselezionaAltriCollegamenti(idPagina) {
        var elCredits = document.getElementById("imgCredits");
        var elMappa = document.getElementById("imgMappa");
        var elCondizioni = document.getElementById("imgCondizioni");
        var elPrivacy = document.getElementById("imgPrivacy");
        //8
        if (idPagina != 8)
            elMappa.setAttribute("src", "./img/Mappa.png");
        else
            elMappa.setAttribute("src", "./img/Mappa02.png");
        //9
        if (idPagina != 9)
            elCredits.setAttribute("src", "./img/Credits.png");
        else
            elCredits.setAttribute("src", "./img/Credits02.png");
        //10
        if (idPagina != 10)
            elPrivacy.setAttribute("src", "./img/Privacy.png");
        else
            elPrivacy.setAttribute("src", "./img/Privacy02.png");
        //11
        if (idPagina != 11)
            elCondizioni.setAttribute("src", "./img/CondizioniUso.png");
        else
            elCondizioni.setAttribute("src", "./img/CondizioniUso02.png");
    }



    function selezionaDivPagina(idSel, idPagina) {
        var elHome = document.getElementById("MenuHomePage");
        var elChiSiamo = document.getElementById("MenuChiSiamo");
        var elPorte = document.getElementById("MenuPorte");
        var elScale = document.getElementById("MenuScale");
        var elArredamenti = document.getElementById("MenuArredamenti");
        var elRestauri = document.getElementById("MenuRestauri");
        var elContatti = document.getElementById("MenuContatti");
        //
        deselezionaAltriDiv();
        //
        if (idSel != idPagina) {
            switch (idSel) {
                case 1:
                    elHome.style.backgroundColor = "#d48d06";
                    break;
                case 2:
                    elChiSiamo.style.backgroundColor = "#471213";
                    break;
                case 3:
                    elPorte.style.backgroundColor = "#843e18";
                    break;
                case 4:
                    elScale.style.backgroundColor = "#4e5917";
                    break;
                case 5:
                    elArredamenti.style.backgroundColor = "#843e18";
                    break;
                case 6:
                    elRestauri.style.backgroundColor = "#d48d06";
                    break;
                case 7:
                    elContatti.style.backgroundColor = "#3b72ad";
                    break;
            }
        }
    }

    function deselezionaAltriDiv() {
        var elHome = document.getElementById("MenuHomePage");
        var elChiSiamo = document.getElementById("MenuChiSiamo");
        var elPorte = document.getElementById("MenuPorte");
        var elScale = document.getElementById("MenuScale");
        var elArredamenti = document.getElementById("MenuArredamenti");
        var elRestauri = document.getElementById("MenuRestauri");
        var elContatti = document.getElementById("MenuContatti");
        
        elHome.style.backgroundColor = "#f9b32f";
        elChiSiamo.style.backgroundColor = "#832422";
        elPorte.style.backgroundColor = "#ce6126";
        elScale.style.backgroundColor = "#829829";
        elArredamenti.style.backgroundColor = "#ce6126";
        elRestauri.style.backgroundColor = "#f9b32f";
        elContatti.style.backgroundColor = "#6F9ACC";
    }


    function selezionaTab(nomeTab) {
        deselezionaTab();
        var elemento = document.getElementById(nomeTab);
        if (elemento != null)
            elemento.className = "riquadroTitoliSelezionato";
        //Ricerca div corrispondente
        var divElemento;
        var filmatoONomePagina = document.getElementById("filmatoONomePagina");
        switch (nomeTab) {
            case "tabChiSiamo":
                divElemento = document.getElementById("divChiSiamo");
                filmatoONomePagina.innerHTML = "Chi Siamo / <a id=\"aDoveSiamo\" href=\"#\" title=\"DOVE SIAMO\" class=\"linkChiSiamo\" style=\"text-decoration:'underline'\" onclick=\"selezionaTab('tabDoveSiamo')\">Dove Siamo</a>";
                break;
            case "tabDoveSiamo":
                divElemento = document.getElementById("divDoveSiamo");
                filmatoONomePagina.innerHTML = "<a id=\"aChiSiamo\" href=\"#\" title=\"CHI SIAMO\" class=\"linkChiSiamo\" style=\"text-decoration:'underline'\" onclick=\"selezionaTab('tabChiSiamo')\">Chi Siamo</a>" +
                                                   " / Dove Siamo";
                break;
        }
        if (divElemento != null) {
            divElemento.style.visibility = "visible";
            divElemento.style.height = "auto";
        }
        //if (filmatoONomePagina != null) {
        //    filmatoONomePagina.setAttribute("style", "text-decoration:'underline';");
        //}
    }

    function deselezionaTab() {
        //Deselezione tasti
        var elemento = document.getElementById('tabChiSiamo');
        if (elemento != null)
            elemento.className = "riquadroTitoliDeselezionato";
        elemento = document.getElementById('tabDoveSiamo');
        if (elemento != null)
            elemento.className = "riquadroTitoliDeselezionato";
        
        //Nascondimento div corrispondente
        var divElemento;
        divElemento = document.getElementById("divChiSiamo");
        if (divElemento != null) {
            divElemento.style.visibility = "hidden";
            divElemento.style.height = "0px";
            divElemento.style.overflow = "hidden";
        }
        divElemento = document.getElementById("divDoveSiamo");
        if (divElemento != null) {
            divElemento.style.visibility = "hidden";
            divElemento.style.height = "0px";
            divElemento.style.overflow = "hidden";
        }
    }



