function minhauteur() {
  if (window.innerHeight) var hauteur = window.innerHeight - 109;
  else {
    if (document.body.clientHeight) var hauteur = document.body.clientHeight - 109;
  }
  document.write('<div id="minheight" style="height: '+hauteur+'"></div>');
}

function OuvertureWindow(adresse) {
  var MyWindow = window.open(adresse, 'popup', 'resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,directories=no,location=no,width=600,height=500,closed=no,opener=no');
}
  
function navroll(id,etat) {
  if (document.images['nav'+id]) {
    document.images['nav'+id].src = '../images/phot_'+id+'_'+etat+'.jpg';
  }
}

function test_vide(champ,libelle) {
  if (champ.value.length == 0) return false;
  if (champ.value.length > 0) {
    for (var i = 0; i < champ.value.length; i++) {
      var tout_espaces = true;
      if (champ.value.substring(i, i + 1) != ' ') tout_espaces = false;
    }
    if (tout_espaces) return false;
  }
  return true;
}

function test_email(champ) {
  if (champ.value.length < 5) { return false }
  if (champ.value.indexOf('@') < 0) { return false }
  var mailparts = champ.value.split('@');
  if (mailparts[0].length < 1) { return false }
  if (mailparts[1].indexOf('.') < 0) { return false }
  var domaine = mailparts[1].split('.');
  if (domaine[0].length < 1) { return false }
  if (domaine[1].length < 2) { return false }
  return true;
}

function verification(form,formver) {
  if (!test_vide(form.frmchmp_a)) {alert('Veuillez saisir votre nom.'); form.frmchmp_a.focus(); return false}
  if (!test_vide(form.frmchmp_b)) {alert('Veuillez saisir votre prénom.'); form.frmchmp_b.focus(); return false}
  if (formver==2) {
    if (!test_vide(form.frmchmp_f)) {alert('Veuillez saisir votre numéro de téléphone.'); form.frmchmp_f.focus(); return false}
  }
  if (!test_vide(form.frmchmp_g)) {alert('Veuillez saisir votre adresse e-mail.'); form.frmchmp_g.focus(); return false}
  if (!test_email(form.frmchmp_g)) {alert('Veuillez verifier votre adresse e-mail.'); form.frmchmp_g.focus(); return false}
  form.submit();
  return false;
}
