/*
     Script  tratto dal libro "JavaScript and DHTML Cookbook" - Capitolo 8-13
     Pubblicato da O'Reilly & Associates
     Copyright 2003 Danny Goodman
	  Riprodurre questa nota per qualunque riutilizzo del codice.
	*/
var regiondb = new Object()
regiondb["1"] = [{value:"1", text:"Aosta"}];
regiondb["2"] = [{value:"2", text:"Alessandria"},
                      {value:"3", text:"Asti"},
                      {value:"4", text:"Biella"},
                      {value:"5", text:"Cuneo"},
                      {value:"6", text:"Novara"},
                      {value:"7", text:"Torino"},
                      {value:"8", text:"Verb. Cusio Oss."},
                      {value:"9", text:"Vercelli"}];
regiondb["3"] = [{value:"10", text:"Bergamo"},
                      {value:"11", text:"Brescia"},
                      {value:"12", text:"Como"},
                      {value:"13", text:"Cremona"},
                      {value:"14", text:"Lecco"},
                      {value:"15", text:"Lodi"},
                      {value:"16", text:"Mantova"},
                      {value:"17", text:"Milano"},
                      {value:"103", text:"Pavia"},
                      {value:"18", text:"Sondrio"},
                      {value:"19", text:"Varese"}];
regiondb["4"] = [{value:"20", text:"Bolzano"},
                      {value:"21", text:"Trento"}];
regiondb["5"] = [{value:"22", text:"Belluno"},
                      {value:"23", text:"Padova"},
                      {value:"24", text:"Rovigo"},
                      {value:"25", text:"Treviso"},
                      {value:"26", text:"Venezia"},
                      {value:"27", text:"Verona"},
                      {value:"28", text:"Vicenza"}];
regiondb["6"] = [{value:"29", text:"Gorizia"},
                      {value:"30", text:"Pordenone"},
                      {value:"31", text:"Trieste"},
                      {value:"32", text:"Udine"}];
regiondb["7"] = [{value:"33", text:"La Spezia"},
                      {value:"34", text:"Genova"},
                      {value:"35", text:"Imperia"},
                      {value:"36", text:"Savona"}];
regiondb["8"] = [{value:"37", text:"Bologna"},
                      {value:"38", text:"Ferrara"},
                      {value:"39", text:"Forli Cesena"},
                      {value:"40", text:"Modena"},
                      {value:"41", text:"Parma"},
                      {value:"42", text:"Piacenza"},
                      {value:"43", text:"Ravenna"},
                      {value:"44", text:"Reggio Emilia"},
                      {value:"45", text:"Rimini"}];
regiondb["9"] = [{value:"46", text:"Arezzo"},
                      {value:"47", text:"Firenze"},
                      {value:"48", text:"Grosseto"},
                      {value:"49", text:"Livorno"},
                      {value:"50", text:"Lucca"},
                      {value:"51", text:"Massa Carrara"},
                      {value:"52", text:"Pisa"},
                      {value:"53", text:"Pistoia"},
                      {value:"54", text:"Prato"},
                      {value:"55", text:"Siena"}];
regiondb["10"] = [{value:"56", text:"Perugia"},
                      {value:"57", text:"Terni"}];
regiondb["11"] = [{value:"58", text:"Ancona"},
                      {value:"59", text:"Ascoli Piceno"},
                      {value:"60", text:"Macerata"},
                      {value:"61", text:"Pesaro Urbino"}];
regiondb["12"] = [{value:"62", text:"Frosinone"},
                      {value:"63", text:"Latina"},
                      {value:"64", text:"Rieti"},
                      {value:"65", text:"Roma"},
                      {value:"66", text:"Viterbo"}];
regiondb["13"] = [{value:"67", text:"L'aquila"},
                      {value:"68", text:"Chieti"},
                      {value:"69", text:"Pescara"},
                      {value:"70", text:"Teramo"}];
regiondb["14"] = [{value:"71", text:"Avellino"},
                      {value:"72", text:"Benevento"},
                      {value:"73", text:"Caserta"},
                      {value:"74", text:"Napoli"},
                      {value:"75", text:"Salerno"}];
regiondb["15"] = [{value:"76", text:"Campobasso"},
                      {value:"77", text:"Isernia"}];
regiondb["16"] = [{value:"78", text:"Catanzaro"},
                      {value:"79", text:"Cosenza"},
                      {value:"80", text:"Crotone"},
                      {value:"81", text:"Reggio Calabr."},
                      {value:"82", text:"Vibo Valentia"}];
regiondb["17"] = [{value:"83", text:"Matera"},
                      {value:"84", text:"Potenza"}];
regiondb["18"] = [{value:"85", text:"Bari"},
                      {value:"86", text:"Brindisi"},
                      {value:"87", text:"Foggia"},
                      {value:"88", text:"Lecce"},
                      {value:"89", text:"Taranto"}];
regiondb["19"] = [{value:"90", text:"Agrigento"},
                      {value:"91", text:"Caltanissetta"},
                      {value:"92", text:"Catania"},
                      {value:"93", text:"Enna"},
                      {value:"94", text:"Messina"},
                      {value:"95", text:"Palermo"},
                      {value:"96", text:"Ragusa"},
                      {value:"97", text:"Siracusa"},
                      {value:"98", text:"Trapani"}];
regiondb["20"] = [{value:"99", text:"Cagiari"},
                      {value:"100", text:"Nuoro"},
                      {value:"101", text:"Oristano"},
                      {value:"102", text:"Sassari"}];
                      
                      
function setCities(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["prov"];
    while (cityChooser.options.length) {
        cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "- Tutte -";
    newElem.value = "";
    cityChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i < db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.value = db[i].value;
            cityChooser.add(newElem, where);
        }
    }
}

function setCities2(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["prov2"];
    while (cityChooser.options.length) {
        cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "- Seleziona -";
    newElem.value = "";
    cityChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i < db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.value = db[i].value;
            cityChooser.add(newElem, where);
        }
    }
}


