/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Carl Leiby | http://leibys-place.com/ */
var otherStuff = {
   "Phoenix" : [ "Select City","North Phoenix", "Central Phoenix", "South Phoenix" ],
   "Northeast" : [ "Select City","Fountain Hills", "Scottsdale" ],
	 "Northwest" : [ "Select City","El Mirage", "Peoria", "Sun City", "Suprise" ],
   "Pinal County" : [ "Select City","Apache Junction", "Casa Grande", "Coolidge", "Florence", "Gold Canyon", "Maricopa", "Queen Creek" ],
	 "Southeast" : [ "Select City","Chandler", "Gilbert", "Mesa", "Tempe" ],
   "Southwest" : [ "Select City","Avondale", "Buckeye", "Glendale", "Goodyear", "Tolleson" ]
};

function selectAll(listName, selected) {
  var listBox = document.getElementById(listName);
  for(i=0; i<listBox.length; i++) {
    listBox.options[i].selected=selected;
  }
  if( listBox.onchange ) {
    listBox.onchange();
  }
}

function lstStuff_OnChange() {
  var listBox = document.getElementById("lstStuff");
  var subListBox = document.getElementById("lstOtherStuff");
  subListBox.options.length=0;
  for(i=0; i<listBox.length; i++) {
    if( listBox.options[i].selected ) {
      var key = listBox.options[i].text;
      if(otherStuff[key]) {
        for(j=0; j<otherStuff[key].length; j++) {
        subListBox.options.add(new Option(otherStuff[key][j],otherStuff[key][j]));
        }
      }
    }
  }
}

