function validate() {
	var emailaddress=document.contactform.email
	if (document.contactform.name.value=="") {
		alert("Please fill out the Name field.");
		document.contactform.name.focus();
		return false;
	}
	if (document.contactform.contacttime.value=="") {
		alert("Please fill out the When to Contact You field.");
		document.contactform.contacttime.focus();
		return false;
	}
	if (document.contactform.email.value=="") {
		alert("Please fill out the Email Address field.");
		document.contactform.email.focus();
		return false;
	}
	if (checkemail(emailaddress.value)==false){
		emailaddress.value="";
		emailaddress.focus();
		return false;
	}
	if (document.contactform.message.value=="") {
		alert("Please fill out the Message field.");
		document.contactform.message.focus();
		return false;
	}
	document.contactform.submit();
}
function validateerg() {
	var emailaddress=document.ergvideoform.email
	if (document.ergvideoform.name.value=="") {
		alert("Please fill out the Name field.");
		document.ergvideoform.name.focus();
		return false;
	}
	if (document.ergvideoform.email.value=="") {
		alert("Please fill out the Email Address field.");
		document.ergvideoform.email.focus();
		return false;
	}
	if (checkemail(emailaddress.value)==false){
		emailaddress.value="";
		emailaddress.focus();
		return false;
	}
	if (document.ergvideoform.phone.value=="") {
		alert("Please fill out the Phone field.");
		document.ergvideoform.phone.focus();
		return false;
	}
	if (document.ergvideoform.address.value=="") {
		alert("Please fill out the Address field.");
		document.ergvideoform.address.focus();
		return false;
	}
	if (document.ergvideoform.city.value=="") {
		alert("Please fill out the City field.");
		document.ergvideoform.city.focus();
		return false;
	}
	if (document.ergvideoform.state.value=="") {
		alert("Please fill out the State field.");
		document.ergvideoform.state.focus();
		return false;
	}
	if (document.ergvideoform.zip.value=="") {
		alert("Please fill out the Zip field.");
		document.ergvideoform.zip.focus();
		return false;
	}
	if (document.ergvideoform.threshold.value=="") {
		alert("Please fill out the Lactate Threshold field.");
		document.ergvideoform.threshold.focus();
		return false;
	}
	if (document.ergvideoform.daysperweek.value=="") {
		alert("Please fill out the Days Per Week field.");
		document.ergvideoform.daysperweek.focus();
		return false;
	}
	document.ergvideoform.submit();
}

function checkemail(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){alert("Please enter a valid Email Address."); return false;}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){alert("Please enter a valid Email Address."); return false;}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){alert("Please enter a valid Email Address."); return false;}
	if (str.indexOf(at,(lat+1))!=-1){alert("Please enter a valid Email Address."); return false;}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){alert("Please enter a valid Email Address."); return false;}
	if (str.indexOf(dot,(lat+2))==-1){alert("Please enter a valid Email Address."); return false;}
	if (str.indexOf(" ")!=-1){alert("Please enter a valid Email Address."); return false;}
	return true;
}