function check_form ()
{
  valid = true; // assume valid
	var today=new Date(); 
	var tyear=today.getYear();

//alert(document.update.subject.value)

  if (document.update.fname.value.length == 0)
     { valid = false; alert('First Name Must be Filled In!');
      document.update.fname.focus();return false; }
  if (document.update.lname.value.length == 0)
     { valid = false; alert('Last Name Must be Filled In!');
      document.update.lname.focus();return false; }

	if (document.update.hphone.value.length == 0)
		 { valid = false; alert('Home phone Must be Filled In!');
			document.update.hphone.focus(); return false; }

  if (document.update.address1old.value.length > 0 ||
      document.update.address2old.value.length > 0 ||
      document.update.cityold.value.length > 0 ||
      document.update.stateold.selectedIndex == true ||
      document.update.zipold.value.length > 0 ){

			if (document.update.address1old.value.length == 0)
				 { valid = false; alert('Old Address line 1 Must be Filled In!');
					document.update.address1old.focus(); return false;}

			if (document.update.cityold.value.length == 0)
				 { valid = false; alert('Old City Must be Filled In!');
					document.update.cityold.focus(); return false;}

			if (document.update.stateold.selectedIndex == false)
				 { valid = false; alert('Old State Must be Filled In!');
					document.update.stateold.focus();return false; }

			if (document.update.zipold.value.length == 0)
				 { valid = false; alert('Old Zip or Postal code Must be Filled In.');
					document.update.zipold.focus(); return false;}
	}

  if (document.update.address1.value.length > 0 ||
      document.update.address2.value.length > 0 ||
      document.update.city.value.length > 0 ||
      document.update.state.selectedIndex == true ||
      document.update.zip.value.length > 0 ){

			if (document.update.address1.value.length == 0)
				 { valid = false; alert('New Address line 1 Must be Filled In!');
					document.update.address1.focus(); return false;}

			if (document.update.city.value.length == 0)
				 { valid = false; alert('New City Must be Filled In!');
					document.update.city.focus(); return false;}

			if (document.update.state.selectedIndex == false)
				 { valid = false; alert('New State Must be Filled In!');
					document.update.state.focus();return false; }

			if (document.update.zip.value.length == 0)
				 { valid = false; alert('New Zip or Postal code Must be Filled In.');
					document.update.zip.focus(); return false;}
	}

  if (document.update.name1.value.length > 0 ||
      document.update.gender1[0].checked ||
      document.update.gender1[1].checked ||
      document.update.mob1.selectedIndex > 0 ||
      document.update.dob1.selectedIndex > 0 ||
      document.update.yob1.value.length > 0 )
	{
				if (!document.update.name1.value.length > 0 ||
					 (!document.update.gender1[0].checked && 
					  !document.update.gender1[1].checked) ||
						!document.update.mob1.selectedIndex > 0 ||
						!document.update.dob1.selectedIndex > 0 ||
						!document.update.yob1.value.length > 0 )
						{valid = false; alert('Child (#1) all info must be filled In.');
							document.update.name1.focus(); return false;}

				if (isNaN(document.update.yob1.value)) 
					{valid = false; alert('Child #1 the Year must be a numeric value');
						document.update.yob1.value=''; 
						document.update.yob1.focus();
						return false;
					}

				if ((tyear - document.update.yob1.value ) > 18 )
						{valid = false; alert('Child #1 must be under 18 years old'); 
						document.update.yob1.value=''; 
						document.update.yob1.focus();
						return false;
					}
}

  if (document.update.name2.value.length > 0 ||
      document.update.gender2[0].checked ||
      document.update.gender2[1].checked ||
      document.update.mob2.selectedIndex > 0 ||
      document.update.dob2.selectedIndex > 0 ||
      document.update.yob2.value.length > 0 )
	{
				if (!document.update.name2.value.length > 0 ||
					 (!document.update.gender2[0].checked &&
						!document.update.gender2[1].checked) ||
						!document.update.mob2.selectedIndex > 0 ||
						!document.update.dob2.selectedIndex > 0 ||
						!document.update.yob2.value.length > 0 )
						{valid = false; alert('Child (#2) all info must be filled In.');
							document.update.name2.focus(); return false;}

				if (isNaN(document.update.yob2.value)) 
					{valid = false; alert('Child #2 the Year must be a numeric value');
						document.update.yob2.value=''; 
						document.update.yob2.focus();
						return false;
					}

				if ((tyear - document.update.yob2.value ) > 18 )
						{valid = false; alert('Child #2 must be under 18 years old'); 
						document.update.yob2.value=''; 
						document.update.yob2.focus();
						return false;
					}
}

	if (document.update.name3.value.length > 0 ||
      document.update.gender3[0].checked ||
      document.update.gender3[1].checked ||
      document.update.mob3.selectedIndex > 0 ||
      document.update.dob3.selectedIndex > 0 ||
      document.update.yob3.value.length > 0 )
	{
				if (!document.update.name3.value.length > 0 ||
					 (!document.update.gender3[0].checked &&
						!document.update.gender3[1].checked) ||
						!document.update.mob3.selectedIndex > 0 ||
						!document.update.dob3.selectedIndex > 0 ||
						!document.update.yob3.value.length > 0 )
						{valid = false; alert('Child (#3) all info must be filled In.');
							document.update.name3.focus(); return false;}

				if (isNaN(document.update.yob3.value)) 
					{valid = false; alert('Child #3 the Year must be a numeric value');
						document.update.yob3.value=''; 
						document.update.yob3.focus();
						return false;
					}

				if ((tyear - document.update.yob3.value ) > 18 )
						{valid = false; alert('Child #3 must be under 18 years old'); 
						document.update.yob3.value=''; 
						document.update.yob3.focus();
						return false;
					}
}


	if (!document.update.marital[0].checked &&
      !document.update.marital[1].checked &&
      !document.update.marital[2].checked &&
      !document.update.marital[3].checked &&
      !document.update.marital[4].checked &&
      !document.update.marital[5].checked )
		  {valid = false; alert('Marital Status Must be Filled In.');
  			document.update.marital[0].focus(); return false;}


  if (document.update.email.value.length > 0)
	  {valid = VerifyEmailaddress1();}

  if (valid)
        {
      //alert("Please be patient while your form is processed. \n" + 	"DO NOT CLICK SUBMIT AGAIN, \n" +  "It can result in a duplicate information." + 			"\n\n Click OK to Continue.");

			if (document.update.email.value.length == 0)
				{document.update.email.value = "information@ffmwoc.org";}

			if (document.update.gender1[0].checked){document.update.cgender1.value = "Male";}
			if (document.update.gender1[1].checked){document.update.cgender1.value = "Female";}
			if (document.update.gender2[0].checked){document.update.cgender2.value = "Male";}
			if (document.update.gender2[1].checked){document.update.cgender2.value = "Female";}
			if (document.update.gender3[0].checked){document.update.cgender3.value = "Male";}
			if (document.update.gender3[1].checked){document.update.cgender3.value = "Female";}

			if (document.update.marital[0].checked){document.update.status.value = "Single";}
			if (document.update.marital[1].checked){document.update.status.value = "Married";} 
			if (document.update.marital[2].checked){document.update.status.value = "Widowed";}
			if (document.update.marital[3].checked){document.update.status.value = "Separated";}
			if (document.update.marital[4].checked){document.update.status.value = "Divorced";}
			if (document.update.marital[5].checked){document.update.status.value = "Deceased";}

      document.update.submit();
      return true;

        }
   document.update.email.focus();
   return false;
}


function VerifyEmailaddress1()
{
  var Reason  = "Your Email address1 appears incorrect.  \n\nPlease check. \n\nReason:"
  var Success = "Email address1 entered Correctly!"
  var checkStr = document.update.email.value;
  var ix = (checkStr.length - 4)
  var RC = true;
  var x = AtSignValid = DoublePeriod = PeriodValid = SpaceValid = ExtValid = RL = 0;

  for (i = 0;  i < checkStr.length;  i++)
  {
    if (checkStr.charAt(i) == '@')
      AtSignValid++;
    else if (checkStr.charAt(i) == '.')
    {
      if (x == (i-1))
        DoublePeriod++;
      else
      {
        x = i;
        PeriodValid++;
      }
    }
    else if (checkStr.charAt(i) == ' ')
      SpaceValid ++;
  }
  if (checkStr.indexOf(".com", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".edu", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".biz", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".net", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".org", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".gov", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".mil", ix) > -1)
    ExtValid++;
  else if (checkStr.indexOf(".cc", ix) > -1)
    ExtValid++;
  RL = Reason.length;
  if (AtSignValid != 1)
    Reason += "\nOnly one '@' allowed, " + AtSignValid + " found.";
  if (PeriodValid == 0)
    Reason += "\naddress1 must contain at least one period.";
  if (SpaceValid > 0)
    Reason += "\nNo Spaces allowed. address1 contains " + SpaceValid + " space";
  if (SpaceValid > 1)
    Reason += "s.";
  if (checkStr.length > 120)
    Reason += "\nPlease limit the Email address1 to 120 characters.";

  if (RL != Reason.length)
  {
 alert(Reason);
 return false;
  }
  return true;
}

