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_day=theform.birthday_day.value;
var birthday_month=theform.birthday_month.value;
var birthday_year=theform.birthday_year.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_day == "") || (birthday_month == "") || (birthday_year == "")) {
	alert("Please insert your birthday");
	theform.birthday_day.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;
}