// JavaScript Document
function toggleCanadaTax(){
	if (window.document.page1.tax_quebec.checked){
		window.document.page1.tax_canada.checked = true;
	}
}

function checkPage1(theForm){
	var firstError = null;
	var count 	= 0;
	var why 	= "";
	if (theForm.programme.value != ""){
		count++;
	}
	if (theForm.module.value != "") {
		count++;
	}
	if (theForm.theme.value != ""){
		count++;
	}
	if (theForm.cours.value != ""){
		count++;
	}
	if (theForm.equivalence.value != ""){
		count++;
	}
	
	if (count == 0) {
		why += "- Vous n'avez pas spécifié la formation que vous désirez suivre.\n";
		if (firstError == null) firstError = theForm.programme;
	}
	
	else if (count > 1) {
		why += "- Vous devez choisir une seule formation à la fois.\n";
		if (firstError == null) firstError = theForm.programme;
	}
	
	if (theForm.currency.value != 'can' && theForm.tax_canada.checked ){
		why += "- Les résidants du Canada doivent payer en Dollars Canadiens.\n";
		if (firstError == null) firstError = theForm.currency;
	}
	if (theForm.currency.value == 'can' && theForm.tax_canada.checked == false ){
		why += "- Vous devez demeurer au Canada et payer la GST pour payer en Dollars Canadiens.\n";
		if (firstError == null) firstError = theForm.tax_canada;
	}
	if (theForm.currency.value == ''){
		why += "- Vous devez choisir une devise.\n";
		if (firstError == null) firstError = theForm.currency;
	}
/*
	if (theForm.studyhours.value == ''){
		why += "- Vous n'avez pas spécifié un nombre d'heures d'étude par semaine.\n";
		if (firstError == null) firstError = theForm.studyhours;
	}
	else if (!isValidNumber(theForm.studyhours.value,1,100)){
		why += "- Vous n'avez pas spécifié un nombre d'heures d'étude par semaine valide; veuillez rentrer une valeur entre 1 et 100.\n";
		if (firstError == null) firstError = theForm.studyhours;		
	}
*/
	if (theForm.prenom.value == ''){
		why += "- Vous n'avez pas spécifié votre prénom.\n";
		if (firstError == null) firstError = theForm.prenom;
	}
	if (theForm.nom.value == ''){
		why += "- Vous n'avez pas spécifié votre nom.\n";
		if (firstError == null) firstError = theForm.nom;
	}
	if (theForm.niveau_complete.value == ''){
		why += "- Vous n'avez pas spécifié votre niveau complété.\n";
		if (firstError == null) firstError = theForm.niveau_complete;
	}
	if (theForm.code_no.value == '') {
		why += "- Vous n'avez pas spécifié le code # de votre niveau complété\n";
		if (firstError == null) firstError = theForm.code_no;
	}
/*			F								T										T	*/
	if (theForm.montant_initial.value != '' && !theForm.type_montant[0].checked && !theForm.type_montant[1].checked) {
		why += "- Vous n'avez pas spécifé le type de paiement initiale.\n";
		if (firstError == null) firstError = theForm.montant_initial;
	}
/*
	if (!theForm.sexe[0].checked && !theForm.sexe[1].checked){
		why += "- Vous n'avez pas spécifié votre sexe.\n";
		if (firstError == null) firstError = theForm.sexe[0];
	}
	if (theForm.adresse1.value == ''){
		why += "- Vous n'avez pas spécifié votre addresse.\n";
		if (firstError == null) firstError = theForm.addresse1;
	}
	if (theForm.ville.value == ''){
		why += "- Vous n'avez pas spécifié votre ville.\n";
		if (firstError == null) firstError = theForm.ville;
	}
	if (theForm.province.value == ''){
		why += "- Vous n'avez pas spécifié votre province.\n";
		if (firstError == null) firstError = theForm.province;
	}
	if (theForm.pays.value == ''){
		why += "- Vous n'avez pas spécifié votre pays.\n";
		if (firstError == null) firstError = theForm.pays;
	}
	if (theForm.code_postal.value == ''){
		why += "- Vous n'avez pas spécifié votre code postal.\n";
		if (firstError == null) firstError = theForm.code_postal;
	}
	if (theForm.tel_maison.value == ''){
		why += "- Vous n'avez pas spécifié votre telephone maison.\n";
		if (firstError == null) firstError = theForm.tel_maison;
	}
	if (theForm.lieu_naissance.value == ''){
		why += "- Vous n'avez pas spécifié votre lieu de naissance.\n";
		if (firstError == null) firstError = theForm.lieu_naissance;
	}
	if (theForm.profession.value == ''){
		why += "- Vous n'avez pas spécifié votre profession.\n";
		if (firstError == null) firstError = theForm.profession;
	}
	if (theForm.reference.value == ''){
		why += "- Vous n'avez pas spécifié ou vous avez vu l'annonce du collège .\n";
		if (firstError == null) firstError = theForm.reference;
	}
	if (!checkEmail(theForm.courriel.value)){
		why += "- Vous n'avez pas spécifié un courriel valide.\n";
		if (firstError == null) firstError = theForm.courriel;
   	}
*/
	if (why != ""){
		errorMsg = "Les erreurs suivantes on été détectées:\n\n" + why;
		alert(errorMsg);
		if (firstError != null) firstError.focus();
		return false;
	}
	return true;
}