var XMLHTTP;

function periodo5_it(x){

var livello2a = "periodo2";

//alert(livello2a);

if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
//Layer1_agri.style.visibility = "visible";
document.all[livello2a].style.visibility = "visible";
periodo_it(x);
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello2a).style.visibility = "visible"; 
periodo_it(x);
  }
}

// funzione del calendario pop-up
function periodo_it(x)

{		
        var urlu = "http://www.agriturismi.it/ajax_calendar_it.php?x=" + x;
        XMLHTTP3u = QualeBrowser(GestioneStato6u); 
        XMLHTTP3u.open("GET", urlu, true); 
        XMLHTTP3u.send(null);
}

function GestioneStato6u() 
{
    if (XMLHTTP3u.readyState == 4)
    {
        var R3u = document.getElementById("periodo2");
        R3u.innerHTML = XMLHTTP3u.responseText;
    }
}




function periodo5_en(x){

var livello2a = "periodo2";


if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
//Layer1_agri.style.visibility = "visible";
document.all[livello2a].style.visibility = "visible";
periodo_en(x);
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello2a).style.visibility = "visible"; 
periodo_en(x);
  }
}

// funzione del calendario pop-up
function periodo_en(x)

{		
        var urlu = "http://www.agriturismi.it/ajax_calendar_en.php?x=" + x;
		
        XMLHTTP3uo = QualeBrowser(GestioneStato6uo); 
        XMLHTTP3uo.open("GET", urlu, true); 
        XMLHTTP3uo.send(null);
}

function GestioneStato6uo() 
{
    if (XMLHTTP3uo.readyState == 4)
    {
        var R3uo = document.getElementById("periodo2");
        R3uo.innerHTML = XMLHTTP3uo.responseText;
    }
}



function periodo5_fr(x){

var livello2a = "periodo2";


if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
//Layer1_agri.style.visibility = "visible";
document.all[livello2a].style.visibility = "visible";
periodo_fr(x);
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello2a).style.visibility = "visible"; 
periodo_fr(x);
  }
}

// funzione del calendario pop-up
function periodo_fr(x)

{		
        var urlu = "http://www.agriturismi.it/ajax_calendar_fr.php?x=" + x;
		
        XMLHTTP3uow = QualeBrowser(GestioneStato6uow); 
        XMLHTTP3uow.open("GET", urlu, true); 
        XMLHTTP3uow.send(null);
}

function GestioneStato6uow() 
{
    if (XMLHTTP3uow.readyState == 4)
    {
        var R3uo = document.getElementById("periodo2");
        R3uo.innerHTML = XMLHTTP3uow.responseText;
    }
}



function periodo5_de(x){

var livello2a = "periodo2";


if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
//Layer1_agri.style.visibility = "visible";
document.all[livello2a].style.visibility = "visible";
periodo_de(x);
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello2a).style.visibility = "visible"; 
periodo_de(x);
  }
}

// funzione del calendario pop-up
function periodo_de(x)

{		
        var urlu = "http://www.agriturismi.it/ajax_calendar_de.php?x=" + x;
		
        XMLHTTP3uows = QualeBrowser(GestioneStato6uows); 
        XMLHTTP3uows.open("GET", urlu, true); 
        XMLHTTP3uows.send(null);
}

function GestioneStato6uows() 
{
    if (XMLHTTP3uows.readyState == 4)
    {
        var R3uos = document.getElementById("periodo2");
        R3uos.innerHTML = XMLHTTP3uows.responseText;
    }
}


//spagnolo
function periodo5_es(x){

var livello2a = "periodo2";


if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
//Layer1_agri.style.visibility = "visible";
document.all[livello2a].style.visibility = "visible";
periodo_es(x);
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello2a).style.visibility = "visible"; 
periodo_es(x);
  }
}

// funzione del calendario pop-up
function periodo_es(x)

{		
        var urlu = "http://www.agriturismi.it/ajax_calendar_es.php?x=" + x;
		
        XMLHTTP3uowsa = QualeBrowser(GestioneStato6uowsa); 
        XMLHTTP3uowsa.open("GET", urlu, true); 
        XMLHTTP3uowsa.send(null);
}

function GestioneStato6uowsa() 
{
    if (XMLHTTP3uowsa.readyState == 4)
    {
        var R3uosa = document.getElementById("periodo2");
        R3uosa.innerHTML = XMLHTTP3uowsa.responseText;
    }
}



function chiudi(livello){

if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
document.all[livello].style.visibility = "hidden";
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello).style.visibility = "hidden"; 
}
}

function vedi(livello){

if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
document.all[livello].style.visibility = "visible";
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello).style.visibility = "visible"; 
}
}



function inserisci(luogo,livello){

if (livello == 'localita2') {
document.asd.localita.value = luogo;
}
else
{
document.asd.periodo1.value = luogo;
}


if (navigator.userAgent.indexOf("MSIE") != (-1)) {
//alert("IE");
document.all[livello].style.visibility = "hidden";
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1)){
//alert("MOZZILLA");
document.getElementById(livello).style.visibility = "hidden"; 
  }
}




// questa funzione non varia...
function QualeBrowser(QualeBrowser)
{
    if (navigator.userAgent.indexOf("MSIE") != (-1))
    {
        var Classe = "Msxml2.XMLHTTP";
        if (navigator.appVersion.indexOf("MSIE 5.5") != (-1));
        {
            Classe = "Microsoft.XMLHTTP";
        } 
        try
        {
            OggettoXMLHTTP = new ActiveXObject(Classe);
            OggettoXMLHTTP.onreadystatechange = QualeBrowser;
            return OggettoXMLHTTP;
        }
        catch(e)
        {
            alert("Errore: l'ActiveX non verrą eseguito!");
        }
    }
    else if (navigator.userAgent.indexOf("Mozilla") != (-1)) 
    {
        OggettoXMLHTTP = new XMLHttpRequest(); 
        OggettoXMLHTTP.onload = QualeBrowser;
        OggettoXMLHTTP.onerror = QualeBrowser; 
        return OggettoXMLHTTP;
    }
    else 
    {
        alert("agriturismi.it funziona con i browser Internet Explorer e Mozilla FireFox");
    }
}


