<!--
function validatespam() {

	var x = document.form1.p_surname.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) alert('Please remove inappropriate @ symbol');
	else validate();}


function validate() {

	var x = document.form1.p_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) validatex();
	else alert('Please check you have entered a valid email address');}
	
function validatex() {

	empty = new Boolean;
	empty = false;

    if (document.form1.p_surname.value == '') { empty = true; } // checks the text box isn't empty
	if (document.form1.p_name.value == '') { empty = true; } // checks the text box isn't empty
		
	if (empty == true) {
	alert('Please complete all Mandatory fields\nmarked with a * in the form');
	return false;
	} else {
	document.form1.submit();
	return true;
	}
	
}

function validategrad() {
	if (
	document.form1.read.checked == false) 
	{
		alert ('Please Check the box to say you\'ve read the Declaration');
		return false;
	} else { validategrad1()	
		return true;
	}
}

function validategrad1() {

	var x = document.form1.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) validategrad2();
	else alert('Please check you have entered a valid email address');}

function validategrad2() {

	empty = new Boolean;
	empty = false;

    if (document.form1.title.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.surname.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.forenames.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.address1.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.postcode.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.telnumber.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.dateofbirth.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.nationality.value == '') { empty = true; } // check the text box isn't empty


	if (empty == true) {
	alert('Please complete all Mandatory fields\nmarked with a * in the form');
	return false;
	} else {
	document.form1.submit();
	return true;
	}
} 

function validatevac() {
	if (
	document.form1.read.checked == false) 
	{
		alert ('Please Check the box to say you\'ve read the Declaration');
		return false;
	} else { validatevac1()	
		return true;
	}
}


function validatevac1() {

	var x = document.form1.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) validatevac2();
	else alert('Please check you have entered a valid email address');}

function validatevac2() {

	empty = new Boolean;
	empty = false;

	if (document.form1.postref.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.post.value == '') { empty = true; } // check the text box isn't empty
    if (document.form1.title.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.surname.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.forenames.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.homeaddress.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.telnumber.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.dateofbirth.value == '') { empty = true; } // check the text box isn't empty
	if (document.form1.nationality.value == '') { empty = true; } // check the text box isn't empty
    if (document.form1.read.value == '') { empty = true; } // check the text box isn't empty

	if (empty == true) {
	alert('Please complete all Mandatory fields\nmarked with a * in the form');
	return false;
	} else {
	document.form1.submit();
	return true;
	}
} 
//-->