// JavaScript Document

var submitcounta=0;

function checkFields1() {                       // field validation -
if ( (document.form1.id.value=="")  ||
		(document.form1.password.value=="") ) // checks if fields are blank.
  
   {
   alert("Please enter a value into each text field, then re-submit this form.");
   return false;
   }

else 
    {
    if (submitcounta == 0)
    {
    submitcounta++;
    return true;
    }
    else 
      {
      alert("This form has already been submitted.  Thank You!");
      return false;
      }
   }
}

function validatepw(field) {
var valid = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890_";
var ok = "yes";
var temp;

if (field.value.length!=0 && field.value.length<4) {
alert("Please enter at least 4 characters.");
field.focus();
field.select();
}
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Please enter only letters, numbers and underscores for your id and password.");
field.focus();
field.select();
   }
}


var submitcount=0;

function checkFields3() {                       // field validation -
if ( (document.form3.Email.value=="")    ) // checks if fields are blank.
  
   {
   alert("Please enter an email address, then re-submit this form.");
   return false;
   }

else 
    {
    if (submitcount == 0)
    {
    submitcount++;
    return true;
    }
    else 
      {
      alert("This form has been submitted. Please be patient, this process could take up to 60 seconds. Thank You!");
      return false;
      }
   }
}


function validateemail(field) {
var valid = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789.@-_ ";
var ok = "yes";
var temp;

   if ((field.value.indexOf('@',0)==-1 ||
	   field.value.indexOf('@',0)==0 ||
       field.value.indexOf('.',0)==-1) &&
	   field.value.length!=0) {
    alert('\nInvalid email address.')
field.focus();
field.select();
}

for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Please enter a valid email address.");
field.focus();
field.select();
   }
}


var submitcounta=0;

function checkFields2() {                       // field validation -
if ( (document.form2.id.value=="")  ||
		(document.form2.password.value=="") ) // checks if fields are blank.
  
   {
   alert("Please enter a value into each text field, then re-submit this form.");
   return false;
   }

else 
    {
    if (submitcounta == 0)
    {
    submitcounta++;
    return true;
    }
    else 
      {
      alert("This form has already been submitted.  Thank You!");
      return false;
      }
   }
}
