function validate_email(field,alerttxt) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);return false;
		}
		else {
			return true;
		}
	}
}

function validate_name(field,alerttxt) {
	with (field) {
		if (null == value || "" == value) {
			alert(alerttxt);return false;		
		}
		else {
			return true;
		}
	}
}

function validate_message(field,alerttxt) {
	with (field) {
		if (null == value || "" == value) {
			alert(alerttxt);return false;		
		}
		else {
			return true;
		}
	}
}

function validate_form(thisform) {
	with (thisform) {
		if (validate_name(name,"Please enter your name")==false) {
			name.focus();return false;
		}	
		if (validate_email(email,"Not a valid e-mail address!")==false) {
			email.focus();return false;
		}
		if (validate_message(message,"Please type your message")==false) {
			message.focus();return false;
		}	
	document.getElementById("mailform").style.display = "none";
	document.getElementById("send_div").style.display = "";
	}
}
