function check_form()
{

  if (!check_champs_vides())
   return false;
  if (!check_email())
   return false;
}


function check_champs_vides()
{
  if (document.images) {
    check_ok = true;
    champs_oublies = "";
    with (document.formAmovi) {
      email_val = subject.value;
      if (subject.value == '') {
        champs_oublies += "   - Sujet\n";
        check_ok = false;
      }
      email_val = email.value;
      if (email.value == '') {
        champs_oublies += "   - E-mail\n";
        check_ok = false;
      }
    }
    
    if (check_ok == false) {
      alert("Merci de bien vouloir remplir le(s) champ(s) suivant(s) : \n" + champs_oublies);
      return false;
    } else {
      return true;
    }
  } else {
    return false;
  }
}


function check_email()
{
 var str = document.formAmovi.email.value;
 var filter = /^.+@.+\..{2,3}$/;

 if (filter.test(str)) {
  return true;
 } else {
  alert("Veuillez saisir une adresse e-mail valide.");
  return false;
 }
}


function check_telephone()
{
  if (!checkNum(document.formAmovi.telephone.value, 10, 15)) {
    alert("Votre numˇro de tˇlˇphone est incorrect");
    return false;
  } else return true;
}


function checkStringLen (string, min, max) 
{
 if ( (string.length < min) || (string.length > max) ) {
  return false;
 }
else if ( (string.length >= min) && (string.length <= max) ) {
  return true; 
 } 
}


function checkNum (string, min, max)
{
 var sValue = checkStringLen (string, min, max); 
 if (sValue == true) {
  var filter = /^[0-9]+$/; 
  if (filter.test(string))
   sValue = true; 
  else sValue = false; 
 }
 return sValue;
}


function checkRadio (string)
{
 if (string != "")
  return true;
 else return false;
}


function checkSelect (string)
{
 if (string == 0) {
  sValue = "false";
 } 
 else sValue = "true";
  return sValue;
}

