var XMLHTTP;

function RichiestaAJAX1(data1,page)

{
		//alert(data1);
		//alert(page);
		
        var url = "ajax_vert.php?data=" + data1 + "&page=" + page;
        XMLHTTP1 = QualeBrowser(GestioneStato); 
        XMLHTTP1.open("GET", url, true); 
        XMLHTTP1.send(null); 
}

function GestioneStato() 
{
    if (XMLHTTP1.readyState == 4)
    {
        var R = document.getElementById("data1");
        R.innerHTML = XMLHTTP1.responseText;
    }
}



//.......................ponti........................................

function RichiestaAJAX2(data1,page)

{
		//alert(data1);
		//alert(page);
		
        var url_pont = "ajax_vert_pont.php?data=" + data1 + "&page=" + page;
        XMLHTTP1_pont = QualeBrowser(GestioneStato_pont); 
        XMLHTTP1_pont.open("GET", url_pont, true); 
        XMLHTTP1_pont.send(null); 
}

function GestioneStato_pont() 
{
    if (XMLHTTP1_pont.readyState == 4)
    {
        var R_pont = document.getElementById("ponte1");
        R_pont.innerHTML = XMLHTTP1_pont.responseText;
    }
}



//......................... ricerca ................................
function RichiestaAJAX_result1(data1,page,ordinamento,tipo,regione,provincia,num_ospiti,citta)
{ 
        var url = "ajax_vert_result1.php?data=" + data1 + "&page=" + page + "&ordinamento=" + ordinamento + "&tipo=" + tipo + "&regione=" + regione + "&provincia=" + provincia + "&num_ospiti=" + num_ospiti + "&citta=" + citta; 

		//alert (url);
		
        XMLHTTP2 = QualeBrowser(GestioneStato2);  
        XMLHTTP2.open("GET", url, true); 
        XMLHTTP2.send(null);
} 

function GestioneStato2()
{

//alert(XMLHTTP2.readyState);
    if (XMLHTTP2.readyState == 4)
    {
        var R2 = document.getElementById("result1");
        R2.innerHTML = XMLHTTP2.responseText; 
    }
}




function RichiestaAJAX_result2(page,ordinamento,parametro,tipo)
{ 
        var url45 = "ajax_vert_result2.php?page=" + page + "&ordinamento=" + ordinamento + "&parametro=" + parametro+ "&tipo=" + tipo; 

		//alert (url45);
		
        XMLHTTP45 = QualeBrowser(GestioneStato45);  
        XMLHTTP45.open("GET", url45, true); 
        XMLHTTP45.send(null);
} 

function GestioneStato45()
{

    if (XMLHTTP45.readyState == 4)
    {
        var R45 = document.getElementById("result1");
        R45.innerHTML = XMLHTTP45.responseText; 
    }
}

//.........................................................

// funzione del calendario pop-up
function RichiestaAjax_periodo(x)

{		
        var url = "ajax_calendar.php?x=" + x;
        XMLHTTP3 = QualeBrowser(GestioneStato6); 
        XMLHTTP3.open("GET", url, true); 
        XMLHTTP3.send(null);
}

function GestioneStato6() 
{
    if (XMLHTTP3.readyState == 4)
    {
        var R3 = document.getElementById("periodo2");
        R3.innerHTML = XMLHTTP3.responseText;
    }
}


// funzione del calendario1 gest
function RichiestaAjax_calendario1(x)

{		
        var url = "../ajax_calendar1.php?x=" + x;
        XMLHTTP1a = QualeBrowser(GestioneStato1a); 
        XMLHTTP1a.open("GET", url, true); 
        XMLHTTP1a.send(null);
}

function GestioneStato1a() 
{
    if (XMLHTTP1a.readyState == 4)
    {
        var R1a = document.getElementById("data1");
        R1a.innerHTML = XMLHTTP1a.responseText;
    }
}


// funzione del calendario1 gest
function RichiestaAjax_calendario2(x)

{		
        var url = "../ajax_calendar2.php?x=" + x;
        XMLHTTP2a = QualeBrowser(GestioneStato2a); 
        XMLHTTP2a.open("GET", url, true); 
        XMLHTTP2a.send(null);
}

function GestioneStato2a() 
{
    if (XMLHTTP2a.readyState == 4)
    {
        var R2a = document.getElementById("data2");
        R2a.innerHTML = XMLHTTP2a.responseText;
    }
}




function RichiestaAjax_regione(cerc)
{
        var url = "http://www.agriturismi.it/ajax_select_regione.php?cerc=" + cerc;
 		XMLHTTP4 = QualeBrowser(GestioneStato4); 
        XMLHTTP4.open("GET", url, true); 
        XMLHTTP4.send(null);
}

function GestioneStato4() 
{
    if (XMLHTTP4.readyState == 4)
    {
        var R4 = document.getElementById("select_regione");
        R4.innerHTML = XMLHTTP4.responseText;
    }
}




function RichiestaAjax_provincia(reg)
{
        var url = "http://www.agriturismi.it/ajax_select_provincia.php?reg=" + reg;
 		XMLHTTP7 = QualeBrowser(GestioneStato7); 
        XMLHTTP7.open("GET", url, true); 
        XMLHTTP7.send(null);
}

function GestioneStato7() 
{
    if (XMLHTTP7.readyState == 4)
    {
        var R7 = document.getElementById("select_provincia");
        R7.innerHTML = XMLHTTP7.responseText;
    }
}



function Ajax_new_ricerca(cerc)
{
        var url = "ajax_new_ricerca.php?cerc=" + cerc;
 		XMLHTTP4_a = QualeBrowser(GestioneStato4_a); 
        XMLHTTP4_a.open("GET", url, true); 
        XMLHTTP4_a.send(null);
}

function GestioneStato4_a() 
{
    if (XMLHTTP4_a.readyState == 4)
    {
        var R4_a = document.getElementById("cerca");
        R4_a.innerHTML = XMLHTTP4_a.responseText;
		
		
    }
}




function Ajax_mappa_Home(regione)

{
        var url = "ajax_mappa_home.php?regione=" + regione;
 
 		//alert(url);
		
 		XMLHTTP5 = QualeBrowser(GestioneStato5); 
        XMLHTTP5.open("GET", url, true); 
        XMLHTTP5.send(null);
}

function GestioneStato5() 
{
    if (XMLHTTP5.readyState == 4)
    {
        var R5 = document.getElementById("mappa");
        R5.innerHTML = XMLHTTP5.responseText;
    }
}


<!-------->
function RichiestaAjax_provincia_tutte(reg)
{
        var url = "http://www.agriturismi.it/ajax_select_provincia_tutte.php?reg=" + reg;
		 
		//alert(url);
		 
 		XMLHTTP8 = QualeBrowser(GestioneStato8); 
        XMLHTTP8.open("GET", url, true);  
        XMLHTTP8.send(null);
}

function GestioneStato8() 
{
    if (XMLHTTP8.readyState == 4)
    {
        var R8 = document.getElementById("select_provincia");
        R8.innerHTML = XMLHTTP8.responseText;
    }
}

<!------>
function RichiestaAjax_citta_tutte(reg)
{
        var url = "http://www.agriturismi.it/ajax_select_citta_tutte.php?reg=" + reg;
		
 		XMLHTTP8_ = QualeBrowser(GestioneStato8_); 
        XMLHTTP8_.open("GET", url, true); 
        XMLHTTP8_.send(null);
}

function GestioneStato8_() 
{
    if (XMLHTTP8_.readyState == 4)
    {
        var R8_ = document.getElementById("select_citta");
        R8_.innerHTML = XMLHTTP8_.responseText;
    }
}


function RichiestaAjax_citta_tutte2(reg)
{
        var url = "http://www.agriturismi.it/ajax_select_citta_tutte2.php?reg=" + reg;
		 
		
 		XMLHTTP8_2 = QualeBrowser(GestioneStato8_2); 
        XMLHTTP8_2.open("GET", url, true); 
        XMLHTTP8_2.send(null);
}

function GestioneStato8_2() 
{
    if (XMLHTTP8_2.readyState == 4)
    {
        var R8_2 = document.getElementById("select_citta");
        R8_2.innerHTML = XMLHTTP8_2.responseText;
    }
}





function RichiestaAjax_provincia_tutte2(reg)
{
        var url = "http://www.agriturismi.it/ajax_select_provincia_tutte2.php?reg=" + reg;
		
		
 		XMLHTTP9 = QualeBrowser(GestioneStato9); 
        XMLHTTP9.open("GET", url, true); 
        XMLHTTP9.send(null); 
}

function GestioneStato9() 
{
    if (XMLHTTP9.readyState == 4)
    {
        var R9 = document.getElementById("select_provincia2");
        R9.innerHTML = XMLHTTP9.responseText;
    }
}

function Ajax_calendario_Home(data,mese, tipo)

{
        var url = "ajax_calendar_home.php?data1=" + data + "&mese=" + mese + "&tipo=" + tipo;
 
 		//alert(url);
		
 		XMLHTTP5 = QualeBrowser(GestioneStato5_); 
        XMLHTTP5.open("GET", url, true); 
        XMLHTTP5.send(null);
}

function GestioneStato5_() 
{
    if (XMLHTTP5.readyState == 4)
    {
        var R5 = document.getElementById("calendar");
        R5.innerHTML = XMLHTTP5.responseText;
    }
}




// 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("Oiboo funziona con i browser Internet Explorer e Mozilla FireFox");
    }
}

