// called onChange of countryList select box to repopulate the regionList box // used on country pages with two countries ie. britain & spain function update(selectedCountry) { var regions = new Array(); var regionIDs = new Array(); var regionItem; // Australia regions[1] = new Array( 'New South Wales', 'New Zealand', 'Northern Territory', 'Queensland', 'South Australia', 'Tasmania', 'Victoria', 'Western Australia' ); regionIDs[1] = new Array( '1', '8', '2', '3', '4', '5', '6', '7' ); // Britain regions[2] = new Array( 'Cotswolds to the Severn Valley', 'Cumbria & Lakes', 'Devon & Cornwall', 'Dorset & Somerset', 'East Anglia', 'Heart of England', 'London & South of England', 'Scotland', 'Wales', 'Yorkshire & Northumberland' ); regionIDs[2] = new Array( '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ); // Ireland regions[3] = new Array( 'Ireland' ); regionIDs[3] = new Array( '1' ); // France regions[4] = new Array( 'Alsace, Vosges, Jura', 'Aquitaine, Midi-Pyrenees', 'Brittany', 'Burgundy & The Alps', 'Charetes, Vendee', 'Cote d\'Azur', 'Dordogne - Lot Region', 'Dordogne - Perigueux', 'Dordogne - Sarlat Area', 'Dordogne Sth - Tarn', 'Languedoc & Roussillon', 'Loire Valley', 'Normandy', 'Paris', 'Provence' ); regionIDs[4] = new Array( '2', '3', '5', '6', '4', '8', '18', '16', '17', '15', '10', '11', '12', '13', '14' ); // Italy regions[5] = new Array( 'Amalfi & Cilento Coast', 'Apulia', 'Argentario & Tuscan Coast', 'Cinque Terre & Asti', 'Florence & Environs', 'Rome & Lazio', 'Sicily', 'The Marches', 'Tuscany', 'Umbria', 'Venice & the Lakes' ); regionIDs[5] = new Array( '1', '8', '2', '3', '4', '7', '11', '6', '9', '10', '5' ); // Spain regions[6] = new Array( 'Catalunya', 'Eastern Andalucia', 'Ibiza', 'Mallorca', 'Valencia & Murcia', 'Western Andalucia' ); regionIDs[6] = new Array( '1', '2', '3', '4', '6', '7' ); // Portugal regions[7] = new Array( 'Algarve', 'Costa de Prata', 'Costa Lisboa', 'Costa Verde', 'Duoro Valley' ); regionIDs[7] = new Array( '2', '4', '3', '5', '1' ); // get the value of the selected country var countryID = selectedCountry.options[selectedCountry.selectedIndex].value; // reset the list document.searchForm.regionList.length = 1; // repopulate the list - start at element one not zero! if (regions[countryID] != null) { for (var i = 0; i < regions[countryID].length; i++) { regionItem = new Option(regions[countryID][i], regionIDs[countryID][i], false, false); document.searchForm.regionList.options[i+1] = regionItem; } } // add the 'all regions' option to the zeroth element and make it selected var allRegions = new Option("Search all regions", "%", true, true); document.searchForm.regionList.options[0] = allRegions; document.searchForm.regionList.options[0].selected = true; }