function emailvalidation(entered, alertbox) {
// E-mail-Validation (c) Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove the this line and the two lines above.
	with (entered) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)  {
			if (alertbox) alert( alertbox ); 
			return false;
		} else {
			return true;
		}
	}
}

function emptyvalidation(entered, alertbox) {
// Emptyfield-Validation (c) Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove the this line and the two lines above.
	with (entered) {
		if (value==null || value=="") {
			if (alertbox!="") alert(alertbox);
			return false;
		} else {return true;}
	}
}

function formvalidation(thisform) {
	with (thisform) {
		if (emptyvalidation(name,"The name is blank")==false) {name.focus(); return false;};
		if (emptyvalidation(address,"The address is blank")==false) {address.focus(); return false;};
		if (emptyvalidation(city,"The city is blank")==false) {city.focus(); return false;};
		if (emptyvalidation(zip,"The zip is blank")==false) {zip.focus(); return false;};
		if (emptyvalidation(phone,"The phone number is blank")==false) {phone.focus(); return false;};
		if (emailvalidation(email,"Illegal E-mail address")==false) {email.focus(); return false;};
		submit();
	}
}
function setNameFocus () {
	document.getElementById('name').focus();
}
addLoadEvent( setNameFocus );