function handleCancel() {
  if( confirm( "Are you sure you want to cancel and return to the home page?" ) ) {
    window.location = '/';
  }
}

// *************** used by /join/1-basic.jsp
function initJoinStep1() {
  // Select the user's country in the list...
  var countryOptions = document.mainForm.country.options;
  for( var i = 0; i < countryOptions.length; i++ ) {
    if( countryOptions[i].value == country ) {
      countryOptions[i].selected = true;
    }
  }
  // Focus the first entry field...
  document.mainForm.email.focus();
}

// *************** used by /join/2-address.jsp
function initJoinStep2() {
    document.mainForm.firstName.focus();
}

// *************** used by /join/3-security.jsp
function initJoinStep3() {
  document.mainForm.password.focus();
  toggleSubmit();
}

// ********** used by 3-security to submit once and disable form button
function createAccount(){
document.mainForm.submit();
document.mainForm.submitButton.disabled=true;
}

function handleNext() {
  nextLocation = "";
  for( var i = 0; i < document.mainForm.nextForm.length; i++ ) {
    if( document.mainForm.nextForm[i].checked ) {
      nextLocation = document.mainForm.nextForm[i].value;
    }
  }
  window.location = "template.jsp?page=" + nextLocation;
}

/*
 * Only enable the submit button if the player has agreed to the terms
 * and conditions
 */
function toggleSubmit() {
  if( document.mainForm.agreeToTerms.checked == true ) {
    document.mainForm.submitButton.disabled = false;
  } else {
    document.mainForm.submitButton.disabled = true;
  }
}
