/* Script by RoBorg RoBorg@geniusbug.com http://javascript.geniusbug.com Please do not remove or edit this message */ /* Dynamic DB regions added by Jagged DS 25 march 2004 http://www.jagged.co.nz/ Heavily modified function names 28march */ function dynamicSelect() { this.selects = new Array(); this.aS = function(name) { this.selects[name] = new selectObj(); } this.updateOptions = function(source, target) { var form = source.form; var target = form.elements[target]; var value = source.options[source.selectedIndex].value; while(target.options.length) target.remove(0); if(!this.selects[source.name].options[value]) { alert('Invalid selection.'); //For debugging while you set it up return; } var data = this.selects[source.name].options[value].options; for(var x=0; x < data.length; x++) { try { target.add(data[x]); } catch(e) { target.add(data[x], null); } } target.selectedIndex = 0; } } function selectObj() { this.options = new Array(); this.A = function(value) { this.options[value] = new optionObj(); } } function optionObj() { this.options = new Array(); this.C = function(value) { this.options[this.options.length] = new Option(value, value); } } //Start setup [Edit below here] var d = new dynamicSelect(); var s = new dynamicSelect(); d.aS('region'); s.aS('district'); var X = s.selects['district'];var dR = d.selects['region'];dR.A('NS');var Y = dR.options['NS'];Y.C(' - [ - Select Region - ] - ');X.A(' - [ - Select Region - ] - ');var Z = X.options[' - [ - Select Region - ] - '];Z.C(' - [ - Select Region - ] - ');dR.A('Northland');var Y = dR.options['Northland'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Far North');X.A('Far North');var Z = X.options['Far North'];Z.C('All');Y.C('Kaipara');X.A('Kaipara');var Z = X.options['Kaipara'];Z.C('All');Z.C('');Y.C('Whangarei');X.A('Whangarei');var Z = X.options['Whangarei'];Z.C('All');dR.A('Auckland Region');var Y = dR.options['Auckland Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Auckland City');X.A('Auckland City');var Z = X.options['Auckland City'];Z.C('All');Z.C('');Z.C('');Z.C('');Z.C('');Z.C('');Z.C('');Z.C('');Z.C('');Y.C('Franklin');X.A('Franklin');var Z = X.options['Franklin'];Z.C('All');Y.C('Manukau City');X.A('Manukau City');var Z = X.options['Manukau City'];Z.C('All');Z.C('');Y.C('North Shore');X.A('North Shore');var Z = X.options['North Shore'];Z.C('All');Z.C('');Z.C('');Y.C('Papakura');X.A('Papakura');var Z = X.options['Papakura'];Z.C('All');Y.C('Rodney');X.A('Rodney');var Z = X.options['Rodney'];Z.C('All');Z.C('');Y.C('Waitakere');X.A('Waitakere');var Z = X.options['Waitakere'];Z.C('All');Z.C('');Z.C('');Z.C('');Z.C('');dR.A('Waikato Region');var Y = dR.options['Waikato Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Franklin');X.A('Franklin');var Z = X.options['Franklin'];Z.C('All');Z.C('');Y.C('Hamilton City');X.A('Hamilton City');var Z = X.options['Hamilton City'];Z.C('All');Y.C('Hauraki');X.A('Hauraki');var Z = X.options['Hauraki'];Z.C('All');Y.C('Matamata-Piako');X.A('Matamata-Piako');var Z = X.options['Matamata-Piako'];Z.C('All');Y.C('Otorohanga');X.A('Otorohanga');var Z = X.options['Otorohanga'];Z.C('All');Y.C('Rotorua');X.A('Rotorua');var Z = X.options['Rotorua'];Z.C('All');Y.C('South Waikato');X.A('South Waikato');var Z = X.options['South Waikato'];Z.C('All');Y.C('Taupo');X.A('Taupo');var Z = X.options['Taupo'];Z.C('All');Y.C('Thames-Coromandel');X.A('Thames-Coromandel');var Z = X.options['Thames-Coromandel'];Z.C('All');Y.C('Waikato');X.A('Waikato');var Z = X.options['Waikato'];Z.C('All');Y.C('Waipa');X.A('Waipa');var Z = X.options['Waipa'];Z.C('All');Z.C('');Y.C('Waitomo');X.A('Waitomo');var Z = X.options['Waitomo'];Z.C('All');dR.A('Bay of Plenty');var Y = dR.options['Bay of Plenty'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Kawerau');X.A('Kawerau');var Z = X.options['Kawerau'];Z.C('All');Y.C('Opotiki');X.A('Opotiki');var Z = X.options['Opotiki'];Z.C('All');Y.C('Rotorua');X.A('Rotorua');var Z = X.options['Rotorua'];Z.C('All');Y.C('Taupo');X.A('Taupo');var Z = X.options['Taupo'];Z.C('All');Y.C('Tauranga');X.A('Tauranga');var Z = X.options['Tauranga'];Z.C('All');Y.C('Western Bay of Plenty');X.A('Western Bay of Plenty');var Z = X.options['Western Bay of Plenty'];Z.C('All');Y.C('Whakatane');X.A('Whakatane');var Z = X.options['Whakatane'];Z.C('All');dR.A('Gisborne');var Y = dR.options['Gisborne'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Gisborne');X.A('Gisborne');var Z = X.options['Gisborne'];Z.C('All');dR.A('Hawkes Bay');var Y = dR.options['Hawkes Bay'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Central Hawkes Bay');X.A('Central Hawkes Bay');var Z = X.options['Central Hawkes Bay'];Z.C('All');Y.C('Hastings');X.A('Hastings');var Z = X.options['Hastings'];Z.C('All');Y.C('Naiper');X.A('Naiper');var Z = X.options['Naiper'];Z.C('All');Y.C('Rangitikei');X.A('Rangitikei');var Z = X.options['Rangitikei'];Z.C('All');Y.C('Taupo');X.A('Taupo');var Z = X.options['Taupo'];Z.C('All');Y.C('Wairoa');X.A('Wairoa');var Z = X.options['Wairoa'];Z.C('All');dR.A('Taranaki Region');var Y = dR.options['Taranaki Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('New Plymouth');X.A('New Plymouth');var Z = X.options['New Plymouth'];Z.C('All');Y.C('South Taranaki');X.A('South Taranaki');var Z = X.options['South Taranaki'];Z.C('All');Y.C('Stratford');X.A('Stratford');var Z = X.options['Stratford'];Z.C('All');dR.A('Manawatu-Wanganui');var Y = dR.options['Manawatu-Wanganui'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Horowhenua');X.A('Horowhenua');var Z = X.options['Horowhenua'];Z.C('All');Y.C('Manawatu');X.A('Manawatu');var Z = X.options['Manawatu'];Z.C('All');Y.C('Palmerston North');X.A('Palmerston North');var Z = X.options['Palmerston North'];Z.C('All');Z.C('');Y.C('Rangitikei');X.A('Rangitikei');var Z = X.options['Rangitikei'];Z.C('All');Y.C('Ruapehu');X.A('Ruapehu');var Z = X.options['Ruapehu'];Z.C('All');Y.C('Stratford');X.A('Stratford');var Z = X.options['Stratford'];Z.C('All');Y.C('Tararua');X.A('Tararua');var Z = X.options['Tararua'];Z.C('All');Y.C('Taupo');X.A('Taupo');var Z = X.options['Taupo'];Z.C('All');Y.C('Waitomo District');X.A('Waitomo District');var Z = X.options['Waitomo District'];Z.C('All');Y.C('Wanganui');X.A('Wanganui');var Z = X.options['Wanganui'];Z.C('All');dR.A('Wellington Region');var Y = dR.options['Wellington Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Carterton');X.A('Carterton');var Z = X.options['Carterton'];Z.C('All');Y.C('Kapiti Coast');X.A('Kapiti Coast');var Z = X.options['Kapiti Coast'];Z.C('All');Y.C('Lower Hutt City');X.A('Lower Hutt City');var Z = X.options['Lower Hutt City'];Z.C('All');Y.C('Masterton');X.A('Masterton');var Z = X.options['Masterton'];Z.C('All');Y.C('Porirua City');X.A('Porirua City');var Z = X.options['Porirua City'];Z.C('All');Y.C('South Wairarapa');X.A('South Wairarapa');var Z = X.options['South Wairarapa'];Z.C('All');Y.C('Tararua');X.A('Tararua');var Z = X.options['Tararua'];Z.C('All');Y.C('Upper Hutt City');X.A('Upper Hutt City');var Z = X.options['Upper Hutt City'];Z.C('All');Y.C('Wellington City');X.A('Wellington City');var Z = X.options['Wellington City'];Z.C('All');dR.A('Tasman Region');var Y = dR.options['Tasman Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Tasman District');X.A('Tasman District');var Z = X.options['Tasman District'];Z.C('All');dR.A('Marlborough');var Y = dR.options['Marlborough'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Marlborough');X.A('Marlborough');var Z = X.options['Marlborough'];Z.C('All');dR.A('Nelson');var Y = dR.options['Nelson'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Nelson City');X.A('Nelson City');var Z = X.options['Nelson City'];Z.C('All');dR.A('West Coast Region');var Y = dR.options['West Coast Region'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Buller District');X.A('Buller District');var Z = X.options['Buller District'];Z.C('All');Y.C('Grey District');X.A('Grey District');var Z = X.options['Grey District'];Z.C('All');Z.C('');Y.C('Westland District');X.A('Westland District');var Z = X.options['Westland District'];Z.C('All');dR.A('Canterbury');var Y = dR.options['Canterbury'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Ashburton');X.A('Ashburton');var Z = X.options['Ashburton'];Z.C('All');Y.C('Banks Peninsula');X.A('Banks Peninsula');var Z = X.options['Banks Peninsula'];Z.C('All');Y.C('Christchurch City');X.A('Christchurch City');var Z = X.options['Christchurch City'];Z.C('All');Y.C('Hurunui');X.A('Hurunui');var Z = X.options['Hurunui'];Z.C('All');Y.C('Kaikoura');X.A('Kaikoura');var Z = X.options['Kaikoura'];Z.C('All');Y.C('Mackenzie');X.A('Mackenzie');var Z = X.options['Mackenzie'];Z.C('All');Y.C('Selwyn');X.A('Selwyn');var Z = X.options['Selwyn'];Z.C('All');Y.C('Timaru');X.A('Timaru');var Z = X.options['Timaru'];Z.C('All');Y.C('Waimakariri');X.A('Waimakariri');var Z = X.options['Waimakariri'];Z.C('All');Z.C('');Z.C('');Y.C('Waimate');X.A('Waimate');var Z = X.options['Waimate'];Z.C('All');Y.C('Waitaki');X.A('Waitaki');var Z = X.options['Waitaki'];Z.C('All');dR.A('Otago');var Y = dR.options['Otago'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Central Otago');X.A('Central Otago');var Z = X.options['Central Otago'];Z.C('All');Y.C('Clutha');X.A('Clutha');var Z = X.options['Clutha'];Z.C('All');Y.C('Dunedin City');X.A('Dunedin City');var Z = X.options['Dunedin City'];Z.C('All');Y.C('Queenstown-Lakes');X.A('Queenstown-Lakes');var Z = X.options['Queenstown-Lakes'];Z.C('All');Y.C('Waitaki');X.A('Waitaki');var Z = X.options['Waitaki'];Z.C('All');Z.C('');dR.A('Southland');var Y = dR.options['Southland'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Gore');X.A('Gore');var Z = X.options['Gore'];Z.C('All');Y.C('Invercargill');X.A('Invercargill');var Z = X.options['Invercargill'];Z.C('All');Y.C('Southland');X.A('Southland');var Z = X.options['Southland'];Z.C('All');dR.A('Chatham Islands');var Y = dR.options['Chatham Islands'];Y.C('All');X.A('All');var Z = X.options['All'];Z.C('All');Y.C('Chatham Islands');X.A('Chatham Islands');var Z = X.options['Chatham Islands'];Z.C('All'); function select_region(slctindex) { document.forms['searchform'].elements['region'].selectedIndex=slctindex; d.updateOptions(document.forms['searchform'].elements['region'], 'district'); s.updateOptions(document.forms['searchform'].elements['district'], 'suburb'); }