function validateStandardForm(theForm)
{
	
	 if (theForm.first_name_req.value == "true" && theForm.first_name.value == "")

  {

    alert("Please enter a value for the \"First Name\" field.");

    theForm.first_name.focus();

    return (false);

  }



  if (theForm.first_name.value.length < 3)

  {

    alert("Please enter at least 3 characters in the \"First Name\" field.");

    theForm.first_name.focus();

    return (false);

  }



  if (theForm.last_name_req.value == "true" && theForm.last_name.value == "")

  {

    alert("Please enter a value for the \"Last Name\" field.");

    theForm.last_name.focus();

    return (false);

  }



  if (theForm.last_name.value.length < 3)

  {

    alert("Please enter at least 3 characters in the \"Last Name\" field.");

    theForm.last_name.focus();

    return (false);

  }
	
  if (theForm.company_req.value == "true" && theForm.company.value == "")

  {

    alert("Please enter a value for the \"Company\" field.");

    theForm.company.focus();

    return (false);

  }



  if (theForm.company.value.length < 2)

  {

    alert("Please enter at least 2 characters in the \"Company\" field.");

    theForm.company.focus();

    return (false);

  }


 if (theForm.job_title_req.value == "true" && theForm.job_title.value == "")

  {

    alert("Please enter a value for the \"Job Title\" field.");

    theForm.job_title.focus();

    return (false);

  }



  if (theForm.job_title.value.length < 2)

  {

    alert("Please enter at least 2 characters in the \"Job Title\" field.");

    theForm.job_title.focus();

    return (false);

  }


 


  
  if (theForm.address_req.value == "true" && theForm.address.value == "")

  {

    alert("Please enter a value for the \"Mailing Address\" field.");

    theForm.address.focus();

    return (false);

  }
  
  if (theForm.city_req.value == "true" && theForm.city.value == "")

  {

    alert("Please enter a value for the \"City\" field.");

    theForm.city.focus();

    return (false);

  }
  
  if (theForm.state_req.value == "true" && theForm.state.value == "")

  {

    alert("Please enter a value for the \"State/Province\" field.");

    theForm.state.focus();

    return (false);

  }
  
  if (theForm.zip_req.value == "true" && theForm.zip.value == "")

  {

    alert("Please enter a value for the \"Zip\" field.");

    theForm.zip.focus();

    return (false);

  }
	
	if (theForm.phone_req.value == "true" && theForm.phone.value == "")

  {

    alert("Please enter a value for the \"Phone\" field.");

    theForm.phone.focus();

    return (false);

  }

  if (theForm.email_req.value == "true" && theForm.email.value == "")


  {

    alert("Please enter a value for the \"Email\" field.");

    theForm.email.focus();

    return (false);

  }



  if (theForm.email.value.length < 6)

  {

    alert("Please enter at least 6 characters in the \"Email\" field.");

    theForm.email.focus();

    return (false);

  }
  
  if (! checkemail(theForm.email.value) )
  
  {
  
  	alert("Please enter a valid email address.");

    theForm.email.focus();

    return (false);

  }


  if (theForm.phone.value.length < 3)

  {

    alert("Please enter at least 3 characters in the \"Phone\" field.");

    theForm.phone.focus();

    return (false);

  }



  if (theForm.phone.value.length > 20)

  {

    alert("Please enter at most 20 characters in the \"Phone\" field.");

    theForm.phone.focus();

    return (false);

  }

	
return (true);
}
	
// helpers (return booleans)

function checkemail(email_to_validate){
	var str=email_to_validate
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) {
		return true
	}
	return false
}
