function initialisePage()
{
	var myForm = document.getElementById("registerForm");
	myForm.onsubmit = function() { return validateForm(); };
}

function validateForm() 
{
	var myErrors = "";
	var myEmailPattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	var isValid = false;
	
	// All of the checking now appears here
	myErrors += validatePresence( "email", "Please supply an email address" );
	myErrors += validatePattern( "email", myEmailPattern, "Please enter a valid internet email address");
	myErrors += validatePresence( "password", "Please supply a password" );
	
	var myPWElem = document.getElementById("password");
	var myConfirmElem = document.getElementById("confirm");
	
	if ( myPWElem.value != myConfirmElem.value )
	{
		myErrors += "<li>The passwords you have provided do not match</li>";
	}
	
	if ( myErrors != "" )
	{
		var myErrorDiv = document.getElementById( "errors" );
		myErrorDiv.innerHTML = myErrors;
	}
	else
	{
		isValid = true;
	}
	
	return isValid;
}
