
function checkform(thisform)
{

// Check User Has Inputted a firstname // -->
if(thisform.firstname.value == null || thisform.firstname.value == "")
{
	alert("Please enter your first name"); 
	thisform.firstname.focus();
	thisform.firstname.select();
	return false;
}
// Check User Has Inputted a surname // -->
if(thisform.surname.value == null || thisform.surname.value == "")
{
	alert("Please enter your surname"); 
	thisform.surname.focus();
	thisform.surname.select();
	return false;
}
// Check User Has Inputted an email address // -->
if(thisform.email.value == null || thisform.email.value == "")
{
	alert("Please enter an email address");
	thisform.email.focus();
	thisform.email.select();
	return false;
}
// Check the user has input a valid email address. 1. Check for Bad Characters //-->
invalidChars = " /:,;=(){}[]*$";
for (i=0; i<invalidChars.length;i++)
{
	badChar = invalidChars.charAt(i)
	if (thisform.email.value.indexOf(badChar,0) > -1)
	{
		alert("You entered and invalid email address");
		thisform.email.focus();
		thisform.email.select();
		return false
	}
}
// Check the user has input a valid email address. 2. Check for @ within the email address //-->
atPos = thisform.email.value.indexOf("@",1)
if (atPos == -1)
{
	alert("You entered and invalid email address");
	thisform.email.focus();
	thisform.email.select();
	return false
}
// Check the user has input a valid email address. 3. Check for only one @ within the email address //-->
if (thisform.email.value.indexOf("@",atPos+1) > -1)
{
	alert("You entered and invalid email address");
	thisform.email.focus();
	thisform.email.select();
	return false
}
// Check the user has input a valid email address. 4. Check that a . appears after the @ within the email address //-->
periodPos = thisform.email.value.indexOf(".",atPos)
if (periodPos == -1)
{
	alert("You entered and invalid email address");
	thisform.email.focus();
	thisform.email.select();
	return false
}
// Check the user has input a valid email address. 5. Check that at least two characters appear after the . //-->
if (periodPos+3>thisform.email.value.length)
{
	alert("You entered and invalid email address");
	thisform.email.focus();
	thisform.email.select();
	return false
}
return true;
}
// Script Ends-->
