function fenetre(win){
fen=open(win, "fenetre", "toolbar=no, directories=no, status=no, menubar=no, scrollbars=yes, left=50, top=50, resizable=yes,width=780,height=550");
 }

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
        result = true;
  }
  return result;
}

function FormValidator(theForm)
{


 if (theForm.prenom.value == "")
  {
    alert("Vous devez saisir votre prenom.");
    theForm.prenom.focus();
    return (false);
  }

  if (theForm.date_naissance.value == "")
  {
    alert("Vous devez saisir votre date de naissance.");
    theForm.date_naissance.focus();
    return (false);
  }

  if (theForm.e_mail.value == "")
  {
    alert("Entrez une valeur dans le champ \"E-mail\" .");
    theForm.e_mail.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.e_mail.value))
  {
    alert("Entrez une adresse E-mail complète de la form votrenom@votredomaine.com");
    theForm.e_mail.focus();
    return (false);
  }

  if (theForm.e_mail.value.length < 3)
  {
    alert("Erreur");
    theForm.e_mail.focus();
    return (false);
  }


  return (true);
}

function Validator(theForm)
{

  if (theForm.nb_membre.value == "")
  {
    alert("Entrez votre numéro de membre.");
    theForm.nb_membre.focus();
    return (false);
  }

  if (theForm.date_naissance.value == "")
  {
    alert("Vous devez saisir votre date de naissance.");
    theForm.date_naissance.focus();
    return (false);
  }
  
  return (true);
}

function check_radio(radio){
var check=0;
for (var i=0; i<radio.length;i++) {
         if (radio[i].checked) {
            check=1;
         }
}
   if (check)
       return true;
    else
       return false;
}

function save_check(theForm)
{

if(theForm.prenom&&theForm.nom)
{
  if (theForm.prenom.value == "")
    {
     alert("Entrez votre prénom.");
     theForm.prenom.focus();
     return (false);
    }

  if (theForm.nom.value == "")
    {
     alert("Entrez votre nom.");
     theForm.nom.focus();
     return (false);
    }
}

if (!check_radio(theForm.sexe))
  {
    alert("Renseignez votre sexe");
    return (false);
  }

if (!check_radio(theForm.etudiant))
  {
    alert("Etes vous etudiant ?");
    return (false);
  }


if(theForm.e_mail){
   if (theForm.e_mail.value == "")
  {
    alert("Entrez une valeur dans le champ \"E-mail\" .");
    theForm.e_mail.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.e_mail.value))
  {
    alert("Entrez une adresse E-mail complète de la form votrenom@votredomaine.com");
    theForm.e_mail.focus();
    return (false);
  }

  if (theForm.e_mail.value.length < 3)
  {
    alert("Erreur");
    theForm.e_mail.focus();
    return (false);
  }

}

if(theForm.tel_portable)
{
  if (theForm.tel_portable.value == "")
    {
     alert("Si pas de portable, inscrire néant");
     theForm.tel_portable.focus();
     return (false);
    }
}

if(theForm.adresse)
{
  if (theForm.adresse.value == "")
    {
     alert("Entrez votre Adresse.");
     theForm.adresse.focus();
     return (false);
    }
}

if(theForm.code_postal)
{
  if (theForm.code_postal.value == "")
    {
     alert("Entrez votre code postal.");
     theForm.code_postal.focus();
     return (false);
    }
}

if(theForm.ville)
{
  if (theForm.ville.value == "")
    {
     alert("Entrez votre Ville.");
     theForm.ville.focus();
     return (false);
    }
}

if(!theForm.lieu.checked&&!theForm.lieu2.checked)
{
  alert("Veuillez choisir un lieu.");
  return (false);
}


  if(!check_radio(theForm.type_abo))
  {
    alert("Vous devez choisir quel type d'abonnement vous voulez acheter.");
    return (false);
  }


return true;


}