
function validate()
{

//****************************************************************************************  
//check the Name for blank and characters

if (document.Contact.name.value.length < 2)
  {
    alert("Please enter your Name.");
    document.Contact.name.select();
    document.Contact.name.focus();
    return false;
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789., ";
  var checkStr = document.Contact.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 letters, whitespace and \"-\" characters in the Name field.");
    document.Contact.name.select();
    document.Contact.name.focus();
    return false;
  }  
  
//****************************************************************************************  
//check the Company for blank

if (document.Contact.company.value.length < 2)
  {
    alert("Please enter your Company.");
    document.Contact.company.select();
    document.Contact.company.focus();
    return false;
  }

//****************************************************************************************  
//check the Address for blank

if (document.Contact.address.value.length < 2)
  {
    alert("Please enter your Address.");
    document.Contact.address.select();
    document.Contact.address.focus();
    return false;
  }

//****************************************************************************************
//check the E-Mail Address

if (!(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/.test(document.Contact.email.value)))
  {
	alert("The e-mail address is blank or does not appear to be valid.  Please re-enter.");
	document.Contact.email.select();
	document.Contact.email.focus();
	return false;
  }

//****************************************************************************************  
//check the City for blank

if (document.Contact.city.value.length < 2)
  {
    alert("Please enter your City.");
    document.Contact.city.select();
    document.Contact.city.focus();
    return false;
  }

//****************************************************************************************  
//check the State for blank

if (document.Contact.state.value.length < 2)
  {
    alert("Please select your State.");
    document.Contact.state.focus();
    return false;
  }
  
//****************************************************************************************  
//check the Zip for blank and characters

if (document.Contact.zip.value.length < 5)
  {
    alert("Please enter your 5-digit Zip.");
    document.Contact.zip.select();
    document.Contact.zip.focus();
    return false;
  }  

  var checkOK = "0123456789";
  var checkStr = document.Contact.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 numbers in the Zip field.");
    document.Contact.zip.select();
    document.Contact.zip.focus();
    return false;
  }  
 	return true;
 }

function move_cursor(current_box, next_box, length)
 {
	temp = current_box.value;
 	if (temp.length==length)  next_box.focus();
 	return true;
 }

