﻿// File JScript

function mostraMenu(menuCorrente,immagine) {
    if (document.getElementById) {
        questoMenu = document.getElementById(menuCorrente).style
    if (questoMenu.display == "block") {
        questoMenu.display = "none"
        document.getElementById(immagine).src='img/Apri.gif';
    }
    else {
        document.getElementById(immagine).src='img/Chiudi.gif';
        questoMenu.display = "block"
    }
    return false
    }
    else {
        return true
    }
}

function CambiaImmagine(Selezionata, NomeFoto, ColoreBordo, ColoreBordoSelezionato, ColoreSfondo) {
    document.getElementById("FotoGrande").src = "ProporzionaImmagini.aspx?CS=" + ColoreSfondo + "&Principale=S&Foto=" + NomeFoto + "&H=274&W=280";
    var i;
    for (i = 1;i<=document.getElementById("ContaImmagini").value; i++)
    {
        if (i != Selezionata) {
          document.getElementById('IDFotoSelezionata').value=Selezionata-1;
          document.getElementById("Immagine" + i).style.cssText = "border: 1px solid #" + ColoreBordo + ";";
        } else {
          document.getElementById("Immagine" + Selezionata).style.cssText = "border: 1px solid #" + ColoreBordoSelezionato + ";";
        } 
    } 
}

function CambiaImmagineEstesa(Selezionata, NomeFoto, ColoreBordo, ColoreBordoSelezionato, ColoreSfondo) {
    document.getElementById("FotoGrande").src = "ProporzionaImmagini.aspx?CS=" + ColoreSfondo + "&Principale=S&Foto=" + NomeFoto + "&H=374&W=400";
    var i;
    for (i = 1;i<=document.getElementById("ContaImmagini").value; i++)
    {
        if (i != Selezionata) {
          document.getElementById('IDFotoSelezionata').value=Selezionata-1;
          document.getElementById("Immagine" + i).style.cssText = "border: 1px solid #" + ColoreBordo + ";";
        } else {
          document.getElementById("Immagine" + Selezionata).style.cssText = "border: 1px solid #" + ColoreBordoSelezionato + ";";
        } 
    } 
}

function CambiaLingua(Lingua) {
    document.getElementById("Composizione").innerHTML = document.getElementById("Hidden" + Lingua).value;
}

function MostraDettaglio(ID) {
   y = yMousePos - 250;
   ASPxCPDettaglio.PerformCallback(ID);
}

var y = 0;

// Global variables
yMousePos = 0; // Vertical position of the mouse on the screen
yMousePosMax = 0; // Height of the page

if (document.layers) { // Netscape
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
document.onmousemove = captureMousePosition;
}

function captureMousePosition(e) {
    if (document.layers) {
    // When the page scrolls in Netscape, the event's mouse position
    // reflects the absolute position on the screen. innerHight/Width
    // is the position from the top/left of the screen that the user is
    // looking at. pageX/YOffset is the amount that the user has
    // scrolled into the page. So the values will be in relation to
    // each other as the total offsets into the page, no matter if
    // the user has scrolled or not.
    yMousePos = e.pageY;
    yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
    // When the page scrolls in IE, the event's mouse position
    // reflects the position from the top/left of the screen the
    // user is looking at. scrollLeft/Top is the amount the user
    // has scrolled into the page. clientWidth/Height is the height/
    // width of the current page the user is looking at. So, to be
    // consistent with Netscape (above), add the scroll offsets to
    // both so we end up with an absolute value on the page, no
    // matter if the user has scrolled or not.
    yMousePos = window.event.y+document.body.scrollTop;
    yMousePosMax = document.body.clientHeight+document.body.scrollTop ;
    } else if (document.getElementById) {
    // Netscape 6 behaves the same as Netscape 4 in this regard
    yMousePos = e.pageY;
    yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}

function ASPxCPDettaglio_EndCallBack() {
    Dettaglio.ShowAtPos(0,y);
    Dettaglio.Show();
}

function isNull(v) {
    if (v == null) {return ''} else {return v};
}

function AggiornaFiltri(v) {
    hf1.Set('Parametri',Parametri());
    PanelFiltri.PerformCallback(v + ';' + Parametri());
}

function AggiornaEsito() {
    hf1.Set('Parametri',Parametri());
    PanelEsito.PerformCallback(Parametri());
}

//----------------stampa mappa

function printWindow() {
    bV = parseInt(navigator.appVersion);
    if (bV >= 4) window.print();
}
