/* AJAX LOCALITA' */
function CaricaRegioni(value)
{
     RefreshFinestra('reg', './_ajax/ajax.php?action=regione&id='+value);
     RefreshFinestra('prov', './_ajax/ajax.php?action=provincie&id=0');
     RefreshFinestra('com', './_ajax/ajax.php?action=comuni&id=0');
}

function CaricaProvincie(value)
{
     RefreshFinestra('prov', './_ajax/ajax.php?action=provincie&id='+value);
     RefreshFinestra('com', './_ajax/ajax.php?action=comuni&id=0');
}

function CaricaComuni(value)
{
     RefreshFinestra('com', './_ajax/ajax.php?action=comuni&id='+value);
}
/* FINE AJAX LOCALITA' */


/* RICARICA LA FINESTRA */
function RefreshFinestra(finestra, url)
{
    var f=document.getElementById(finestra);
    //f.innerHTML='Sei ancora in attesa?';
    var oXmlHttp = zXmlHttp.createRequest();
    oXmlHttp.open('get', url, true);
    oXmlHttp.onreadystatechange = function ()
    {
        if (oXmlHttp.readyState==4)
        {
            if (oXmlHttp.status==200)
            {
                f.innerHTML=oXmlHttp.responseText;
                return;
            }
            if (oXmlHttp.status==404)
            {
                alert('La pagina '+ url + ' non esiste!');
            }
            else alert('Errore, status: '+oXmlHttp.status);
        }
    }
    oXmlHttp.send(null);
}
/* FINE RICARICA LA FINESTRA */

