function Validator1(theForm)
{
	     PCode=theForm.fname.value
		 PCode1=theForm.lname.value
     	 PCode4=theForm.email.value
		 PCode5=theForm.email1.value
	     	     
         FieldLen=CountSpaces(PCode)
         if (PCode.length == lenField || PCode.length == null || PCode.length=="" ){
            alert("Please enter a value.")
			theForm.fname.focus()  
		    return false
		 }	

  if (theForm.fname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.fname.focus();
    return (false);
  }

  if (theForm.fname.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"First Name\" field.");
    theForm.fname.focus();
    return (false);
  }

  if (theForm.fname.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"First Name\" field.");
    theForm.fname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.fname.value;
  var allValid = true;
  var validGroups = 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 and whitespace characters in the \"First Name\" field.");
    theForm.fname.focus();
    return (false);
  }

 FieldLen=CountSpaces(PCode1)
         if (PCode1.length == lenField || PCode1.length == null || PCode1.length=="" ){
            alert("Please enter a value for the \"Last Name\" field.")
			theForm.lname.focus()  
		    return false
		 }


  if (theForm.lname.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.lname.focus();
    return (false);
  }

  if (theForm.lname.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Last Name\" field.");
    theForm.lname.focus();
    return (false);
  }

  if (theForm.lname.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"Last Name\" field.");
    theForm.lname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.lname.value;
  var allValid = true;
  var validGroups = 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 and whitespace characters in the \"Last Name\" field.");
    theForm.lname.focus();
    return (false);
  }
		 
  if (theForm.dphone.value.length < 6)
  {
    alert("Please enter Day Phone No.");
    theForm.dphone.focus();
    return (false);
  }

FieldLen=CountSpaces(PCode4)
        if (PCode4.length == lenField || PCode4.length == null || PCode4.length=="" ){
            alert("Please enter a value for the \"email1\" field.")
			theForm.email1.focus()  
		    return false
		 }
		 
  if (theForm.email1.value == "")
  {
    alert("Please enter a value for the \"email1\" field.");
    theForm.email1.focus();
    return (false);
  }

  if (theForm.email1.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"email1\" field.");
    theForm.email1.focus();
    return (false);
  }
  
   FieldLen=CountSpaces(PCode5)
        
        if (PCode5.length == lenField || PCode5.length == null || PCode5.length=="" ){
            alert("Please enter a value for the \"email12\" field.")
			theForm.email12.focus()  
		    return false
		 }

  if (theForm.email2.value == "")
  {
    alert("Please enter a value for the \"email2\" field.");
    theForm.email2.focus();
    return (false);
  }

  if (theForm.email2.value !== theForm.email1.value)
  {
    alert("Email Address are not same, Please enter again");
    theForm.email2.focus();
    return (false);
  }

  if (theForm.email2.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"email2\" field.");
    theForm.email2.focus();
    return (false);
  }
  return (true);
}

function Validator2(theForm)
{
	if (Validator1(theForm) == false)
	{
	    return (false);		
	}

		 PCode2=theForm.address1.value
		 PCode3=theForm.city.value
	     	     
         FieldLen=CountSpaces(PCode)
         if (PCode.length == lenField || PCode.length == null || PCode.length=="" ){
            alert("Please enter a value.")
			theForm.fname.focus()  
		    return false
		 }	

 FieldLen=CountSpaces(PCode2)
        
        if (PCode2.length == lenField || PCode2.length == null || PCode2.length=="" ){
            alert("Please enter a value for the \"Address\" field.")
			theForm.address1.focus()  
		    return false
		 }

  if (theForm.address1.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.address1.focus();
    return (false);
  }

  if (theForm.address1.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Address\" field.");
    theForm.address1.focus();
    return (false);
  }
  
 FieldLen=CountSpaces(PCode3)
        
        if (PCode3.length == lenField || PCode3.length == null || PCode3.length=="" ){
            alert("Please enter a value for the \"City\" field.")
			theForm.city.focus()  
		    return false
		 }

  if (theForm.city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.city.focus();
    return (false);
  }

  if (theForm.city.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"City\" field.");
    theForm.city.focus();
    return (false);
  }

  if (theForm.state.selectedIndex < 0)
  {
    alert("Please select one of the \"State\" options.");
    theForm.state.focus();
    return (false);
  }

  if (theForm.zip.value == "")
  {
    alert("Please enter a value for the \"Zip Code\" field.");
    theForm.zip.focus();
    return (false);
  }

  if (theForm.zip.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Zip Code\" field.");
    theForm.zip.focus();
    return (false);
  }

  if (theForm.zip.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"Zip Code\" field.");
    theForm.zip.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex < 0)
  {
    alert("Please select one of the \"Country\" options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex == 0)
  {
    alert("The first \"Country\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.age.selectedIndex == 0)
  {
    alert("The first \"Age\" option is not a valid selection.  Please choose one of the other options.");
    theForm.age.focus();
    return (false);
  }

  if (theForm.start.selectedIndex < 0)
  {
    alert("Please select one of the \"Start Time\" options.");
    theForm.start.focus();
    return (false);
  }

  if (theForm.start.selectedIndex == 0)
  {
    alert("The first \"Start Time\" option is not a valid selection.  Please choose one of the other options.");
    theForm.start.focus();
    return (false);
  }

  if (theForm.hsyears.selectedIndex < 0)
  {
    alert("Please select one of the \"High School Years\" options.");
    theForm.hsyears.focus();
    return (false);
  }

  if (theForm.hsyears.selectedIndex == 0)
  {
    alert("The first \"High School Years\" option is not a valid selection.  Please choose one of the other options.");
    theForm.hsyears.focus();
    return (false);
  }
  return (true);
}

function callxURL(){
newwindow=window.open("/nhsPrivacy.asp", null, "location=1, status=1, scrollbars=1, width=450,height=350");
  if (window.focus) {newwindow.focus()}
}

function OnSendF()
{
    document.FrontPage_Form1.action = "http://www.nationalhighschool.com/form/add_app_gl.asp";
}

function CountSpaces(FieldName){
         
    	lenField=0
    	Len=FieldName.length
       	for (var i= 0 ; i < Len ; i++){
		     chr=FieldName.charCodeAt(i)
	 		if (chr==32)
         	lenField=lenField+1
		 }
return lenField 	  		   	
}      
