
<!--
function checkForm(theForm)
{

 if (theForm.user_fname.value == "")
  {
    alert("You have not entered your first name.");
    theForm.user_fname.focus();
    return (false);
  }
  
  if (theForm.user_lname.value == "")
  {
    alert("You have not entered your last name.");
    theForm.user_lname.focus();
    return (false);
  }
  
  if (theForm.emp_id.value == "0")
  {
	  
    alert("You have not entered your employer.");
    return (false);
  
  }
  
  // validation for UC Davis students or faculty
  if(theForm.emp_id.value != "")
  {
	  var employer = theForm.emp_id.value
	  
	  var id_name = employer.split("|");
	  
	  var empID = id_name[0];
	  var empName = id_name[1];
	  
	  var confirmed = true;
	  
	  if(empID == "732")
	  {
		  confirmed = confirm("You have choosen \"UC Davis faculty & staff\" as your employer. \nThis option is reserved for faculty and staff only. \n\nIf you are a student please click \"Cancel\" \nand select \"UC Davis students\" from the employers list.\n\n");
		  
	  }
	  
	  if(empID == "1384")
	  {
		  confirmed = confirm("You have choosen \"UC Davis students\" as your employer. \nThis option is reserved for students only. \n\nIf you are a faculty or staff member please click \"Cancel\" \nand select \"UC Davis faculty & staff\" from the employers list.\n\n");
	  }
	  
	  if(confirmed == false)
	  	return(false);
		  
	  
  }
	  
	

if (theForm.user_email.value == "")
  {
    alert("You have not entered your email address.");
    theForm.user_email.focus();
    return (false);
  }

invalidChars = " /:,;"
  for (i=0; i<invalidChars.length; i++)
  	badChar = invalidChars.charAt(i)
  	if (theForm.user_email.value.indexOf(badChar,0) > -1) {
  		alert ('Your email address contains invalid chars.');
		theForm.user_email.focus();
  		return (false);
  		}
  		
  atPos = theForm.user_email.value.indexOf("@",1)
  if (atPos == -1) {
  	alert ('Your email address doesn\'t contain \"@\" ');
	theForm.user_email.focus();
  	return (false);
  	}
  	
  if (theForm.user_email.value.indexOf("@",atPos+1) >	 -1) {
 	alert ('Your email address contains 2 \"@s\" ');
	theForm.user_email.focus();
  	return (false);
  	}
  	
  	periodPos = theForm.user_email.value.indexOf(".",atPos)
  	if (periodPos == -1) {
  		alert ('Your email address doesn\'t contain \".\" ');
		theForm.user_email.focus();
		return (false);
  	}
  
  if (periodPos +2 > theForm.user_email.value.length) {
		alert ('Your email address is incorrect. ');
		theForm.user_email.focus();
		return (false);
	}
	
if (theForm.user_address.value == "")
  {
    alert("You have not entered your home address. Addresses are used only for regional statistics and are protected by SACOG.");
    theForm.user_address.focus();
    return (false);
  }
  
  if (theForm.user_city.value == "")
  {
    alert("You have not entered your city.");
    theForm.user_city.focus();
    return (false);
  }


if (theForm.user_workzip.value == "")
  {
    alert("You have not entered your work zip code.");
    theForm.user_workzip.focus();
    return (false);
  }
  
   var vzips = theForm.validzips.value
  
  if (vzips.indexOf(','+theForm.user_workzip.value+',') ==-1) 
  {
	  alert("Not a valid Sacramento Region zip code." + theForm.user_workzip.value);
    theForm.user_workzip.focus();
    return (false);
  } 
  
  if (theForm.user_workzip.value == "95812")
  {
    alert("95812 is a PO Box zip code. Please enter the physical zip code of your worksite instead.");
    theForm.user_workzip.focus();
    return (false);
  }  

	
if (theForm.user_homezip.value == "")
  {
    alert("You have not entered your home zip code.");
    theForm.user_homezip.focus();
    return (false);
  }

  if (theForm.workzip.value == "95812")
  {
    alert("95812 is not a valid physical zip code.");
    theForm.workzip.focus();
    return (false);
  }
   if (theForm.homezip.value == "95812")
  {
    alert("95812 is not a valid physical zip code.");
    theForm.homezip.focus();
    return (false);
  }
  
   var checkOK = "0123456789";
  var checkStr = theForm.user_miles.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 digits in the commute miles field.");
	theForm.user_miles.value = '';
	theForm.user_miles.focus();
    return (false);
  }


	
    theForm.submit.value="Processing...";
    theForm.submit.disabled = true;
    return (true);
 
}

