	<!-- Hide from old browsers

	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	
	function isValidEmail(strEmail){
		// This function returns true if the email is valid and false if not
		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

	   // Search email text for regular expression matches
		if (strEmail.search(validRegExp) == -1) {return false;} 
		return true; 
	}

	function validate_required(field,alerttxt){
		with (field){
			if (value==null||value==""){
				alert(alerttxt);return false;}
			else {return true;}
		}
	}

	function validate_form(thisform){
		with (thisform){		
			if (validate_required(forename,"Please provide your forename.")==false){
				forename.focus();return false}

			if (validate_required(surname,"Please provide your surname.")==false){
				surname.focus();return false}

			if (validate_required(email,"Please provide your e-mail address.")==false){
				email.focus();return false}

			if (!isValidEmail(email.value)){
				alert("Sorry but the e-mail address provided isn't valid.\n\nPlease check it and try again.");
				email.focus();return false;}

			if (email.value!=email2.value){
				alert("Sorry but the e-mail confirmation doesn't match the first one given.\n\nPlease check it and try again.");
				email2.focus();return false;}

			if (validate_required(username,"Please choose a username.")==false){
				username.focus();return false}

			if (username.value.length<6){
				alert("Sorry, but your username needs to be at least 6 characters long.");
				username.focus();
				return false;
			}

			if (validate_required(password,"Please choose a password.")==false){
				password.focus();return false}

			if (password.value.length<6){
				alert("Sorry, but your password needs to be at least 6 characters long.");
				password.focus();
				return false;
			}
		}
	}

	// end script hide from old browsers -->