function initialisePage() {
	var myForm = document.getElementById("regForm");
	if ( myForm != null )
	{
		myForm.onsubmit = function () { return validateForm() };
	}
}

function validateForm() {

	var myErrors = "";
	var myEmailPattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	
	myErrors += validatePresence( "firstname", "Please supply your first name" );
	myErrors += validatePresence( "surname", "Please supply your surname" );
	myErrors += validatePattern ( "email", myEmailPattern, "Please enter a valid internet email address");
	myErrors += validatePresence( "company", "Please supply your company name" );
	myErrors += validatePresence( "address1", "Please supply your address" );
	myErrors += validatePresence( "postcode", "Please supply your post code" );
	myErrors += validatePresence( "offercode", "Please supply your offer code" );
	myErrors += validatePresence( "dob", "Please supply your date of birth" );
	
	myErrors += validatePresence( "fusername", "Please supply a username" );
	myErrors += validatePresence( "fpassword", "Please supply a password" );
	myErrors += validatePresence( "cpassword", "Please confirm your password" );
	
	myErrors += CompareValues( "fpassword", "cpassword", "The supplied passwords do not match, please try again" );
	
	if ( myErrors.length > 0 )
	{
		var myErrorDiv = document.getElementById("Errors");
		var myErrorText = "<ul class='alert'>\n" + myErrors + "</ul>";
		myErrorDiv.innerHTML = myErrorText;
		return false;
	}
	else
	{
		return true;
	}

}
