	function isValidEmail(emailStr) {
	
		// Regexp for email addresses
		var email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			
		return email.test(emailStr);
			
	}
	
	function errorCheck () {

		err = '';
		var emailRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		
		
		if (document.form.forename.value == '') {
			err += 'You have to supply your forename.\n';
		}
		if (document.form.surname.value == '') {
			err += 'You have to supply your surname.\n';
		}
		if (document.form.town.value == '') {
			err += 'You have to supply your town.\n';
		}
		if (document.form.postcode.value == '') {
			err += 'You have to supply your postcode.\n';
		}
		if (document.form.telephone.value == '') {
			err += 'You have to supply your telephone number.\n';
		}
		if (!isValidEmail(document.form.email.value)) {
			err += 'You need to enter a valid email address\n';
		}
		if (document.form.enquiry.value == '') {
			err += 'You have to supply your message.\n';
		}	
		if (err) {
			alert('There were problems with the form : \n\n' + err);
		}
		else {
			document.form.submit();
		}
		
	} // end errorCheck