// JavaScript Document

//*********Function to show hide sub tables
function changeTable(the_table,the_change)
{
  if(the_table=="ft" ||the_table=="pt"||the_table=="se")
  {
  the_table="ft";
  var the_style = getStyleObject(the_table);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
  }
  
}

function hideAll()
{
  changeTable("ft","none");

}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}

function changeChild(number,the_change)
{
  if(number>0)
  {
  for(i=1;i<=number;i++)
  {
  the_table="child"+i;
  var the_style = getStyleObject(the_table);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
  }
}
}

function hideChildAll()
{
  number=5;
  changeChild(number,"none");

}

function processForm(theForm)
  {
    if(JoinFormValidator(theForm)){
		$('Submit2').disabled = true;
		$('Submit2').value = "Processing.  Please Wait...";
	
		$('respForm').request({
		  onSuccess: function(transport)
		  {
			if(transport.responseText.match(/^OK/) != null) {
			  window.location = "http://www.alphabuzzgroup.com/Links/FormConfirm.htm";
			} else {
			  alert(transport.responseText);
			}
	
			$('Submit2').value = 'Submit';
			$('Submit2').disabled = false;
		  }
		});
		return false;

	
	}
	else{
	return false;	
	}

  }


function JoinFormValidator(theForm)
{

  if (theForm.newparticipant.selectedIndex < 0)
  {
    alert("Please select one of the \"Participant type\" options.");
    theForm.newparticipant.focus();
    return (false);
  }

  if (theForm.newparticipant.selectedIndex == 0)
  {
    alert("The first \"Participant type\" option is not a valid selection.  Please choose one of the other options.");
    theForm.newparticipant.focus();
    return (false);
  }

  if (theForm.firstname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.firstname.focus();
    return (false);
  }

  if (theForm.firstname.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \"First Name\" field.");
    theForm.firstname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&#402;&#352;&#338;&#381;&#353;&#339;&#382;&#376;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";
  var checkStr = theForm.firstname.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 \"First Name\" field.");
    theForm.firstname.focus();
    return (false);
  }

  if (theForm.lastname.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.lastname.focus();
    return (false);
  }

  if (theForm.lastname.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \"Last Name\" field.");
    theForm.lastname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&#402;&#352;&#338;&#381;&#353;&#339;&#382;&#376;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";
  var checkStr = theForm.lastname.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 \"Last Name\" field.");
    theForm.lastname.focus();
    return (false);
  }

  if (theForm.homeaddress.value == "")
  {
    alert("Please enter a value for the \" residence address line 1\" field.");
    theForm.homeaddress.focus();
    return (false);
  }

  if (theForm.homeaddress.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \" residence address line 1\" field.");
    theForm.homeaddress.focus();
    return (false);
  }

  if (theForm.homecity.value == "")
  {
    alert("Please enter a value for the \"residence city\" field.");
    theForm.homecity.focus();
    return (false);
  }

  if (theForm.homecity.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \"residence city\" field.");
    theForm.homecity.focus();
    return (false);
  }

  if (theForm.homestate.selectedIndex < 0)
  {
    alert("Please select one of the \"residence state\" options.");
    theForm.homestate.focus();
    return (false);
  }

  if (theForm.homestate.selectedIndex == 0)
  {
    alert("The first \"residence state\" option is not a valid selection.  Please choose one of the other options.");
    theForm.homestate.focus();
    return (false);
  }

  if (theForm.homezip.value == "")
  {
    alert("Please enter a value for the \"residence zip code\" field.");
    theForm.homezip.focus();
    return (false);
  }

  if (theForm.homezip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"residence zip code\" field.");
    theForm.homezip.focus();
    return (false);
  }

  if (theForm.homezip.value.length > 5)
  {
    alert("Please enter at most 5 characters in the \"residence zip code\" field.");
    theForm.homezip.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.homezip.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 characters in the \"residence zip code\" field.");
    theForm.homezip.focus();
    return (false);
  }

  if (theForm.homeemail.value == "")
  {
    alert("Please enter a value for the \"non work email address\" field.");
    theForm.homeemail.focus();
    return (false);
  }

  if (theForm.homeemail.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \"non work email address\" field.");
    theForm.homeemail.focus();
    return (false);
  }
  if (theForm.homeemail.value.indexOf("@", 0) < 0)
{
    window.alert("Please enter a valid e-mail address.");
    theForm.homeemail.focus();
    return false;
}

if (theForm.homeemail.value.indexOf(".", 0) < 0)
{
    window.alert("Please enter a valid e-mail address.");
    theForm.homeemail.focus();
    return false;
}


  if (theForm.homephone.value == "")
  {
    alert("Please enter a value for the \"home phone number\" field.");
    theForm.homephone.focus();
    return (false);
  }

  if (theForm.homephone.value.length < 10)
  {
    alert("Please enter at least 10 characters in the \"home phone number\" field.");
    theForm.homephone.focus();
    return (false);
  }

  if (theForm.homephone.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"home phone number\" field.");
    theForm.homephone.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.homephone.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 characters in the \"home phone number\" field.");
    theForm.homephone.focus();
    return (false);
  }

if ( theForm.cellphone.value!="")
{
 if (theForm.cellphone.value.length > 10 ||theForm.cellphone.value.length < 10 )
  {
    alert("Please enter 10 characters in the \"cell phone number\" field.");
    theForm.cellphone.focus();
    return (false);
  }
 }

  var checkOK = "0123456789";
  var checkStr = theForm.cellphone.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 characters in the \"cell phone number\" field.");
    theForm.cellphone.focus();
    return (false);
  }

  if (theForm.gender.selectedIndex < 0)
  {
    alert("Please select one of the \"gender\" options.");
    theForm.gender.focus();
    return (false);
  }

  if (theForm.gender.selectedIndex == 0)
  {
    alert("The first \"gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender.focus();
    return (false);
  }

  if (theForm.ethnicity.selectedIndex < 0)
  {
    alert("Please select one of the \"ethnicity\" options.");
    theForm.ethnicity.focus();
    return (false);
  }

  if (theForm.ethnicity.selectedIndex == 0)
  {
    alert("The first \"ethnicity\" option is not a valid selection.  Please choose one of the other options.");
    theForm.ethnicity.focus();
    return (false);
  }

  if (theForm.yob.value == "")
  {
    alert("Please enter a value for the \"your year of birth\" field.");
    theForm.yob.focus();
    return (false);
  }

  if (theForm.yob.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"your year of birth\" field.");
    theForm.yob.focus();
    return (false);
  }

  if (theForm.yob.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"your year of birth\" field.");
    theForm.yob.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob.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 characters in the \"your year of birth\" field.");
    theForm.yob.focus();
    return (false);
  }

  if (theForm.Edu.selectedIndex < 0)
  {
    alert("Please select one of the \"Please select your education level\" options.");
    theForm.Edu.focus();
    return (false);
  }

  if (theForm.Edu.selectedIndex == 0)
  {
    alert("The first \"Please select your education level\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Edu.focus();
    return (false);
  }

  var radioSelected = false;
  for (i = 0;  i < theForm.Own_Rent.length;  i++)
  {
    if (theForm.Own_Rent[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("Please select one of the \"current home is rented or owned\" options.");
    return (false);
  }

  if (theForm.hhincome.selectedIndex < 0)
  {
    alert("Please select one of the \"household income range\" options.");
    theForm.hhincome.focus();
    return (false);
  }

  if (theForm.hhincome.selectedIndex == 0)
  {
    alert("The first \"household income range\" option is not a valid selection.  Please choose one of the other options.");
    theForm.hhincome.focus();
    return (false);
  }

  if (theForm.v1Year.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"primary vehicle year\" field.");
    theForm.v1Year.focus();
    return (false);
  }

  var checkOK = "0123456789-Year";
  var checkStr = theForm.v1Year.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 and \"Year\" characters in the \"primary vehicle year\" field.");
    theForm.v1Year.focus();
    return (false);
  }

  if (theForm.v2Year.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"other vehicle year\" field.");
    theForm.v2Year.focus();
    return (false);
  }

  var checkOK = "0123456789-Year";
  var checkStr = theForm.v2Year.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 and \"Year\" characters in the \"other vehicle year\" field.");
    theForm.v2Year.focus();
    return (false);
  }

  if (theForm.maritalstatus.selectedIndex < 0)
  {
    alert("Please select one of the \"marital status\" options.");
    theForm.maritalstatus.focus();
    return (false);
  }

  if (theForm.maritalstatus.selectedIndex == 0)
  {
    alert("The first \"marital status\" option is not a valid selection.  Please choose one of the other options.");
    theForm.maritalstatus.focus();
    return (false);
  }

  if (theForm.kids.selectedIndex < 0)
  {
    alert("Please select one of the \"number of children\" options.");
    theForm.kids.focus();
    return (false);
  }

  if (theForm.kids.selectedIndex == 0)
  {
    alert("The first \"number of children\" option is not a valid selection.  Please choose one of the other options.");
    theForm.kids.focus();
    return (false);
  }

  if (theForm.yob0.value == "" && theForm.kids.selectedIndex >1)
  {
    alert("Please enter a value for the \"Child 1 year of birth\" field.");
    theForm.yob0.focus();
    return (false);
  }

  if (theForm.yob0.value.length < 4 && theForm.kids.selectedIndex >1)
  {
    alert("Please enter at least 4 characters in the \"Child 1 year of birth\" field.");
    theForm.yob0.focus();
    return (false);
  }

  if (theForm.yob0.value.length > 4 && theForm.kids.selectedIndex >1)
  {
    alert("Please enter at most 4 characters in the \"Child 1 year of birth\" field.");
    theForm.yob0.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob0.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  && theForm.kids.selectedIndex >1)
  {
    alert("Please enter only digit characters in the \"Child 1 year of birth\" field.");
    theForm.yob0.focus();
    return (false);
  }

  if (theForm.gender0.selectedIndex < 0  && theForm.kids.selectedIndex >1)
  {
    alert("Please select one of the \"child 1 gender\" options.");
    theForm.gender0.focus();
    return (false);
  }

  if (theForm.gender0.selectedIndex == 0 && theForm.kids.selectedIndex >1)
  {
    alert("The first \"child 1 gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender0.focus();
    return (false);
  }

  if (theForm.yob1.value == "" && theForm.kids.selectedIndex >2)
  {
    alert("Please enter a value for the \"child 2 year of birth\" field.");
    theForm.yob1.focus();
    return (false);
  }

  if (theForm.yob1.value.length < 4 && theForm.kids.selectedIndex >2)
  {
    alert("Please enter at least 4 characters in the \"child 2 year of birth\" field.");
    theForm.yob1.focus();
    return (false);
  }

  if (theForm.yob1.value.length > 4 && theForm.kids.selectedIndex >2)
  {
    alert("Please enter at most 4 characters in the \"child 2 year of birth\" field.");
    theForm.yob1.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob1.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 && theForm.kids.selectedIndex >2)
  {
    alert("Please enter only digit characters in the \"child 2 year of birth\" field.");
    theForm.yob1.focus();
    return (false);
  }

  if (theForm.gender1.selectedIndex < 0 && theForm.kids.selectedIndex >2)
  {
    alert("Please select one of the \"child 2 gender\" options.");
    theForm.gender1.focus();
    return (false);
  }

  if (theForm.gender1.selectedIndex == 0 && theForm.kids.selectedIndex >2)
  {
    alert("The first \"child 2 gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender1.focus();
    return (false);
  }

  if (theForm.yob2.value == "" && theForm.kids.selectedIndex >3)
  {
    alert("Please enter a value for the \"child 3 year of birth\" field.");
    theForm.yob2.focus();
    return (false);
  }

  if (theForm.yob2.value.length < 4 && theForm.kids.selectedIndex >3)
  {
    alert("Please enter at least 4 characters in the \"child 3 year of birth\" field.");
    theForm.yob2.focus();
    return (false);
  }

  if (theForm.yob2.value.length > 4 && theForm.kids.selectedIndex >3)
  {
    alert("Please enter at most 4 characters in the \"child 3 year of birth\" field.");
    theForm.yob2.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob2.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 && theForm.kids.selectedIndex >3)
  {
    alert("Please enter only digit characters in the \"child 3 year of birth\" field.");
    theForm.yob2.focus();
    return (false);
  }

  if (theForm.gender2.selectedIndex < 0 && theForm.kids.selectedIndex >3)
  {
    alert("Please select one of the \"child 3 gender\" options.");
    theForm.gender2.focus();
    return (false);
  }

  if (theForm.gender2.selectedIndex == 0 && theForm.kids.selectedIndex >3)
  {
    alert("The first \"child 3 gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender2.focus();
    return (false);
  }

  if (theForm.yob3.value == "" && theForm.kids.selectedIndex >4)
  {
    alert("Please enter a value for the \"child 4 year of birth\" field.");
    theForm.yob3.focus();
    return (false);
  }

  if (theForm.yob3.value.length < 4 && theForm.kids.selectedIndex >4)
  {
    alert("Please enter at least 4 characters in the \"child 4 year of birth\" field.");
    theForm.yob3.focus();
    return (false);
  }

  if (theForm.yob3.value.length > 4 && theForm.kids.selectedIndex >4)
  {
    alert("Please enter at most 4 characters in the \"child 4 year of birth\" field.");
    theForm.yob3.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob3.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 && theForm.kids.selectedIndex >4)
  {
    alert("Please enter only digit characters in the \"child 4 year of birth\" field.");
    theForm.yob3.focus();
    return (false);
  }

  if (theForm.gender3.selectedIndex < 0 && theForm.kids.selectedIndex >4)
  {
    alert("Please select one of the \"child 4 gender\" options.");
    theForm.gender3.focus();
    return (false);
  }

  if (theForm.gender3.selectedIndex == 0 && theForm.kids.selectedIndex >4)
  {
    alert("The first \"child 4 gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender3.focus();
    return (false);
  }

  if (theForm.yob4.value == "" && theForm.kids.selectedIndex >5)
  {
    alert("Please enter a value for the \"child 5 year of birth\" field.");
    theForm.yob4.focus();
    return (false);
  }

  if (theForm.yob4.value.length < 4 && theForm.kids.selectedIndex >5)
  {
    alert("Please enter at least 4 characters in the \"child 5 year of birth\" field.");
    theForm.yob4.focus();
    return (false);
  }

  if (theForm.yob4.value.length > 4 && theForm.kids.selectedIndex >5)
  {
    alert("Please enter at most 4 characters in the \"child 5 year of birth\" field.");
    theForm.yob4.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yob4.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 && theForm.kids.selectedIndex >5)
  {
    alert("Please enter only digit characters in the \"child 5 year of birth\" field.");
    theForm.yob4.focus();
    return (false);
  }

  if (theForm.gender4.selectedIndex < 0 && theForm.kids.selectedIndex >5)
  {
    alert("Please select one of the \"child 5 gender\" options.");
    theForm.gender4.focus();
    return (false);
  }

  if (theForm.gender4.selectedIndex == 0 && theForm.kids.selectedIndex >5)
  {
    alert("The first \"child 5 gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.gender4.focus();
    return (false);
  }

  if (theForm.EmpStat.selectedIndex < 0)
  {
    alert("Please select one of the \"Employment Status\" options.");
    theForm.EmpStat.focus();
    return (false);
  }

  if (theForm.EmpStat.selectedIndex == 0)
  {
    alert("The first \"Employment Status\" option is not a valid selection.  Please choose one of the other options.");
    theForm.EmpStat.focus();
    return (false);
  }
  
    if (theForm.EmpStat.selectedIndex >3 )
  {
    theForm.workphone.value="";
    theForm.ext.value="";
	theForm.workemail.value="";
	theForm.workaddress1.value="";
	theForm.workaddress2.value="";
	theForm.workcity.value="";
	theForm.workstate.value="";
	theForm.workzip.value="";


  }


 /* 6/5/2007 Remove WorkPhone Restrictions as requested 
  if (theForm.workphone.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"workphone\" field.");
    theForm.workphone.focus();
    return (false);
  }*/

  if (theForm.workphone.value.length > 10 ||(theForm.workphone.value.length < 10 && theForm.workphone.value.length > 0) && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter 10 characters in the \"workphone\" field.");
    theForm.workphone.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.workphone.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 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter only digit characters in the \"workphone\" field.");
    theForm.workphone.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.ext.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 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter only digit characters in the \"Work Extension\" field.");
    theForm.ext.focus();
    return (false);
  }

  if (theForm.faxnum.value.length > 10 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter 10 characters in the \"fax Number\" field.");
    theForm.faxnum.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.faxnum.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 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter only digit characters in the \"Fax Number\" field.");
    theForm.faxnum.focus();
    return (false);
  }

  if (theForm.employer.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Employer\" field.");
    theForm.employer.focus();
    return (false);
  }

  if (theForm.employer.value.length > 250 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter at most 250 characters in the \"Employer\" field.");
    theForm.employer.focus();
    return (false);
  }

  if (theForm.title.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Title\" field.");
    theForm.title.focus();
    return (false);
  }

  if (theForm.title.value.length > 256 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter at most 256 characters in the \"Title\" field.");
    theForm.title.focus();
    return (false);
  }

  if (theForm.industry.selectedIndex < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please select one of the \"Industry\" options.");
    theForm.industry.focus();
    return (false);
  }

  if (theForm.industry.selectedIndex == 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("The first \"Industry\" option is not a valid selection.  Please choose one of the other options.");
    theForm.industry.focus();
    return (false);
  }

  if (theForm.department.selectedIndex < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please select one of the \"Department\" options.");
    theForm.department.focus();
    return (false);
  }

  if (theForm.department.selectedIndex == 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("The first \"Department\" option is not a valid selection.  Please choose one of the other options.");
    theForm.department.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.yrly_rev.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 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter only digit characters in the \"Company revenue\" field.");
    theForm.yrly_rev.focus();
    return (false);
  }

  if (theForm.empnumber.selectedIndex < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please select one of the \"Number of Employees\" options.");
    theForm.empnumber.focus();
    return (false);
  }

  if (theForm.empnumber.selectedIndex == 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("The first \"Number of Employees\" option is not a valid selection.  Please choose one of the other options.");
    theForm.empnumber.focus();
    return (false);
  }

  if (theForm.url.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Company website\" field.");
    theForm.url.focus();
    return (false);
  }


 
  if (theForm.workemail.value.length> 0  && theForm.workemail.value.indexOf("@", 0) < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    window.alert("Please enter a valid Work e-mail address.");
   theForm.workemail.focus();
    return false;
  }

  if (theForm.workemail.value.length> 0  && theForm.workemail.value.indexOf(".", 0) < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    window.alert("Please enter a valid Work e-mail address.");
    theForm.workemail.focus();
    return false;
  }

	 /* 6/5/2007 Remove WorkEmail Restrictions as requested 
	if ((theForm.workemail.value.indexOf("gmail")>0 || theForm.workemail.value.indexOf("hotmail")>0 || theForm.workemail.value.indexOf("aol")>0|| theForm.workemail.value.indexOf("yahoo")>0) && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
	{
	    window.alert("Please enter a non Gmail, hotmail, yahoo etc. email address work email");
	    theForm.workemail.focus();
	    return false;
	}
	*/



  if (theForm.workaddress1.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Work Address line 1\" field.");
    theForm.workaddress1.focus();
    return (false);
  }

  if (theForm.workcity.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Work City\" field.");
    theForm.workcity.focus();
    return (false);
  }

 if (theForm.workcity.value.length > 256 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter at most 256 characters in the \"work city\" field.");
    theForm.workcity.focus();
    return (false);
  }

  if (theForm.workstate.selectedIndex < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please select one of the \"Work State\" options.");
    theForm.workstate.focus();
    return (false);
  }

  if (theForm.workstate.selectedIndex == 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("The first \"Work State\" option is not a valid selection.  Please choose one of the other options.");
    theForm.workstate.focus();
    return (false);
  }

  if (theForm.workzip.value == "" && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter a value for the \"Work Zip code\" field.");
    theForm.workzip.focus();
    return (false);
  }

  if (theForm.workzip.value.length > 5 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter at most 5 characters in the \"Work Zip code\" field.");
    theForm.workzip.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.workzip.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 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please enter only digit characters in the \"Work Zip code\" field.");
    theForm.workzip.focus();
    return (false);
  }

  if (theForm.emailPref.selectedIndex < 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("Please select one of the \"Preferred email\" options.");
    theForm.emailPref.focus();
    return (false);
  }

  if (theForm.emailPref.selectedIndex == 0 && theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
    alert("The first \"Preferred email\" option is not a valid selection.  Please choose one of the other options.");
    theForm.emailPref.focus();
    return (false);
  }
  
  if(theForm.cellphone.value!="")
  {
  	if(theForm.homephone.value==theForm.cellphone.value)
  	{
  		alert("The cell number cannot be same as the home number");
  		theForm.homephone.focus();
  		return false;
  	}
  	
	 /* 6/5/2007 Remove WorkPhone Restrictions as requested 
 	if(theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  	{
  		
  		if(theForm.workphone.value==theForm.cellphone.value)
  		{
  			alert("The work phone number cannot be same as the cell number");
  			theForm.workphone.focus();
  			return false;
  		}
  	} */
  }

 /* 6/5/2007 Remove WorkEmail Restrictions as requested 
 if(theForm.EmpStat.selectedIndex >0 && theForm.EmpStat.selectedIndex < 4)
  {
  	if(theForm.homephone.value==theForm.workphone.value)
  	{
 		alert("The  home phone number cannot be same as the work phone.");
 		theForm.homephone.focus();
 		return(false);
 	}
  } 	*/	

 return (true);
  
}
