/* 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 states = new Array();

states['College'] = new Array('1-5,000 FTE','5,001-15,000 FTE','15,000+ FTE');
states['Library'] = new Array('1-10,000 Pop','10,001-50,000 Pop','50,000+ Pop');
states['Govt Agency'] = new Array('1-100 Emp','101-1,000 Emp','1,000+ Emp');
states['For Profit'] = new Array('1-100 Emp','101-1,000 Emp','1,000+ Emp');
states['PK12 Ed'] = new Array('1,1000 FTE','1,001-2,000 FTE','2,000+ FTE');


// City lists
var cities = new Array();

cities['College'] = new Array();
cities['College']['1-5,000 FTE']          = new Array('Full Database - $750','Full Alerts - $750','Full DB+Alerts - $1000','Single Segment - $300','Single Alerts - $300','Single Seg+Alerts - $450');
cities['College']['5,001-15,000 FTE'] = new Array('Full Database - $1000','Full Alerts - $1000','Full DB+Alerts - $1500','Single Segment - $350','Single Alerts - $350','Single Seg+Alerts - $525');
cities['College']['15,000+ FTE']          = new Array('Full Database - $1500','Full Alerts - $1500','Full DB+Alerts - $2000','Single Segment - $600','Single Alerts - $600','Single Seg+Alerts - $1000');

cities['Library'] = new Array();
cities['Library']['1-10,000 Pop'] = new Array('Full Database - $750','Full Alerts - $750','Full DB+Alerts - $1000','Single Segment - $300','Single Alerts - $300','Single Seg+Alerts - $450');
cities['Library']['10,001-50,000 Pop']       = new Array('Full Database - $1000','Full Alerts - $1000','Full DB+Alerts - $1500','Single Segment - $350','Single Alerts - $350','Single Seg+Alerts - $525');
cities['Library']['50,000+ Pop']         = new Array('Full Database - $1500','Full Alerts - $1500','Full DB+Alerts - $2000','Single Segment - $600','Single Alerts - $600','Single Seg+Alerts - $1000');

cities['Govt Agency'] = new Array();
cities['Govt Agency']['1-100 Emp'] = new Array('Full Database - $750','Full Alerts - $750','Full DB+Alerts - $1000','Single Segment - $300','Single Alerts - $300','Single Seg+Alerts - $450');
cities['Govt Agency']['101-1,000 Emp']    = new Array('Full Database - $1000','Full Alerts - $1000','Full DB+Alerts - $1500','Single Segment - $350','Single Alerts - $350','Single Seg+Alerts - $525');
cities['Govt Agency']['1,000+ Emp']   = new Array('Full Database - $1500','Full Alerts - $1500','Full DB+Alerts - $2000','Single Segment - $600','Single Alerts - $600','Single Seg+Alerts - $1000');

cities['For Profit'] = new Array();
cities['For Profit']['1-100 Emp'] = new Array('Full Database - $750','Full Alerts - $750','Full DB+Alerts - $1000','Single Segment - $300','Single Alerts - $300','Single Seg+Alerts - $450');
cities['For Profit']['101-1,000 Emp']    = new Array('Full Database - $1000','Full Alerts - $1000','Full DB+Alerts - $1500','Single Segment - $350','Single Alerts - $350','Single Seg+Alerts - $525');
cities['For Profit']['1,000+ Emp']   = new Array('Full Database - $1500','Full Alerts - $1500','Full DB+Alerts - $2000','Single Segment - $600','Single Alerts - $600','Single Seg+Alerts - $1000');

cities['PK12 Ed'] = new Array();
cities['PK12 Ed']['1-1000 FTE'] = new Array('Full Database - $750','Full Alerts - $750','Full DB+Alerts - $1000','Single Segment - $300','Single Alerts - $300','Single Seg+Alerts - $450');
cities['PK12 Ed']['1,001-2,000 FTE']    = new Array('Full Database - $1000','Full Alerts - $1000','Full DB+Alerts - $1500','Single Segment - $350','Single Alerts - $350','Single Seg+Alerts - $525');
cities['PK12 Ed']['2,000+ FTE']   = new Array('Full Database - $1500','Full Alerts - $1500','Full DB+Alerts - $2000','Single Segment - $600','Single Alerts - $600','Single Seg+Alerts - $1000');

function setStates() {
  cntrySel = document.getElementById('country');
  stateList = states[cntrySel.value];
  changeSelect('state', stateList, stateList);
  setCities();
}

function setCities() {
  cntrySel = document.getElementById('country');
  stateSel = document.getElementById('state');
  cityList = cities[cntrySel.value][stateSel.value];
  changeSelect('city', cityList, cityList);
}

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() {
  //setStates();
});

