// JScript source code

function checkForm(Form){
	if (Form.program.value == ""){
			alert("You must select a program you are interested in.")
			return false
	}
	if (Form.campus.value == ""){
			alert("You must select a campus you are interested in attending.")
			return false
	}
	
	if (Form.session.value == ""){
			alert("You must select a session you are interested in attending.")
			return false
	}
	
	if (Form.firstname.value == ""){
		alert("You must provide your first name.")
		return false
	}
	
	if (Form.lastname.value == ""){
				alert("You must provide your last name.")
				return false
	}
	
	if (Form.dob.value == ""){
			alert("You must provide your date of birth. (XX/XX/XXXX)")
			return false
	}
	
	if (Form.currentaddress.value == ""){
			alert("You must provide your current address.")
			return false
	}
	
	if (Form.currentcity.value == ""){
			alert("You must provide your current city.")
			return false
	}
	
	if (Form.currentstate.value == ""){
			alert("You must provide your current state.")
			return false
	}
	
	if (Form.currentzip.value == ""){
				alert("You must provide your current zip code.")
				return false
	}
	
	if (Form.homephone.value == ""){
			alert("You must provide your home phone number.")
			return false
	}
	
 	if (!Form.curraddress[0].checked){
 	if (!Form.curraddress[1].checked){
			alert("You must state if your mailing address is the same as your current address.")
 			return false}
	}
	
	if (Form.email.value == ""){
			alert("You must provide an Email address.")
			return false
	}
	
	if (!validateEmail(Form.email.value)){
			alert("You must provide a valid Email address.")
			return false
	}
	
	if (Form.message.value == ""){
			alert("You must tell us how you heard about our program.")
			return false
	}
	return true
	
}

function validateEmail(emailAddress){
	atPos = emailAddress.indexOf("@",1)
	periodPos = emailAddress.indexOf(".",atPos)
	
	if (atPos == -1){
		return false
	}
	
	if (periodPos == -1){
		return false
	}
	
	if ((periodPos - atPos) < 3 ){
		return false
	}
	
	if ((emailAddress.length - periodPos) < 3){
		return false
	}
	
	return true

}

