var XMLHTTP;


function offe(ID)
{
        var url = "offerta.asp?id=" + ID;
        XMLHTTP = RicavaBrowser(CambioStato22);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato22()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-offerta");
        R.innerHTML = XMLHTTP.responseText;
    }
}


function comunex(ID)
{
        var url = "comune_nasc.asp?id=" + ID;
        XMLHTTP = RicavaBrowser(CambioStato77);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato77()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-comune");
        R.innerHTML = XMLHTTP.responseText;
    }
}
	
	
	
function regionex(ID)
{
        var url = "regione.asp?id=" + ID;
        XMLHTTP = RicavaBrowser(CambioStato66);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato66()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-provincia");
        R.innerHTML = XMLHTTP.responseText;
    }
}
	
	
function provinciax(ID)
{
        var url = "provincia.asp?id=" + ID;
        XMLHTTP = RicavaBrowser(CambioStato88);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato88()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-comune");
        R.innerHTML = XMLHTTP.responseText;
    }
}
	
	
function categox(ID)
{
        var url = "categoria.asp?id=" + ID;
        XMLHTTP = RicavaBrowser(CambioStato11);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato11()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-tipologia");
        R.innerHTML = XMLHTTP.responseText;
    }
}
	
	
function local(ID,prov)
{
        var url = "localita.asp?id=" + ID + "&prov=" + prov;
        XMLHTTP = RicavaBrowser(CambioStato33);
        XMLHTTP.open("GET", url, true);
        XMLHTTP.send(null);
}

function CambioStato33()
{
    if (XMLHTTP.readyState == 4)
    {
        var R = document.getElementById("campi-local");
        R.innerHTML = XMLHTTP.responseText;
    }
}
	
	
	

function RicavaBrowser(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("L'esempio non funziona con altri browser!");
    }
	}


