// JavaScript Document

<!-- Begin popUp
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1000,height=780');");
}
// End -->

<!-- Begin Reset Form
function ResetForm(which){
var pass=true;
var first=-1;
if (document.images){
	for (i=0;i<which.length;i++){
		var tempobj=which.elements[i];
 		if (tempobj.type=="text"){
  			eval(tempobj.value="");
 			if (first==-1) {first=i};
 		}
 		else if (tempobj.type=="checkbox") {
  			eval(tempobj.checked=0);
  			if (first==-1) {first=i};
 		}
 		else if (tempobj.col!="") {
 			eval(tempobj.value="");
  			if (first==-1) {first=i};
 		}
	}
}
which.elements[first].focus();
return false;
}
// End -->


<!-- Begin Email Check Function
function emailCheck(emailStr) {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
		}
	var user=matchArray[1];
	var domain=matchArray[2];
		if (user.match(userPat)==null) {
   		alert("The username doesn't seem to be valid.");
		return false;
		}
	var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {
  			for (var i=1;i<=4;i++) {
		    	if (IPArray[i]>255) {
	       		alert("Destination IP address is invalid!");
				return false;
 	   			}
   			}
		return true;
		}

	var domainArray=domain.match(domainPat);
		if (domainArray==null) {
			alert("The domain name doesn't seem to be valid.");
    		return false;
		}
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
		   alert("The address must end in a three-letter domain, or two letter country.");
		   return false;
		}
		if (len<2) {
			var errStr="This address is missing a hostname!";
			alert(errStr);
  			return false;
			}
		return true;
	}
// End -->


<!-- Begin ContactForm Check
function ContactFormValidator(theForm)
{
   <!-- Begin Your Name Field Check
  if (theForm.realname.value == "")
  {
    alert("Please enter a value for the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }

  if (theForm.realname.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,- ";
  var checkStr = theForm.realname.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 .,- characters in the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }
  <!-- Begin Email Check
  return emailCheck(theForm.email.value)
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"E-Mail\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length > 0)
  {
	return emailCheck(theForm.email.value);
  }
}


<!-- Begin NewsletterForm Check
function NewsletterValidator(theForm)
{
   <!-- Begin Your Name Field Check
  if (theForm.realname.value == "")
  {
    alert("Please enter a value for the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }

  if (theForm.realname.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,- ";
  var checkStr = theForm.realname.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 .,- characters in the \"Your Name\" field.");
    theForm.realname.focus();
    return (false);
  }

  
  <!-- Begin Address1 Field Check
  if (theForm.Address1.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.Address1.focus();
    return (false);
  }

  if (theForm.Address1.value.length < 8)
  {
    alert("Please enter at least 8 characters in the \"Address 1\" field.");
    theForm.Address1.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,-#1234567890 ";
  var checkStr = theForm.Address1.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;
    }
  }
    <!-- Begin Your City Check
    if (theForm.City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
  var checkStr = theForm.City.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 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }
  <!-- Begin State Field Check
  if (theForm.State.value < 2)
  {
    alert("Please select one of the \"State\" options.");
    theForm.State.focus();
    return (false);
  }
  
  
      <!-- Begin Zip Check
  if (theForm.Zip.value == "")
  {
    alert("Please enter a value for the \"Zip Code\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Zip Code\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Zip.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Zip Code\" field.");
    theForm.Zip.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.Zip.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 digit/dash characters in the \"Zip Code\" field.");
    theForm.Zip.focus();
    return (false);
  }
  
  
  <!-- Begin Phone Field Check
  if (theForm.Phone.value == "")
  {
    alert("Please enter a value for the \"Phone Number\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the \"Phone Number\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (theForm.Phone.value.length > 12)
  {
    alert("Please enter at most 12 characters in the \"Phone Number\" field.");
    theForm.Phone.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.Phone.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 digit/dash characters in the \"Phone Number\" field.");
    theForm.Phone.focus();
    return (false);
  }

 
  <!-- Begin Email Check
  return emailCheck(theForm.email.value)
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"E-Mail\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length > 0)
  {
	return emailCheck(theForm.email.value);
  }
}