function validate_required(field,alerttxt){
	with (field){
		if (value==null||value==""){
  		alert(alerttxt);
  		return false;
  	}
		else {
			return true;
		}
	}
}

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_form(thisform){
	with (thisform){
		if (validate_email(email,"If you don't provide a proper email address then we would have no way of contacting you.")==false){
			email.focus();
			return false;
		}
		if (validate_required(name,"Please tell us your Name.")==false){
			name.focus();
			return false;
		}
		if (validate_required(company,"You haven't told us what company you work for.")==false){
			company.focus();
			return false;
		}
		if (validate_required(message,"What use would an empty message be?")==false){
			message.focus();
			return false;
		}
	}
}

