function isvalid()
{
// start email check
// check email has exactly one at symbol
temail = document.forms[0].emailaddress.value;
//is anything entered?
contactinfo = 0;
if (temail != "") {
counter = 0;
//contactinfo is to check that email has been entered
for (i = 0; i < temail.length; i++) {
	if(temail.substr(i,1) == '@') {
		counter++;
	}
}

if(counter != 1) {
	alert('Please check the email address you have entered, as it appears to be invalid');
	return false;
	}
else {
	contactinfo++;
}
//trim
temail.replace(/^[\s]+$[\s]+/,"");
//are any of the following characters in the email address space:;, ?
if (temail.search(/[\s:;,]/) > -1) {
	alert('Please check the email address you have entered, as it appears to be invalid');
	return false;
}
}
//end email check

//is there something in the firstname field?
tfname = document.forms[0].firstname.value;
if (tfname == '') {
	alert('Please enter your first name so that we can reply politely');
	return false;
}

//is there something in the lastname field?
tlname = document.forms[0].lastname.value;
if (tlname == '') {
	alert('Please enter your last name (surname)');
	return false;
}
return true;
}