function check_contact_us(form_name, email_address)
{
	document.form_contact_us.CONTACT.value = trim(document.form_contact_us.CONTACT.value);
	document.form_contact_us.COMPANY.value = trim(document.form_contact_us.COMPANY.value);
	document.form_contact_us.STATE.value = trim(document.form_contact_us.STATE.value);
	document.form_contact_us.TELEPHONE.value = trim(document.form_contact_us.TELEPHONE.value);
	document.form_contact_us.CONTACT_US_EMAIL.value = trim(document.form_contact_us.CONTACT_US_EMAIL.value);
	document.form_contact_us.QUESTIONS_COMMENTS.value = trim(document.form_contact_us.QUESTIONS_COMMENTS.value);
	document.form_contact_us.private_key.value = trim(document.form_contact_us.private_key.value);
	
	var contact = document.form_contact_us.CONTACT.value;
	var company = document.form_contact_us.COMPANY.value;
	var state = document.form_contact_us.STATE.value;
	var telephone = document.form_contact_us.TELEPHONE.value;
	var contact_us_email = document.form_contact_us.CONTACT_US_EMAIL.value;
	var questions_comments = document.form_contact_us.QUESTIONS_COMMENTS.value;
	var image_code = document.form_contact_us.private_key.value;
	var error_str = '';
	var email_error = check_email(form_name, email_address);

	if (!contact.length) { error_str += '[Contact] \n'; }
	if (!company.length) { error_str += '[Company] \n'; }
	if (!state.length) { error_str += '[State] \n'; }
	if (!telephone.length) { error_str += '[Telephone] \n'; }
	if (!contact_us_email.length) { error_str += '[Email] \n'; }
	if (!questions_comments.length) { error_str += '[Questions/Comments left blank] \n'; }
	if (!image_code.length) { error_str += '[Image Code] \n'; }
	if (email_error) { error_str += ' [use the xxx@xxx.xxx format for the Email field]'; }
										 
	if (error_str)
	{
		alert('Please correct the following: \n \n ' + error_str);
	}
	else
	{
		document.form_contact_us.submit();
	}	
}

function check_email(form_name, email_address) 
{		
	email_error = 0;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email_address)) 
	{
		if (form_name == 'sign_up')
		{
			document.form_contact.submit();
		}		
	}
	else	
	{
		if (form_name == 'sign_up')
		{
			alert('Please use the xxx@xxx.xxx format for the Email field.');	
		}
		else
		{
			return 1;
		}
	}	
}