// JavaScript Document

function checkForm(formObj) {
	var formOK = true;
	if (formObj.forename.value == "") { // name field not null
		window.alert("You must provide your name");
		//formObj.forename.focus();
		formOK = false;
	}
	
	if (formObj.surname.value == "") { // name field not null
		window.alert("You must provide your surname");
		//formObj.surname.focus();
		formOK = false;
	}
	
	/*
	if (formObj.agree.checked == false) { 
		window.alert("You must agree to our terms to register");
		formOK = false;
	}
	*/

	email_validate = checkEmail(formObj.email.value);  // check email address

	if (formOK == true) {
		formObj.submit();
	}

}


function checkEmail(email) {
		if (email.length == 0) {
			window.alert("You must provide your e-mail address.");
			return false;			
		}
		if (email.indexOf("/") > -1) {
			window.alert("E-mail address has invalid character: /");
			return false;
		}
		if (email.indexOf(":") > -1) {
			window.alert("E-mail address has invalid character: :");
			return false;
		}
		if (email.indexOf(",") > -1) {
			window.alert("E-mail address has invalid character: ,");
			return false;
		}
		if (email.indexOf(";") > -1) {
			window.alert("E-mail address has invalid character: ;");
			return false;
		}
		if (email.indexOf("@") < 0) {
			window.alert("E-mail address is missing @");
			return false;
		}
		if (email.indexOf("\.") < 0) {
			window.alert("E-mail address is missing .");
			return false;
		}
	}
	
