// Special thanks go out to Nelluk, MacPro, and chino- from #macintosh on DALnet IRC for their ideas in getting this to be intuitive //
// Note: Using select boxes would not work because Safari 2.x does not support dynamically adding/removing options from a select list //

// function parkchooser (parks) {
//   var index = parks.selectedIndex;
//   if ( index > -1 ) {
//     var buffered = new Array( parks.options[index].text, parks.options[index].value );
//     document.getElementById('firstChoice').innerHTML = buffered[0];
//     alert(parks.options[index]);
//     parks.options[index] = null;
//     alert(parks.options[index]);
//     parks.selectedIndex = -1;
//   }
// }

var choiceIndex = 0;
var chosen = new Array();
chosen[0] = new Array();
chosen[1] = new Array();
chosen[2] = new Array();
var actualParks = new Array();

function parkchooser (thepark) {
  if ( choiceIndex <= 2 ) {
    chosen[choiceIndex][0] = thepark.id;
    chosen[choiceIndex][1] = thepark.innerHTML;
    document.getElementById('choice' + (choiceIndex + 1)).innerHTML = chosen[choiceIndex][1];
    thepark.setAttribute('class','parkhidden');
    thepark.setAttribute('className','parkhidden'); // IE 6 and similar broken browsers
    actualParks[choiceIndex] = ' ' + (choiceIndex + 1) + '. ' + chosen[choiceIndex][1].substr(0, chosen[choiceIndex][1].length - 4); // Returns Park name and rank without the embedded linebreak
    document.getElementById('Park').value = actualParks.toString();
    choiceIndex++;
  }
  else {
    // done with three choices
  }
}

function resetparks () {
  for ( i = 0; i <= 2; i++ ) {
    parkid = chosen[i][0];
    document.getElementById(parkid).setAttribute('class','parkitem');
    document.getElementById(parkid).setAttribute('className','parkitem'); // IE 6 and similar broken browsers
    document.getElementById('choice' + (i + 1)).innerHTML = '';
  }
  // re-initialize
  choiceIndex = 0;
  actualParks = new Array();
  document.getElementById('Park').value = '';
}