/* 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 = {
   "Texas" : [ "Woodlands", "Conroe", "Klein", "Magnolia", "Spring", "Tomball", "CollegeStation" ],
   "Florida" : [ "Naples", "Marco Island", "Bonita Springs", "Fort Meyers" ]
};

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]));
        }
      }
    }
  }
}
