// delete error message from fields that need to be filled in so subscriber doesn't have to
function delMess(fieldName) {
	if (document.appform[fieldName].value == "Please fill in this field") {
		document.appform[fieldName].value = "";
	}
}

// check fields in reverse order so that first incorrect field has focus 
function checkFields() {
	var verrmsg = "Please fill in this field";
	var vsubmit = true;
	var myString = new String(document.appform.emailaddr.value);
	var myRE = new RegExp("gypsybytes", "i");
	var results = myString.match(myRE);
	if (results !== null) {
//		alert ("Not a valid email address");
		vsubmit = false;
		document.appform.emailaddr.focus();
		document.appform.emailaddr.value = verrmsg;
	}
	if (document.appform.contraception.value == "" ||
		document.appform.contraception.value == verrmsg) {
		vsubmit = false;
		document.appform.contraception.focus();
		document.appform.contraception.value = verrmsg;
	}
	if (document.appform.medication[1].checked && 
	   (document.appform.prescription.value == "" ||
		document.appform.prescription.value == verrmsg)) {
		vsubmit = false;
		document.appform.prescription.focus();
		document.appform.prescription.value = verrmsg;
	}
	if (document.appform.smoke[1].checked && 
	    document.appform.cigarettes.value == 0) {
		vsubmit = false;
		document.appform.cigarettes.focus();
	}
	if (document.appform.weight.value == 00) {
		vsubmit = false;
		document.appform.weight.focus();
	}
	if (document.appform.height.value == 00) {
		vsubmit = false;
		document.appform.height.focus();
	}
	if (document.appform.age.value == 00) {
		vsubmit = false;
		document.appform.age.focus();
	}
	if (document.appform.intcode.value == "" ||
		document.appform.areacode.value == "" ||
		document.appform.telno.value == "") {
		vsubmit = false;
		document.appform.intcode.focus();
	}
	if (document.appform.emailaddr.value == "" ||
		document.appform.emailaddr.value == verrmsg) {
		vsubmit = false;
		document.appform.emailaddr.focus();
		document.appform.emailaddr.value = verrmsg;
	}
	if (document.appform.name.value == "" ||
		document.appform.name.value == verrmsg) {
		vsubmit = false;
		document.appform.name.focus();
		document.appform.name.value = verrmsg;
	}
	if (vsubmit == true) {
		return (true);
	} else {
		return (false);
	}
}

function emailNow() {
	goAhead = checkFields();
	if (goAhead == true) {
		document.appform.submit();
	}
}