/* SalesForce Contact Form Validation */
function validate_required(field)
	{	with (field)	{
			if (value==null||value=="")
  			{return false;}
			else {return true}
			}
	}
function validate_email(field)
	{	with (field)	{
			apos=value.indexOf("@");
			dotpos=value.lastIndexOf(".");
			if (apos<1||dotpos-apos<2) 
			{return false;}
			else {return true;}
			}
	}
function hideAllErrors() 
	{	document.getElementById("salutationError").style.display = "none"
		document.getElementById("first_nameError").style.display = "none"
		document.getElementById("last_nameError").style.display = "none"
		document.getElementById("companyError").style.display = "none"
		document.getElementById("phoneError").style.display = "none"
		document.getElementById("emailError").style.display = "none"
		document.getElementById("emailformatError").style.display = "none"
		document.getElementById("descriptionError").style.display = "none"
	}	
function validate_form(thisform)
	{	with (thisform)	{
			if (validate_required(salutation)==false)
			{hideAllErrors();salutation.focus();document.getElementById("salutationError").style.display = "inline";return false;}
			else if (validate_required(first_name)==false)
			{hideAllErrors();first_name.focus();document.getElementById("first_nameError").style.display = "inline";return false;}
			else if (validate_required(last_name)==false)
			{hideAllErrors();last_name.focus();document.getElementById("last_nameError").style.display = "inline";return false;}
			else if (validate_required(company)==false)
			{hideAllErrors();company.focus();document.getElementById("companyError").style.display = "inline";return false;}
			else if (validate_required(phone)==false)
			{hideAllErrors();phone.focus();document.getElementById("phoneError").style.display = "inline";return false; }
			else if (validate_required(email)==false)
			{hideAllErrors();email.focus();document.getElementById("emailError").style.display = "inline";return false;}
			else if (validate_email(email)==false)
  			{hideAllErrors();email.focus();document.getElementById("emailformatError").style.display = "inline";return false;}
			else if (validate_required(description)==false)
			{hideAllErrors();description.focus();document.getElementById("descriptionError").style.display = "inline";return false;}
			else {return true;}
			}
	}
