<!--
function disableOptionalServices(theForm, packageNum) {
  /*if (packageNum >= 2) {
    disableCheckbox(theForm.option_logo);
    disableCheckbox(theForm.option_email);
    disableCheckbox(theForm.option_map);
  }

  if (packageNum >= 3) {
    disableCheckbox(theForm.option_photo);
    disableCheckbox(theForm.option_login);
  }

  if (packageNum >= 4) {
    disableCheckbox(theForm.option_hyperlink);
  }*/
}

function disableCheckbox(theCheckbox) {
  theCheckbox.checked = true;
  theCheckbox.disabled = true;
}

function validate(theForm) {
  var errMsg = '';

  // Check for a package
  if (!(hasSelectedPackage(theForm))) {
    errMsg = errMsg + '* Your preferred package\n';
  }

  // Check name and phone number
  if ((isEmpty(theForm.first_name.value)) || (isEmpty(theForm.last_name.value))) {
    errMsg = errMsg + '* Your first and last name\n';
  }

  if (!(isValidPhoneNumber(theForm.phone.value))) {
    errMsg = errMsg + '* Your phone number\n';
  }

  if (!(isValidEmail(theForm.email.value))) {
    errMsg = errMsg + '* Your e-mail address\n';
  }
  
  var isValid = false;
  if (errMsg == '') {
    theForm.action = '/advertiser.php';
    isValid = true;
  }
  else {
    alert("Please enter or verify the following fields:\n" + errMsg);
  }

  return isValid;
}

function hasSelectedPackage(theForm) {
  var hasSelectedPackage = false;
  for (i = 0; i < theForm.packageNum.length; i++) {
    if (theForm.packageNum[i].checked) {
      hasSelectedPackage = true;
      break;
    }
  }

  return hasSelectedPackage;
}

function isEmpty(str) {
  return (str == undefined || str == '');
}

function isValidPhoneNumber(str) {
  var re = /^\d{3}-\d{3}-\d{4}$/;
  return (re.test(str));
}

function isValidEmail(str) {
// Note: The next expression must be all on one line...
//       allow no spaces, linefeeds, or carriage returns!
  var re = /\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi;
  return (re.test(str));
}
// -->