function $(id) {
	return document.getElementById(id).value;
}

function check_form() {
	var errors = '';

	if ($('name').length < 3) {
		errors = errors + '"Your name" is a required field.\n';
	}

	if ($('email').length < 3) {
		errors = errors + '"Your email" is a required field.\n';
	} else {
		if (($('email').match(/^[\.\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~0-9A-Za-z]+\@[A-Za-z0-9\-\_\.]+\.[A-Za-z]{2,4}$/) == null)) {
			errors = errors + '"Your email" must be a valid address.\n';
		}
	}

	if ($('comments').length < 3) {
		errors = errors + '"Comments" is a required field.\n';
	}

	if ($('captcha').length == 0) {
		errors = errors + '"Verification code" is a required field.\n';
	} else {
		if ($('captcha').length < 4) {
			errors = errors + '"Verification code" requires 4 characters.\n';
		} else {
			if (($('captcha').match(/[^0-9A-Za-z]/) != null)) {
				errors = errors + '"Verification code" requires 4 characters.\n';
			}
		}
	}

	if (errors != '') {
		alert(errors);
		return false;
	} else {
		return true;
	}
}
