// page 1 form validation
function checkPage1(theForm){
	var firstError = null;
	var count 	= 0;
	var why 	= "";
	
	if (theForm.studyhours.value == ''){
		why += "- You have not specified a number of weekly hours available to study.\n";
		if (firstError == null) firstError = theForm.studyhours;
	}
	if (theForm.prenom.value == ''){
		why += "- You must specify your first name.\n";
		if (firstError == null) firstError = theForm.prenom;
	}
	if (theForm.nom.value == ''){
		why += "- You must specify your last name.\n";
		if (firstError == null) firstError = theForm.nom;
	}
	if (!theForm.sexe[0].checked && !theForm.sexe[1].checked){
		why += "- You must specify your gender.\n";
		if (firstError == null) firstError = theForm.sexe[0];
	}
	if (theForm.ville.value == ''){
		why += "- You must specify your city.\n";
		if (firstError == null) firstError = theForm.ville;
	}
	if (theForm.tel_maison.value == '' && theForm.tel_travail.value == ''){
		why += "- You haven't specified a phone number.\n";
		if (firstError == null) firstError = theForm.tel_maison;
	}
	if (theForm.profession.value == ''){
		why += "- You haven't specified a profession.\n";
		if (firstError == null) firstError = theForm.profession;
	}
	if (theForm.resume.value == ''){
		why += "- You haven't specified your motivation.\n";
		if (firstError == null) firstError = theForm.resume;
	}
	if (!checkEmail(theForm.courriel.value)){
		why += "- You must provide a valid email address.\n";
		if (firstError == null) firstError = theForm.courriel;
   	}
	if (theForm.courriel.value != theForm.courriel2.value){
		why += "- Your confirmation email address does not match the original email address.\n";
		if (firstError == null) firstError = theForm.courriel;
   	}
	if (why != ""){
		errorMsg = "The following errors were detected:\n\n" + why;
		alert(errorMsg);
		if (firstError != null) firstError.focus();
		return false;
	} else {
		return true;
	}
}