function validate(theform) {

if (theform.username) var username = theform.username.value;
var email=theform.emailaddress.value;
var password=theform.password.value;
var password2=theform.password2.value;
var birthday=theform.birthday.value;
var terms=theform.terms;

if (theform.antibot) theform.antibot.value = "passedJStest";

if ((theform.username) && ((username == "" ) || (username.length > 30 ))) {
	alert("Your username is empty or over the maximum of 30 characters");
	theform.username.focus();
	return false;
} 
if ((email == "") || (email.length > 100 )) {
	alert("Your email address is empty or over the maximum of 100 characters");
	theform.email.focus();
	return false;
}

if ((password == "") || (password.length > 20 )) {
	alert("Your password is empty or over the maximum of 20 characters");
	theform.password.focus();
	return false;
} 

if (password != password2) {
	alert("Your password confirmation is not identical to your first password");
	theform.password2.focus();
	return false;
}

if ((birthday == "") || (birthday == "1900-00-00")) {
	alert("Your birthday is empty or badly formatted. It should look like this: yyyy-mm-dd.");
	theform.birthday.focus();
	return false;
}

if (terms.checked == false) {
	alert("You must read and agree to our terms and conditions before signing up");
	theform.terms.focus();
	return false;
}

if (verifyEmail(email)) return true;
}