// JavaScript Document
function validate() {
	x=document.frmRegister
	email=x.Email.value
	AtPos = email.indexOf("@");
	StopPos = email.lastIndexOf(".");
	password=x.Password.value
	password2=x.ConfirmPassword.value
	fname=x.fName.value
	lname=x.lName.value
	username=x.username.value
	submitOK="True"
	
	//clear all fields
	document.getElementById("emailError").innerHTML="";
	document.getElementById("passwordError").innerHTML="";
	document.getElementById("fNameError").innerHTML="";
	document.getElementById("lNameError").innerHTML="";
	
	if (email.length<1) {
		document.getElementById("emailError").innerHTML="Error: No Information";
		submitOK="False"
	} else if (AtPos == -1 || StopPos == -1 || StopPos - AtPos == 1) {
		document.getElementById("emailError").innerHTML="Error: Invalid Email Address";
		submitOK = "False";
	}
	if (password.length<1) {
		document.getElementById("passwordError").innerHTML="Error: No Information";
		submitOK="False"
	} else if (password != password2) {
		document.getElementById("passwordError").innerHTML="Error: Passwords Do Not Match";
		submitOK="False"
	}
	if (fname.length<1) {
		document.getElementById("fNameError").innerHTML="Error: No Information";
		submitOK="False"
	}
	if (username.length<1) {
		document.getElementById("UsernameError").innerHTML="Error: No Information";
		submitOK="False"
	}

	if (lname.length<1) {
		document.getElementById("lNameError").innerHTML="Error: No Information";
		submitOK="False"
	}
	if (submitOK=="False") {
		return false
	}
}