﻿<!--
function IsEmailAddress (string) {
	var addressPattern =  
		/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	return addressPattern.test(string);
}

function show(id) {
	var obj = document.getElementById(id);
	obj.style.display = 'block';
}

function hide(id) {
	var obj = document.getElementById(id);
	obj.style.display = 'none';
}


function validate(theForm) {
	var noReturn = true;
	
	if(theForm.first_name.value == "") {
		show('first_name_validate');
		noReturn = false;
	}
	
	if(theForm.last_name.value == "") {
		show('last_name_validate');
		noReturn = false;
	}
	
	if(theForm.email_address.value == "") {
		show('email_address_validate_req');
		hide('email_address_validate_inv');
		noReturn = false;
	} else if(IsEmailAddress(theForm.email_address.value) == false) {
		show('email_address_validate_inv');
		hide('email_address_validate_req');
		noReturn = false;
	}
	
	if(theForm.lead_source.value == "") {
		show('lead_source_validate');
		noReturn = false;
	}
	
	if(!noReturn){
		return false;
	}

}

//-->