function ValidateForm(){
   if(document.contact_form.first_name.value == "") {
	 alert('Please fill in the required information');	
   } else if(document.contact_form.last_name.value == "") {
	 alert('Please fill in the required information');
   } else if(document.contact_form.title.value == "") {
	 alert('Please fill in the required information');
   } else if(document.contact_form.company.value == "") {
	 alert('Please fill in the required information');
   } else if(document.contact_form.phone.value == "") {
	 alert('Please fill in the required information');
   } else if(echeck(document.contact_form.email.value) == false) {
	 alert('Please fill in the required information');
   } else if(freecheck(document.contact_form.email.value) == false) {
	 //message already displayed in funtion	
   } else if(document.contact_form.city.value == "") {
	 alert('Please fill in the required information');
   } else if(document.contact_form.state.selectedIndex == 0) {
	 alert('Please fill in the required information');
	
   } else {
	   
   if(document.contact_form.interest.selectedIndex == 1) {
	 document.contact_form.setAttribute('target','_self');
     document.contact_form.setAttribute('action','https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8');
	 document.contact_form.submit();
   } else if(document.contact_form.interest.selectedIndex == 2) {
	 document.contact_form.setAttribute('target','_self');
     document.contact_form.setAttribute('action','contact_sent.php');
	 document.contact_form.submit();
   } else if(document.contact_form.interest.selectedIndex == 3) {
     document.contact_form.setAttribute('target','_self');
     document.contact_form.setAttribute('action','contact_sent.php');
	 document.contact_form.submit();
   } else {
	 document.contact_form.setAttribute('target','_self');
     document.contact_form.setAttribute('action','contact_sent.php');
   	 document.contact_form.submit();
   }
   
   }
}

function freecheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	var dom = ""
	var d = str.indexOf(at)+1
	while ( d <= str.indexOf(dot)-1 ) {
		dom = dom + str.charAt(d)
		d=d+1
	}
	if (dom == "hotmail" || dom == "gmail" || dom == "yahoo") {
		alert(dom + " is not accepted. Please fill in a corporate email address")
		return false
	}
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	 if (str.indexOf(" ")!=-1){
		return false
	 }
	 return true					
}
<!-- Allister Stuckless allister@stuckless.ca 2009 -->