// It will load an array with all the info from the cfquery and then build the selects from the array data. ... should be quicker // use array to store all the subregion information. With this we can pull out the required subregions as we need them. var x = 0; state_list = new Array(); // this array is going to contain all of the state data city_list = new Array(); // this array is going to contain all of the city data sidno = 0; //state id sname = 1; //state name scountry = 2; //country code function setObj1(array_pos, theid, thestate, thecountry){ state_list[array_pos] = new Array(); state_list[array_pos][sidno] = theid; state_list[array_pos][sname] = thestate; state_list[array_pos][scountry] = thecountry; } cidno = 0; //state id cname = 1; //state name cstate = 2; // state code ccountry = 3; //country code cmajor = 4; // major city function setObj2(array_pos, theid, thecity, thestate, thecountry, themajor){ city_list[array_pos] = new Array(); city_list[array_pos][cidno] = theid; city_list[array_pos][cname] = thecity; city_list[array_pos][cstate] = thestate; city_list[array_pos][ccountry] = thecountry; city_list[array_pos][cmajor] = themajor; } function PopulateList(country, state, city, showall){ var array1_pos = 0; var array2_pos = 0; state.length = 0; city.length = 0; if (country.options[country.options.selectedIndex].value == "0"){ state.options[state.options.length] = new Option('[select]', 0); city.options[city.options.length] = new Option('[select]', 0); } else if (country.options[country.options.selectedIndex].value == 2 || country.options[country.options.selectedIndex].value == 1 || country.options[country.options.selectedIndex].value == 8 || country.options[country.options.selectedIndex].value == 9 ||country.options[country.options.selectedIndex].value == 14 ||country.options[country.options.selectedIndex].value == 10 ||country.options[country.options.selectedIndex].value == 23 ||country.options[country.options.selectedIndex].value == 24){ // temporary removal (Nick Tai 080901) // australia, new zealand and america for (array1_pos = 0; array1_pos < state_list.length; array1_pos++){ if (country.options[country.options.selectedIndex].value == state_list[array1_pos][scountry]) { if (state.options.length == 0){ if (showall){ state.options[state.options.length] = new Option('All of ' + country.options[country.options.selectedIndex].text, 0, false, true); } } state.options[state.options.length] = new Option(state_list[array1_pos][sname], state_list[array1_pos][sidno]); } } for (array2_pos = 0; array2_pos < city_list.length; array2_pos++){ if (country.options[country.options.selectedIndex].value == city_list[array2_pos][ccountry]){ if (state.options[state.options.selectedIndex].value == city_list[array2_pos][cstate]){ if (city.options.length == 0){ if (showall){ city.options[city.options.length] = new Option('All Locations in ' + state.options[state.options.selectedIndex].text, 0, false, true); } } city.options[city.options.length] = new Option(city_list[array2_pos][cname], city_list[array2_pos][cidno]); } else{ if (showall) city.options[0] = new Option('All Locations', 0, false, true); } } } } else{ // all other countries state.options[state.options.length] = new Option('N/A', 11); city.options[city.options.length] = new Option('Other', 26); } state.options[0].selected = true; } function PopulateList2(state, city, showall){ var array_pos = 0; city.length = 0; var major = 'None'; for (array_pos = 0; array_pos < city_list.length; array_pos++){ if (state.options[state.options.selectedIndex].value == city_list[array_pos][cstate]){ if (city.options.length == 0){ if (showall){ city.options[city.options.length] = new Option('All Locations in ' + state.options[state.options.selectedIndex].text, 0, false, true); } } if(major=='True'&&city_list[array_pos][cmajor]=='False') { city.options[city.options.length] = new Option('------------------------------------',''); } city.options[city.options.length] = new Option(city_list[array_pos][cname], city_list[array_pos][cidno]); major = city_list[array_pos][cmajor]; } else{ if (showall) city.options[0] = new Option('All Locations', 0, false, true); } } city.options[0].selected = true; }