var Regemail = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/
var reg6Digit= /^\s*(\+|-)?\d+\s*$/
	
function validateRegister()
{
	var fn = escape(document.getElementById("FirstName").value)
	var ln = escape(document.getElementById("LastName").value)
	var email = escape(document.getElementById("Email").value)
	var password = escape(document.getElementById("Password").value)
	var password2 = escape(document.getElementById("Password2").value)
	var captcha = escape(document.getElementById("captchacode").value)
	var landline = escape(document.getElementById("Landline").value)
	var mobile = escape(document.getElementById("Mobile").value)

	if (fn == ""){
		alert("Please enter your first name.");
		document.getElementById("FirstName").focus();
		return false;
	}
	else if (ln == ""){
		alert("Please enter your last name.");
		document.getElementById("LastName").focus();
		return false;
	}
	else if (email == ""){
		alert("Please enter your email address.");
		document.getElementById("Email").focus();
		return false;
	}
	else if (email.search(Regemail)==-1){
		alert("Please enter a valid email address.");
		document.getElementById("Email").focus();
		document.getElementById("Email").select();
		return false;
	}
	else if (landline == "" && mobile==""){
		alert("Please enter a landline or mobile number.");
		document.getElementById("Landline").focus();
		return false;
	}
	else if (password == ""){
		alert("Please enter a password.");
		document.getElementById("Password").focus();
		return false;
	}
	
	else if (password.length <6 ){
		alert("Password must be between 6 to 12 characters.");
		document.getElementById("Password").focus();
		document.getElementById("Email").select();
		return false;
	}
	else if (password2 == ""){
		alert("Please re-enter your password.");
		document.getElementById("Password2").focus();
		return false;
	}
	else if (password != password2){
		alert("Passwords do not match.");
		document.getElementById("Password2").focus();
		document.getElementById("Password2").select();
		return false;
	}
	else if (captcha == ""){
		alert("Please enter the characters you see in the image.");
		document.getElementById("captchacode").focus();
		return false;
	}
	
	return true;
}
