function EMailValide(EMail)
{

  if ( (EMail == "") || (EMail.length < 5) ) return(false);
  
  if (EMail.length < 5) return false

  if (!CaracPermis(EMail,"@.0123456789-abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ+"))
  {
    return (false);
  }

  var LeAt = EMail.indexOf("@")+1;
  //var LePt = EMail.indexOf(".")+1;//Attention, si le point est avant le "@" , on s'en rendra pas compte !
  var LePt = EMail.lastIndexOf(".")+1;
  
  //alert("email="+EMail+" - At="+LeAt+" - Pt(dernier)="+LePt);
  
  //if ( (LeAt <= 1) || (LePt < 1) || (LeAt == EMail.length) || (LePt == EMail.length) ) return(false);//Attention, si le point est avant le "@" , on s'en rendra pas compte !
  if ( (LeAt <= 1) || (LePt <= 1) || (LePt < LeAt) || (LeAt == EMail.length) || (LePt == EMail.length) || (EMail.charAt(LeAt-2)==".") ) return(false);
 
  return(true);
}
function UnEntier(Ent)
{
  var checkOK = "0123456789";
  var checkStr = Ent;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    C = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (C == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += C;
  }
  if (!allValid)
  {
    return (false);
  }
  return(true);
}

function UnNomPropre(Ch)
{
  var checkStr = Ch;
  var checkOK = "- '.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    C = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (C == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      return(false);
    }
    return(true);
  }
}
  
function CaracPermis(Ch,Carac)
{
  var checkOK = Carac;
  var checkStr = Ch;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    C = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
    if (C == checkOK.charAt(j)) break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += C;
  }
  if (!allValid)
  {
    return (false);
  }
  return(true);
}

function Format_Prix_Virgule(UnPrix)
{
  var Prix   = UnPrix;

  if ( (Prix.indexOf(",")+1) > 0 )
  {
    Prix = parseFloat(Prix.replace(",","."));
  }
  else Prix = Prix*1;
  Prix = Prix*1;
  return(Prix);
}//function Format_Prix_Virgule(UnPrix)



function Activer_choix_eprv()
{
  form_eprv_choix.submit();
  return true;
}
function verifier_fiche(ajout_ins)
{ 
  if(controler_fiche(ajout_ins))
  {
    ajout_ins.submit(); 
    return true;
  }
}
function controler_fiche(ajout_ins)
{ 
  if (ajout_ins.tel.value == "")
  {
    alert("N° de téléphone Obligatoire ");
    ajout_ins.tel.focus();
    return (false);
  }
  if (!CaracPermis(ajout_ins.tel.value,"0123456789") || (ajout_ins.tel.value.length < 10) )
  {
    alert("N° de téléphone INVALIDE \nVous ne devez saisir que DES CHIFFRES!\n Exp: 0892683313 \n (0033892683313)");
    ajout_ins.tel.focus();
    return (false);
  }
  var ch =0;
  var ch_tel =0;
  ch_tel=ajout_ins.tel.value;
  ch=ch_tel.substring(0,2);
  if(ch!="06") 
  {
    alert("N° INVALIDE \nVous ne devez saisir que des N° de téléphone portable ");
    ajout_ins.tel.focus();
    return (false);
  }
  var EMail = ajout_ins.email.value;
  if (!EMailValide(EMail))
  {
    alert("Adresse EMail \n'"+EMail+"' \n Invalide !");
    ajout_ins.email.focus();
    return (false);
  }
  return true;
}

function paiement_cb_fiche(form_eprv_cb)
{ 
  form_eprv_cb.submit(); 
  return true;
}
