function validateContactForm(theForm) {
  if (!validateTextbox(theForm.fullname)) {
      alert("Enter your name");
	  theForm.fullname.focus();
      return false;
  }

  if (!validateTextbox(theForm.phone) && !validateTextbox(theForm.email)) {
	  alert("Enter phone number or email address");
	  theForm.phone.focus();
	  return false;
  }
	
  if (validateTextbox(theForm.email) && !isValidEmail(theForm.email.value)) {
      alert("Enter a valid email address");
      theForm.email.focus();
	  return false;
  }
	
  if (!validateTextbox(theForm.comments)) {
      alert("Enter your comments or question");
	  theForm.comments.focus();
      return false;
  }

  return true;
}

function validateTellForm(theForm) {
  if (!validateTextbox(theForm.fullname)) {
      alert("Enter your name");
	  theForm.fullname.focus();
      return false;
  }

  if (!validateTextbox(theForm.email) || !isValidEmail(theForm.email.value)) {
      alert("Enter a valid email address");
      theForm.email.focus();
	  return false;
  }
	
  if (!validateTextbox(theForm.fullname1)) {
      alert("Enter name for friend 1");
	  theForm.fullname1.focus();
      return false;
  }

  if (!validateTextbox(theForm.email1) || !isValidEmail(theForm.email1.value)) {
      alert("Enter a valid email address for friend 1");
      theForm.email1.focus();
	  return false;
  }

  if (!validateTextbox(theForm.fullname2) && validateTextbox(theForm.email2)) {
      alert("Enter name for friend 2");
      theForm.fullname2.focus();
	  return false;
  }

  if (validateTextbox(theForm.fullname2) && !validateTextbox(theForm.email2)) {
      alert("Enter a valid email address for friend 2");
      theForm.email2.focus();
	  return false;
  }

  if (validateTextbox(theForm.email2) && !isValidEmail(theForm.email2.value)) {
      alert("Enter a valid email address for friend 2");
      theForm.email2.focus();
	  return false;
  }

  return true;
}

function validateTextbox(control) {
  if (isEmpty(control)) {
    return false;
  }
  else {
    return true;
  }
}