function FValidateControl(control, prompt) {
	if (control.value=="") {
		alert("The " + prompt +" field is a required field, and it must be filled in before your form can be sent to our server.")
		control.focus()
		return false
	}
	return true
}

function ContactUsValidation(form) {
	if (!FValidateControl(form.code,'Captcha')) return false
	if (!FValidateControl(form.name,'Name')) return false
	if (!isEmail(form.email.value)) { form.email.focus(); return false }
	if (!FValidateControl(form.address,'Address')) return false
	if (!FValidateControl(form.city,'City')) return false
	if (!FValidateControl(form.state,'State')) return false
	if (!isZip(form.zip.value)) { form.zip.focus(); return false }
	return true
}

function NewsletterValidation(form) {
	if (!FValidateControl(form.name,'Name')) return false
	if (!isEmail(form.email.value)) { form.email.focus(); return false }
	return true
}

function isEmail(email) {
	emailstring = new String(email);
	if ( -1 == emailstring.search(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/) ) {
		alert("I'm sorry. This email address seems to be incorrect. Please check and submit again.");
		return false
	}
	return true
}

function isZip(zip) {
	//reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
	if ( zip.length < 5) {
          alert("I'm sorry. This Zip code seems to be incorrect. Please check and submit again.");
          return false;
    }
	return true;
}

function validatefield(thisfield,imgname){
	if (thisfield.value == "") { thisfield.style.background="#FFFFCC"; }
}