function Form1_Validator(theForm)
{
  	if (theForm.myname.value == "")
  {
    alert("Please enter your name.");
    theForm.myname.focus();
    return (false);
  }
	if (theForm.myphone.value == "")
  {
    alert("Please enter your Phone Number.");
    theForm.myphone.focus();
    return (false);
  }	
	if (!theForm.myphone.value.match(/^\d{3}-\d{3}-\d{4}$/))
	{
	alert ("Your phone number must be in the format 123-456-7891");
    theForm.myphone.focus();
	return false;
	}
  	if (theForm.myemail.value == "")
  {
    alert("Please enter a valid email address.");
    theForm.myemail.focus();
    return (false);
  }
	if (theForm.myemail.value != theForm.myemailconfirm.value)
	{
		alert("Your two email addresses are not the same.");
		theForm.myemailconfirm.focus();
		return (false);
	}

	if (theForm.fname.value == "")
  {
    alert("Please enter your Friend's name.");
    theForm.fname.focus();
    return (false);
  }
	if (theForm.fphone.value == "")
  {
    alert("Please enter your Friend's Phone Number.");
    theForm.fphone.focus();
    return (false);
  }	
	if (!theForm.fphone.value.match(/^\d{3}-\d{3}-\d{4}$/))
	{
	alert ("Your Friend's phone number must be in the format 123-456-7891");
    theForm.fphone.focus();
	return false;
	}
  	if (theForm.femail.value == "")
  {
    alert("Please enter a valid email address for your friend.");
    theForm.femail.focus();
    return (false);
  }
	if (theForm.femail.value != theForm.femailconfirm.value)
	{
		alert("Your Friend's two email addresses are not the same.");
		theForm.femailconfirm.focus();
		return (false);
	}
  	if (theForm.fcity.value == "")
  {
    alert("Please tell us in what city your friend lives.");
    theForm.fcity.focus();
    return (false);
  }
  	if (theForm.fstate.value == "")
  {
    alert("Please tell us in what state your friend lives.");
    theForm.fstate.focus();
    return (false);
  }
}

