function validateForm(formElem) 
{
	return validateRichForm(formElem, "#464646", "#F80113");
}

function validateRichForm(formElem, good_color, bad_color) 
{
	var inputElem = null;
	var why = '';
	
	inputElem = formElem.Name;
	if( inputElem ) {
		if(inputElem.value == inputElem.defaultValue) {
			why += " * Your Name\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	inputElem = formElem.CompanyName;
	if( inputElem ) {
		if(inputElem.value == inputElem.defaultValue) {
			why += " * Your Company's Name\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	inputElem = formElem.Email;
	if( inputElem ) {
		if(!isValidEmail(inputElem.value)) {
			why += " * Your Email Address\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	inputElem = formElem.Telephone;
	if( inputElem ) {
		if(inputElem.value == inputElem.defaultValue) {
			why += " * Your Telephone Number\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	inputElem = formElem.EquipmentOfInterested;
	if( inputElem ) {
		if(inputElem.value == inputElem.defaultValue) {
			why += " * The Equipment You Are Interested In\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	inputElem = formElem.captcha;
	if( inputElem ) {
		if(inputElem.value.length != 5) {
			why += " * The Security Code\n";
			document.getElementById(inputElem.id + '_label').style.color = bad_color;
		}
		else {
			document.getElementById(inputElem.id + '_label').style.color = good_color;
		}
	}
	
	if( why != "" ) {
		why = "There is an error with your request.\nPlease fill out the following required fields:\n" + why;
		alert(why);
		return false;
	}
	else {
		return true;
	}
}

function isValidEmail(the_email) {
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\'\>\,\;\:\\\/\"\[\]]/;
	if (!emailFilter.test(the_email) || the_email.match(illegalChars)) {
		return false;
	}
	return true;
}
