<!-- Paste this code into an external JavaScript file named: countryStateCity.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Michael J. Damato :: http://developing.damato.net/ */

// State lists
var volunteer_day = new Array();
volunteer_day['None'] = new Array('None');
volunteer_day['Wednesday'] = new Array('6:00-12:00','12:00 - 4:00','4:00 - 8:00');
volunteer_day['Thursday'] = new Array('5:00','6:00','7:00');

function setTimes() {
  cntrySel = document.getElementById('volunteer_day');
  stateList = volunteer_day[cntrySel.value];
  changeSelect('volunteer_time', stateList, stateList);
  setCities();
}


function changeSelect(fieldID, newOptions, newValues) {
  selectField = document.getElementById(fieldID);
  selectField.options.length = 0;
  for (i=0; i<newOptions.length; i++) {
    selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
  }
}

// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  setTimes();
});


