
function Form_Valid() {

	if (document.registerform.email.length < 1) {
		alert("Please enter a valid e-mail address in the E-mail field.");
		document.registerform.email.focus();
		return false;
	}


  if (document.registerform.name.value.length < 1)
  {
    alert("Please enter a valid name in the Name field.");
    document.registerform.name.focus();
    return false;
  }


  var checkOK = validChar;
  var checkStr = document.registerform.name.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter characters in the Name field.");
    document.registerform.name.focus();
    return false;
  }


  if (document.registerform.Address.value.length > 30)
  {
    alert("Please enter at most 30 characters in the School Address field.");
    document.registerform.Address.focus();
    return false;
  }


  if (document.registerform.City.value.length < 1)
  {
    alert("Please enter a valid city in the \"City\" field.");
    document.registerform.City.focus();
    return false;
  }

  if (document.registerform.City.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"City\" field.");
    document.registerform.City.focus();
    return false;
  }

  if (document.registerform.Zip.value == "")
  {
    alert("Please enter a value for the \"Postal Code\" field.");
    document.registerform.Zip.focus();
    return false;
  }

  if (document.registerform.Zip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Postal Code\" field.");
    document.registerform.Zip.focus();
    return false;
  }

  if (document.registerform.Zip.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Postal Code\" field.");
    document.registerform.Zip.focus();
    return false;
  }

  var checkOK = validNum+ validChar + " -";
  var checkStr = document.registerform.Zip.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digits, letters and \"-\" characters in the \"Postal Code\" field.");
    document.registerform.Zip.focus();
    return false;
  }

  if (document.registerform.Phone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    document.registerform.Phone.focus();
    return false;
  }

  if (document.registerform.Phone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the \"Phone\" field.");
    document.registerform.Phone.focus();
    return false;
  }

  if (document.registerform.Phone.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Phone\" field.");
    document.registerform.Phone.focus();
    return false;
  }

  var checkOK = validNum+"() -.";
  var checkStr = document.registerform.Phone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digit, blanks and \"()-\" characters in the \"Phone\" field.");
    document.registerform.Phone.focus();
    return false;
  }


  if (document.registerform.school1.value.length > 30)
  {
   alert("Please enter at most 30 characters in the \"School\" field.");
    document.registerform.school1.focus();
    return false;
  }

  if (document.registerform.school1.value.length < 1)
    {
     alert("Please enter your school name");
      document.registerform.school1.focus();

      return false;
  }


return true;
}
function registerclick() {

	if (Form_Valid())
      return true;

}

var validChar = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var validNum = "0123456789";



function openSSWindow() {
  poptestWin = window.open('/ssno.htm', 'ssno', 'scrollbars=0,width=300,height=375')
}

function openReq() {
	window.open('systemreq.htm','sys','scrollbars=0,width=300,height=375')
}

function ValidReg() {

  if (document.registerform.HeadName.value == "")
  {
    alert("Please enter a value for the Head Teacher field.");
    document.registerform.HeadName.focus();
    return (false);
  }


  var checkOK = validChar + "-,.";
  var checkStr = document.registerform.HeadName.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter characters in the Head Teacher field.");
    document.registerform.HeadName.focus();
    return (false);
  }


  if (document.registerform.address.value == "")
  {
    alert("Please enter a value for the Street Address field.");
    document.registerform.address.focus();
    return (false);
  }

  if (document.registerform.address.value.length < 1)
  {
    alert("Please enter at least 1 character in the Address field.");
    document.registerform.address.focus();
    return (false);
  }

  if (document.registerform.address.value.length > 30)
  {
    alert("Please enter at most 30 characters in the Address field.");
    document.registerform.address.focus();
    return (false);
  }

  if (document.registerform.city.value == "")
  {
    alert("Please enter a value for the City field.");
    document.registerform.city.focus();
    return (false);
  }

  if (document.registerform.city.value.length < 1)
  {
    alert("Please enter at least 1 character in the City field.");
    document.registerform.city.focus();
    return (false);
  }

  if (document.registerform.city.value.length > 30)
  {
    alert("Please enter at most 30 characters in the City field.");
    document.registerform.city.focus();
    return (false);
  }

  if (document.registerform.zip.value == "")
  {
    alert("Please enter a value for the Postal Code field.");
    document.registerform.zip.focus();
    return (false);
  }

  if (document.registerform.zip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the Postal Code field.");
    document.registerform.zip.focus();
    return (false);
  }

  if (document.registerform.zip.value.length > 10)
  {
    alert("Please enter at most 10 characters in the Postal Code field.");
    document.registerform.zip.focus();
    return (false);
  }

  var checkOK = validNum + validChar + " -";
  var checkStr = document.registerform.zip.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digits, letters, and \"-\" characters in the Postal Code field.");
    document.registerform.zip.focus();
    return (false);
  }

  if (document.registerform.phone.value == "")
  {
    alert("Please enter a value for the Phone field.");
    document.registerform.phone.focus();
    return (false);
  }

  if (document.registerform.phone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the Phone field.");
    document.registerform.phone.focus();
    return (false);
  }

  if (document.registerform.phone.value.length > 20)
  {
    alert("Please enter at most 20 characters in the Phone field.");
    document.registerform.phone.focus();
    return (false);
  }

  var checkOK = validNum+"() -";
  var checkStr = document.registerform.phone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digit, blanks and \"()-\" characters in the Phone field.");
    document.registerform.phone.focus();
    return (false);
  }



  if (document.registerform.school.value.length > 30)
  {
   alert("Please enter at most 30 characters in the School field.");
    document.registerform.school.focus();
    return (false);
  }

  if (document.registerform.school.value.length < 1)
    {
     alert("Please enter at least one school name");
      document.registerform.school.focus();

      return (false);
  }

if (document.registerform.ISD.value.length > 30)
  {
   alert("Please enter at most 30 characters in the School District field.");
    document.registerform.ISD.focus();
    return (false);
  }

  if (document.registerform.ISD.value.length < 1)
    {
     alert("Please enter your school district");
      document.registerform.ISD.focus();

      return (false);
  }
  if (document.registerform.email.value == "" ) {
  	alert("Please enter a valid e-mail address");
  		document.registerform.email.focus();
  		return(false);
  	}
with (document.registerform){
	if (payby[1].checked || payby[2].checked || payby[3].checked ) {
			if (!numyr[0].checked && !numyr[1].checked) {
					alert("Please select the number of years for your Charms membership");
					return false;
			}
	}

}
return(true);
}

function ValidRegUC(f) {

  if (f.fname.value == "")
  {
    alert("Please enter a First Name.");
    f.fname.focus();
    return (false);
  }


  var checkOK = validChar + "-,.";
  var checkStr = f.fname.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter characters in the First Name field.");
    f.fname.focus();
    return (false);
  }

// last name
if (f.lname.value == "")
    {
      alert("Please enter a value for the Last Name field.");
      f.lname.focus();
      return (false);
    }


    var checkOK = validChar + "-,.";
    var checkStr = f.lname.value;
    var allValid = true;
    for (i = 0;  i < checkStr.length;  i++)
    {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++)
        if (ch == checkOK.charAt(j))
          break;
      if (j == checkOK.length)
      {
        allValid = false;
        break;
      }
    }
    if (!allValid)
    {
      alert("Please enter only letter characters in the Last Name field.");
      f.lname.focus();
      return (false);
    }
if (f.fname2.value != "") {





	  var checkOK = validChar + "-,.";
	  var checkStr = f.fname2.value;
	  var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
	  }
	  if (!allValid)
	  {
		alert("Please enter only letter characters in the First Name field.");
		f.fname2.focus();
		return (false);
	  }

	// last name
	if (f.lname2.value == "")
		{
		  alert("Please enter a value for the Last Name field.");
		  f.lname2.focus();
		  return (false);
		}


		var checkOK = validChar + "-,.";
		var checkStr = f.lname2.value;
		var allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
		  ch = checkStr.charAt(i);
		  for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			  break;
		  if (j == checkOK.length)
		  {
			allValid = false;
			break;
		  }
		}
		if (!allValid)
		{
		  alert("Please enter only letter characters in the Last Name field.");
		  f.lname2.focus();
		  return (false);
		}



} // second attendeed validation


if (f.fname3.value != "") {





	  var checkOK = validChar + "-,.";
	  var checkStr = f.fname3.value;
	  var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
	  }
	  if (!allValid)
	  {
		alert("Please enter only letter characters in the First Name field.");
		f.fname3.focus();
		return (false);
	  }

	// last name
	if (f.lname3.value == "")
		{
		  alert("Please enter a value for the Last Name field.");
		  f.lname3.focus();
		  return (false);
		}


		var checkOK = validChar + "-,.";
		var checkStr = f.lname3.value;
		var allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
		  ch = checkStr.charAt(i);
		  for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			  break;
		  if (j == checkOK.length)
		  {
			allValid = false;
			break;
		  }
		}
		if (!allValid)
		{
		  alert("Please enter only letter characters in the Last Name field.");
		  f.lname3.focus();
		  return (false);
		}



} // third attendeed validation
if (f.fname4.value != "") {





	  var checkOK = validChar + "-,.";
	  var checkStr = f.fname4.value;
	  var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
	  }
	  if (!allValid)
	  {
		alert("Please enter only letter characters in the First Name field.");
		f.fname4.focus();
		return (false);
	  }

	// last name
	if (f.lname4.value == "")
		{
		  alert("Please enter a value for the Last Name field.");
		  f.lname4.focus();
		  return (false);
		}


		var checkOK = validChar + "-,.";
		var checkStr = f.lname4.value;
		var allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
		  ch = checkStr.charAt(i);
		  for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			  break;
		  if (j == checkOK.length)
		  {
			allValid = false;
			break;
		  }
		}
		if (!allValid)
		{
		  alert("Please enter only letter characters in the Last Name field.");
		  f.lname4.focus();
		  return (false);
		}



} // fourth attendeed validation


// address
  if (f.address.value == "")
  {
    alert("Please enter a value for the Address field.");
    f.address.focus();
    return (false);
  }


// city
  if (f.city.value == "")
  {
    alert("Please enter a value for the City field.");
    f.city.focus();
    return (false);
  }
// state
  if (f.state.value == "")
  {
    alert("Please select a state..");
    f.state.focus();
    return (false);
  }

// zip

  if (f.zip.value == "")
  {
    alert("Please enter a value for the Zip Code field.");
    f.zip.focus();
    return (false);
  }

  if (f.zip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the Zip Code field.");
    f.zip.focus();
    return (false);
  }

  if (f.zip.value.length > 10)
  {
    alert("Please enter at most 10 characters in the Zip Code field.");
    f.zip.focus();
    return (false);
  }

  var checkOK = validNum + validChar + " -";
  var checkStr = f.zip.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digits, letters, and \"-\" characters in the Zip Code field.");
    f.zip.focus();
    return (false);
  }
// phone
  if (f.phone.value == "")
  {
    alert("Please enter a value for the Phone field.");
    f.phone.focus();
    return (false);
  }

  if (f.phone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the Phone field.");
    f.phone.focus();
    return (false);
  }

  if (f.phone.value.length > 20)
  {
    alert("Please enter at most 20 characters in the Phone field.");
    f.phone.focus();
    return (false);
  }

  var checkOK = validNum+"() -";
  var checkStr = f.phone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digit, blanks and \"()-\" characters in the Phone field.");
    f.phone.focus();
    return (false);
  }

// cphone
  if (f.cphone.value == "")
  {
    alert("Please enter a value for the Cell Phone field.");
    f.cphone.focus();
    return (false);
  }

  if (f.cphone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the Cell Phone field.");
    f.cphone.focus();
    return (false);
  }

  if (f.cphone.value.length > 20)
  {
    alert("Please enter at most 20 characters in the Cell Phone field.");
    f.cphone.focus();
    return (false);
  }

  var checkOK = validNum+"() -";
  var checkStr = f.cphone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digit, blanks and \"()-\" characters in the Cell Phone field.");
    f.cphone.focus();
    return (false);
  }

// school
  if (f.school.value.length > 30)
  {
   alert("Please enter at most 30 characters in the School field.");
    f.school.focus();
    return (false);
  }

  if (f.school.value.length < 1)
    {
     alert("Please enter your school name");
      f.school.focus();

      return (false);
  }


  if (f.email.value == "" ) {
  	alert("Please enter a valid e-mail address");
  		f.email.focus();
  		return(false);
  	}

if (f.fname2.value != "") {
	  if (f.email2.value == "" ) {
  		alert("Please enter a valid e-mail address");
  		f.email2.focus();
  		return(false);
  	}
} // email 2 validation

if (f.fname3.value != "") {
	  if (f.email3.value == "" ) {
  		alert("Please enter a valid e-mail address");
  		f.email23focus();
  		return(false);
  	}
} // email 3 validation

if (f.fname4.value != "") {
	  if (f.email4.value == "" ) {
  		alert("Please enter a valid e-mail address");
  		f.email4.focus();
  		return(false);
  	}
} // email 4 validation


	with (f){
		if (payby[0].checked  ) {
				if (ponum.value == "") {
						alert("Please enter a purchase order number.");
						ponum.focus();
						return false;
				}
		}

	}

return(true);
}

