//Vérifie le nombre de caractères saisis
function checkChar(fieldObj,maxChars){
	str = fieldObj.value
	nbCharInStr = str.length
	if (nbCharInStr >= maxChars){
		fieldObj.value = fieldObj.value.substring(0, maxChars)
		alert(maxChars+" caractères maximum !");
	}
}

//Fonction qui vérifie que l'expression est un e-mail
function isMail(expression) {
	var myRegExp = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
	/*var myRegExp = /^.+@.+\..{2,3}$/*/
	return myRegExp.test(expression);
}

// Check le formulaire de la page support.htm
function verifyData() {
	// N° de client
	if (document.SupportAstral.valeur1.value.length == 0) {
      alert("You must enter a Customer ID");
      document.SupportAstral.valeur1.focus();
	  return false;
    }
	if (isNaN(document.SupportAstral.valeur1.value) || (document.SupportAstral.valeur1.value.length!=6)) {
      alert("Client number must have 6 digits");
      document.SupportAstral.valeur1.value = "";
      document.SupportAstral.valeur1.focus();
	  return false;
    }
	// e-mail
	if (document.SupportAstral.exped.value.length == 0) {
      alert("You must enter an e-mail address");
      document.SupportAstral.exped.focus();
	  return false;
  	}
	// vérification du format de l'e-mail
	if(!isMail(document.SupportAstral.exped.value)){
		alert("You must enter a valid e-mail address");
		document.SupportAstral.exped.value = "";
		document.SupportAstral.exped.focus()
		return false
	}
	// Nom
	if (document.SupportAstral.valeur2.value.length == 0) {
      alert("You must enter your Name");
      document.SupportAstral.valeur2.focus();
	  return false;
  	}
	// Prénom
	if (document.SupportAstral.valeur3.value.length == 0) {
      alert("You must enter your First Name");
      document.SupportAstral.valeur3.focus();
	  return false;
  	}
	// Pays
	if (document.SupportAstral.valeur6.value == "Sélectionnez le pays"){
	  alert("Select a country");
	  document.SupportAstral.valeur6.focus();
	  return false;
	}
	// Système
	if (document.SupportAstral.valeur9.value.length == 0){
	  alert("Select your system");
	  document.SupportAstral.valeur9.focus();
	  return false;
	}
	// Type
	if (document.SupportAstral.valeur10.value.length == 0){
	  alert("Select your computer type");
	  document.SupportAstral.valeur10.focus();
	  return false;
	}
	// Processeur
	if (document.SupportAstral.valeur11.value.length == 0){
	  alert("Select your computer processor");
	  document.SupportAstral.valeur11.focus();
	  return false;
	}
	// Vitesse
	if (document.SupportAstral.valeur12.value.length == 0){
	  alert("Select processor's speed");
	  document.SupportAstral.valeur12.focus();
	  return false;
	}
	// OS
	if (document.SupportAstral.valeur13.value.length == 0){
	  alert("Select operating system");
	  document.SupportAstral.valeur13.focus();
	  return false;
	}
	// RAM
	if (document.SupportAstral.valeur14.value.length == 0){
	  alert("Select RAM");
	  document.SupportAstral.valeur14.focus();
	  return false;
	}
	// descriptif
	if (document.SupportAstral.valeur15.value.length == 0){
	  alert("Enter your problem");
	  document.SupportAstral.valeur15.focus();
	  return false;
	}
 	return true	
}
