// password - between 6-8 chars, uppercase, lowercase, and numeral

function checkPassword (strng) {
var error = "";
if (strng == "") {
   error = "Vous n'avez pas entré un mot de passe. \n";
}

    var illegalChars = /[\W_]/; // allow only letters and numbers
    
    if ((strng.length < 6) || (strng.length > 8)) {
       error = "Le mot de passe est une mauvaise longueur.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The password contains illegal characters.\n";
    } 
    else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/)))) {
       error = "Le mot de passe doit contenir au moins une lettre majuscule, une lettre minuscule et un chiffre.\n";
    }  
return error;    
}    

function botCheckInfo() {
	alert("Pour empêcher les programmes automatiques (bots) de présenter des spams par ce formulaire, nous avons ajouté une simple vérification de validation de la forme. Vous devez entrer ces 4 chiffres dans la case prévue, afin de soumettre le formulaire.");
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Vous n'avez pas entré une adresse email. \n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "S’il vous plaît entrer une adresse email valide.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "L'adresse e-mail contient des caractères incorrects.\n";
       }
    }
return error;    
}

function checkName (strng) {
var error="";
if (strng == "") {
   error = "S’il vous plaît, entrez votre nom complet.\n";
}
return error;  
}

function checkUserName (strng) {
var error="";
if (strng == "") {
   error = "S’il vous plaît, entrez un nom d'utilisateur.\n";
}
return error;  
}

function checkUserComments (strng) {
var error="";
if (strng == "") {
   error = "S’il vous plaît entrez votre projet emplacement et le type de projet dans la boîte de demande de renseignements.\n";
}
return error;  
}

function checkContactComments (strng) {
var error="";
if (strng == "") {
   error = "S’il vous plaît entrer vos questions ou commentaires en grande boîte fournie.\n";
}
return error;  
}

function checkUserEnquiry (strng) {
var error="";
if (strng == "") {
   error = "S’il vous plaît, entrez votre boîte besoins de l'enquête.\n";
}
return error;  
}

function checkQuantity (strng) {
  for (var i = 0; i < checkQuantity.length(strng); i++) {
    if (checkQuantity[i].value == "") {
      error = "Please enter a Quantity";
       allInputs[i].focus();
    }
	 return error;
  }
}

function checkProjectLocation (strng) {
var error="";
if (strng == "") {
   error = "Please enter the delivery location.\n";
}
return error;  
}
	
 function checkBusiness (strng) {
var error="";
if (strng == "") {
   error = "Please enter the name of your organisation.\n";
}
return error;  
}

 function checkAddress (strng) {
var error="";
if (strng == "") {
   error = "Please enter your street number and street name.\n";
}
return error;  
}
 
 function checkBusinessLocation (strng) {
var error="";
if (strng == "") {
   error = "Please enter your city or town name.\n";
}
return error; 
} 

 function checkCountry (strng) {
var error="";
if (strng == "") {
   error = "Because we export worldwide, please enter your country name.\n";
}
return error;
}
	 
 function checkTelephone (strng) {
var error="";
if (strng == "") {
   error = "Dans le cas où nous avons besoin de discuter des exigences particulières, s’il vous plaît entrer votre numéro de téléphone.\n";
}
return error;  
}
