<!--

var premier_clic = true;

var eAccentGrav = "e";
var eAccentAigu = "e";
var eAccentCirc = "e";
var aAccentGrav = "a";

//On teste si le javascript >= 1.2
if ((String.fromCharCode(232))!=false && (String.fromCharCode(232))!=null) {
	var eAccentGrav = String.fromCharCode(232);
	var eAccentAigu = String.fromCharCode(233);
	var eAccentCirc = String.fromCharCode(234);
	var aAccentGrav = String.fromCharCode(224);
}

function ValideForm2(Form) {
	if (premier_clic == false) {
		alert("In process.");
		return false;
	}
	
	// verif titre
	if (Form.titre.value == "") {
		alert("The 'title' field is mandatory");
		Form.titre.focus() ;
		return false;
	}	
	
	// verif auteur
	/*if (Form.auteur.value == "") {
		alert("The 'author' field is mandatory");
		Form.auteur.focus() ;
		return false;
	}*/
	
	// Verif prix
	var checkOK = "0123456789";
	var checkStr = Form.prix.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length) {
	      allValid = false;
	      break;
	    }
	}
	if ((!allValid)||(Form.prix.value == "")) {
	    alert("The book's price is invalid, please enter only numbers.");
		Form.prix.focus() ;
	    return (false);
	}	
	
	premier_clic = false;
	return true;
}

function ValideForm3(Form) {
	if (premier_clic == false) {
		alert("In process.");
		return false;
	}
	
	// verif contact
	if ((Form.tel.value == "")&&(Form.pagette.value == "")&&(Form.mail.value == "")) {
		alert("Please indicate a means of contacting you : telephone, pager or e-mail");
		Form.tel.focus() ;
		return false;
	}	
	
	// Verif adresse email
	if (Form.mail.value!="") {
		if (!verifMail(Form)) {
			return false ;
		}
	}

	// verif password si champ existe
	// Detecter le champ de confirmation car l'autre est present (hidden si modif)
	if (Form.password2) {
		if (!verifPasswd(Form)) {
			return false ;
		}
	}
	
	premier_clic = false;
	return true;
}

function ValideCompte(Form) {
	if (premier_clic == false) {
		alert("In process.");
		return false;
	}
	
	// Verif numéro de référence
	var checkOK = "0123456789";
	var checkStr = Form.reference.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length) {
	      allValid = false;
	      break;
	    }
	}
	if ((!allValid)||(Form.reference.value == "")) {
	    alert("The reference number is invalid");
		Form.reference.focus() ;
	    return (false);
	}
	
	// verif password si champ existe
	if (!verifPasswd(Form)) {
			return false ;
	}
	
	premier_clic = false;
	return true;
}

function verifPasswd (Form) {
	longueur = Form.password.value.length ;
	if (longueur < 4) {
		alert("The password must be comprised of 4 to 8 characters");
		Form.password.focus() ;
	return false;
	}
	if (Form.password.value == "") {
		alert("The 'password' field is mandatory");
		Form.password.focus() ;
	return false;
	}
	return true;
}

function verifMail (Form) {
	
	// Verif adresse email
	var checkOK = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-@_.";
	var checkStr = Form.mail.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length) {
	      allValid = false;
	      break;
	    }
	}
	if (!allValid) {
	    alert("Only include letters, numbers and the following characters '-@_.'  in 'e-mail'.");
		Form.mail.focus() ;
	    return (false);
	}
	
	posiA = checkStr.indexOf('@');
	posiP = checkStr.lastIndexOf('.');
	if (posiA==-1 || (posiP < posiA+3) || (checkStr.length < 5) || (posiP > checkStr.length - 3)) {
	    alert("You haven't indicated a valid e-mail address.");
		Form.mail.focus() ;
	    return (false);
	}

	return true;
}
//-->