//<![CDATA[
// javascript to ensure form contents OK.   neeeds email ok.js
function formCheck()   {
var test=true;
var emailtest;

// check all mandatory variables are present
if (document.getElementById("forename").value.length==0) {
	alert("No forename - correct and re-submit");
	document.forms[0].forename.focus();
	return false;}

if (document.getElementById("surname").value.length==0) {
	alert("No surname - correct and re-submit");
	document.forms[0].surname.focus();
	return false;}
	
emailtest=document.getElementById("email1").value;	
if (emailtest.length==0) {
	alert("No email address - correct and re-submit");
	document.forms[0].email1.focus();
	return false;}

if (document.getElementById("email2").value.length==0) {
	alert("No check email address - correct and re-submit");
	document.forms[0].email2.focus();
	return false;}
	
// check emails match
if (emailtest != document.getElementById("email2").value) {
	alert("email addresses do not match - edit and re-submit");
	document.forms[0].email2.focus();
	return false;}

//test email format needs emailok.js file
test=emailCheck(emailtest);

// check format of email addresses.
if (test==false) {
	alert("There is a problem with the email format - edit both addresses and resubmit");
	document.forms[0].email1.focus();
	return false;}
		
// check there is a message
if (document.getElementById("message").value.length<5) {
	alert("No message - say something !");
	document.forms[0].message.focus();
	return false;}

// return to form if true variables deleted on form- held in buffer?

return true;	
}
//]]>
//END