var response = null 

<!-- Checks for no data entered into text field
<!---------------------------------------------------------------------------------------------------------->
function validrequired(formfield, fieldlabel)
{
    var error = "";
 
    if (formfield.value.length == 0) {
        formfield.style.background = '#FFC0C0';
        error = fieldlabel + "\n";
    } else {
        formfield.style.background = 'White';
    }
    return error;
}

<!-- Checks for no radio button selection
<!---------------------------------------------------------------------------------------------------------->
function validbutton(formfield,fieldlabel) 
{
	
	var error = "";
	var myOption = -1;

		for (i=formfield.length-1; i > -1; i--) {
			if(formfield[i].checked)
			{
				myOption = i; 
				i = -1;
			}
		}
		
		if (myOption == -1)
		{
			error = fieldlabel + "\n";
		}
		
		return error;
}

<!-- Checks for correct email address format
<!---------------------------------------------------------------------------------------------------------->
function validemail(formfield,fieldlabel,required)
{
	var result = true;
	
	if (required && !validrequired(formfield,fieldlabel))
		result = false;

	if (result && !isemailaddr(formfield))
	  	result = false;
   
  return result;

}


function isemailaddr(formfield) 
{
	var str = formfield.value;
	var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
	
	if (!str.match(re)) 
	{
		formfield.style.background = '#FFC0C0';
		alert("Invalid email address format.");
		return false;
	} 
	else 
		formfield.style.background = 'white';
	{
		return true;
	}
}

<!-- Validate contact form
<!---------------------------------------------------------------------------------------------------------->
function valideventsignup(theform)
{

	var reason = "";
	
	reason += validrequired(theform.custom_field_1, "Salutation");
	reason += validrequired(theform.first_name, "First Name");
	reason += validrequired(theform.last_name, "Last Name");
	reason += validrequired(theform.company_name, "Company Name");
	reason += validrequired(theform.job_title, "Job Title");
	reason += validrequired(theform.address_line_1, "Address Line 1");
	reason += validrequired(theform.city, "City");
	reason += validrequired(theform.state, "US State/CS Province");
	reason += validrequired(theform.postal_code, "Zip/Postal Code");
	reason += validrequired(theform.country, "Country");
	reason += validrequired(theform.email, "Email");
	reason += validrequired(theform.work_phone, "Work Phone");
	reason += validbutton(theform.custom_field_9, "Which best describes your job function?");
	reason += validbutton(theform.custom_field_11, "In what state is your Algo trading operation?");
	reason += validrequired(theform.custom_field_12, "What do you hope to gain from attending this event?");	
	
	if (reason != "") {
		alert("Please enter data for the following fields:\n\n" + reason);
		return false;
	}
	
	if (!isemailaddr(theform.email)) {
		return false;
	}
	
	return true;
	
}

<!-- Validate contact form
<!---------------------------------------------------------------------------------------------------------->
function validinquiry(theform)
{

	var reason = "";
	
	reason += validrequired(theform.first_name, "First Name");
	reason += validrequired(theform.last_name, "Last Name");
	reason += validrequired(theform.company, "Company");
	reason += validrequired(theform.email, "Email");
	reason += validrequired(theform.phone, "Phone");
	
	if (reason != "") {
		alert("Please enter data for the following fields:\n\n" + reason);
		return false;
	}
	
	if (!isemailaddr(theform.email)) {
		return false;
	}
	
	return true;
	
}