 function Validator(theForm)
 {

  /* make sure the IP address domain is valid 
  var IPArray = matchArray[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/); 
 if (IPArray != null)
 { 
     for (var i=1;i<=4;i++) 
     { 
         if (IPArray[i]>255) 
         { 
             alert("Destination IP address is invalid!"); 
             return false; 
       } 
       } 
} */ 

  if (theForm.firstName != null && theForm.firstName.value == "")
  {
     alert("Please enter a value for the \"First Name\" field.");
     theForm.firstName.focus();
     return (false);
  }
  if (theForm.lastName != null && theForm.lastName.value == "")
  {
     alert("Please enter a value for the \"Last Name\" field.");
     theForm.lastName.focus();
     return (false);
  }

  if (theForm.email != null && theForm.email.value == "")
  {
     alert("Please enter a value for the \"E-mail Address\" field.");
     theForm.email.focus();
     return (false);
  }
  
   // checks if the e-mail address is valid --([A-Za-z]\w*(\.[A-Za-z]\w*))
  var emailStr = theForm.email.value;
  var emailPat = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; 
  var matchArray = emailStr.match(emailPat); 
  if (matchArray == null)
  { 
      alert("Your e-mail address seems incorrect. Please try again (check the '@' and '.'s in the e-mail address)"); 
      return false; 
  } 


    if (theForm.confirmEmail != null && theForm.confirmEmail.value == "")
  {
     alert("Please enter a value for the \"Re-Enter E-mail Address\" field.");
     theForm.confirmEmail.focus();
     return (false);
  }


  if (theForm.password != null && theForm.password.value == "")
  {
  	alert("Please enter a value for the \"Password\" field.");
  	theForm.password.focus();
  	return (false);
  }
  
  if (theForm.confirmPassword != null && theForm.confirmPassword.value == "")
  {
  	alert("Please enter a value for the \"Re-Enter Password\" field.");
  	theForm.confirmPassword.focus();
  	return (false);
  }
  
   if (theForm.street != null && theForm.street.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.street.focus();
    return (false);
  }

   if (theForm.city != null && theForm.city.value == "")
  {
    alert("Please enter a value for the \"City / Town\" field.");
    theForm.city.focus();
    return (false);
  }

  if (theForm.zip != null && theForm.zip.value == "")
  {
    if (theForm.country != null && (theForm.country.value == "United States" || theForm.country.value == "Canada")) 
    {
      alert("Please enter a value for the \"ZIP Code\" field.");
      theForm.zip.focus();
      return (false);
    }    
  }
  
  if (theForm.country != null && theForm.country.value == "none")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.country.focus();
    return (false);
  }
  
 
 if (theForm.popup.value == "addpopup")
   {
     alert("Welcome to Brainbench, the best place to start preparing for your future. \n\nSince you are a member of FBLA, we would like to give you a promotional code that is good for one FREE test. After selecting the Brainbench test that you wish to take, simply enter the code below in the promo code box for your FREE test drive. \n\n\Promo Code: FBLA2002\n\nIMPORTANT:  Write this code down now since you will not be able to get back to this page. \n\nBest of luck to you from Brainbench!");
    }  
  return (true);
}