// retourne un objet xmlHttpRequest.
// méthode compatible entre tous les navigateurs (IE/Firefox/Opera)
										  
function getXMLHTTP(){
  var xhr=null;
  if(window.XMLHttpRequest) // Firefox et autres
  xhr = new XMLHttpRequest();
  else if(window.ActiveXObject){ // Internet Explorer
    try {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e1) {
        xhr = null;
      }
    }
  }
  else { // XMLHttpRequest non supporté par le navigateur
    alert("Votre navigateur n'est pas compatible IE/Firefox/Opera ou d'une version trop ancienne.");
  }
  return xhr;
}


function afficher(xmlDoc,ou) { 
var target = document.getElementById(ou);
target.innerHTML = xmlDoc ;
}

var _x = null ; 
var _y = null ;

var _xmlHttp = null; //l'objet xmlHttpRequest utilisé pour contacter le serveur

function f_2ins(id,bool){
  
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","2insc.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"inf2ins")
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&bool="+bool)
  }
}


function f_mobil(id,bool){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","mobil.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infmobil");  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&bool="+bool)
   }
}

function f_diplo(id,rang){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","diplo.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infdipl"+rang);  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&rang="+rang)
   }
}

function f_attest(id,bool){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","attest.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infattest");  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&bool="+bool)
   }
}

function f_sejour(id,rang){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","sejour.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infsejour"+rang);  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&rang="+rang)
   }
}

function f_cand(id,bool){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","autreCand.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infocand");  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&bool="+bool)
   }
}

function f_benev(id,rang){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","benev.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infobenev"+rang);  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&rang="+rang)
   }
}

function f_activR(id,rang){
  if (id != "B") id="" ;
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","activR.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"infoactivR"+rang+id);  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&rang="+rang)
   }
}

function f_langue(id,rang){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","langue.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"inflang"+rang);  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("id="+id+"&rang="+rang)
   }
}

function f_nivLang(idstag,nivlang){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","nivLang.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"nivLang");  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("idstag="+idstag+"&nivlang="+nivlang)
   }
}

function existe()
{
	if ((ltrim(document.civ.nom.value) != "") && (ltrim(document.civ.prenoms.value) != "") && (ltrim(document.civ.dtnais.value) != "") )
	{	f_existe(document.civ.nom.value,document.civ.prenoms.value,document.civ.dtnais.value) ; }
	
}

function f_existe(nom,prenoms,dtnais){
  if(_xmlHttp&&_xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }
  _xmlHttp=getXMLHTTP();
  if(_xmlHttp){
    //appel à l'url distante
    _xmlHttp.open("POST","existe.php",true);
    _xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
     		 afficher(_xmlHttp.responseText,"existe");  
      }
    };
    // envoi de la requete
	 _xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') ;
     _xmlHttp.send("nom="+nom+"&prenoms="+prenoms+"&dtnais="+dtnais)
   }
}


function f_autre1(x)
{
		 		 if(document.getElementById) 
				 {  
				   if (x != "Autre")
   				   {  document.getElementById('autrecadre').style.visibility = 'hidden' ; 
				   	  document.civ.autrecadre.value = "";
					 				  
				   }
				   if (x == "Autre")
   				   {  document.getElementById('autrecadre').style.visibility = 'visible' ; }
				 }
}

function f_autre2(x)
{
		 		 if(document.getElementById) 
				 {  
				   if (x != "Autres")
   				   {  document.getElementById('autrepays').style.visibility = 'hidden' ; 
				   	  document.civ.autrepays.value = "";
					 				  
				   }
				   if (x == "Autres")
   				   {  document.getElementById('autrepays').style.visibility = 'visible' ; }
				 }
}

function showTip(typ,what)
{
  // je récupere les coordonnées du clic pour positionner certains calques
  // toujours à coté de l'image cliquée dans les pages au contenu variable
  // via les balises <div> et AJAX

  detectMouse(what) ;
  
  if (document.getElementById('TIP_'+typ).style.visibility == 'hidden' )
  {
   if (document.getElementById('IMAGE_100')) 
   {
   document.getElementById('TIP_100').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_100').src = "./img/small_help.gif" ;   
   }
   document.getElementById('TIP_101').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_101').src = "./img/small_help.gif" ;
   document.getElementById('TIP_102').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_102').src = "./img/small_help.gif" ;
   document.getElementById('TIP_103').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_103').src = "./img/small_help.gif" ;
   document.getElementById('TIP_104').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_104').src = "./img/small_help.gif" ;
   document.getElementById('TIP_105').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_105').src = "./img/small_help.gif" ;
   document.getElementById('TIP_106').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_106').src = "./img/small_help.gif" ;
   document.getElementById('TIP_107').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_107').src = "./img/small_help.gif" ;
   document.getElementById('TIP_108').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_108').src = "./img/small_help.gif" ;
   if (document.getElementById('IMAGE_111')) 
   {
   document.getElementById('TIP_111').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_111').src = "./img/small_help.gif" ;
   }
   if (document.getElementById('IMAGE_109')) 
   {
   document.getElementById('TIP_109').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_109').src = "./img/small_help.gif" ;
   }
   document.getElementById('TIP_110').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_110').src = "./img/small_help.gif" ;
   if (document.getElementById('IMAGE_112')) 
   {
   document.getElementById('TIP_112').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_112').src = "./img/small_help.gif" ;
   }
   if (document.getElementById('IMAGE_113')) 
   {
   document.getElementById('TIP_113').style.visibility = 'hidden' ;
   document.getElementById('IMAGE_113').src = "./img/small_help.gif" ;
   }


   // positionnement relatif
   if ( (typ == '100') || (typ == '106') || (typ == '107') || (typ == '108') || (typ == '111') || (typ == '109') || (typ == '110') || (typ == '112') || (typ == '113')  )
   {
 	eval(document.getElementById('TIP_'+typ).style.left = _x + 20 );
	eval(document.getElementById('TIP_'+typ).style.top = _y + 20 );
   }


   document.getElementById('TIP_'+typ).style.visibility = 'visible' ;
   document.getElementById('IMAGE_'+typ).src = "./img/small_help_selected.gif" ;
  }
  else
  { 
   document.getElementById('TIP_'+typ).style.visibility = 'hidden' ;
   document.getElementById('IMAGE_'+typ).src = "./img/small_help.gif" ;
  }
}

function CheckLen(Target,n,maxLength) 
{
    var CharsLeft = 0;
	
    if (Target.value.length > maxLength) 
	{
      Target.value = Target.value.substring(0,maxLength);
      CharsLeft = 0;
    }
    else 
	{
      CharsLeft = maxLength - Target.value.length;
    }
	var champ=eval ("document.civ.caract"+n) ;
    champ.value = CharsLeft;
}

function detectMouse(e){
    if(parseInt(navigator.appVersion) >=4){
        if(navigator.appName == 'Netscape'){
            _x = e.pageX ;
            _y = e.pageY;
        }
        else{
            _x = event.x ;
            _y = event.y;
        }
    }

}

function verif(mod)
{

 // return true ;   

  message=verif1();
  if (message!='ok')
  { 
    oOnglet.setFocus(1);
    alert( message);
    return false;  }
  
  message=verif2(mod);
  if (message!='ok')
  { 
    oOnglet.setFocus (2);
    alert( message);
    return false;  }

  message=verif3();
  if (message!='ok')
  { 
    oOnglet.setFocus (3);
    alert( message);
    return false;  }

  message=verif4();
  if (message!='ok')
  { 
    oOnglet.setFocus (4);
    alert( message);
    return false;  }

  message=verif5();
  if (message!='ok')
  { 
    oOnglet.setFocus (5);
    alert( message);
    return false;  }

  message=verif6();
  if (message!='ok')
  { 
    oOnglet.setFocus (6);
    alert( message);
    return false;  }

  message=verif7();
  if (message!='ok')
  { 
    oOnglet.setFocus (7);
    alert( message);
    return false;  }

  message=verif8();
  if (message!='ok')
  { 
    oOnglet.setFocus (8);
    alert( message);
    return false;  }
  
  // onglet optionnel
  if (document.getElementById('boutonVoeux'))
  {
	// dans voeux.js 
	message=verifVoeux();
	if (message!='ok')
  	{ 
   	  oOnglet.setFocus (9);
    	  alert( message);
        return false;  
	}
  }

  message=verif9();
  if (message!='ok')
  { 
    if (document.getElementById('boutonVoeux')) { oOnglet.setFocus (10); } else { oOnglet.setFocus (9); } 
    alert( message);
    return false;  }

  return true;
}

function verif1()
{
     message = "";

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}


function verif2(mod)
{
     // contrôle de la saisie sur le 2eme onglet du formulaire d'inscription 
     var message = "";

     var lazone=ltrim(document.civ.nom.value);
     var len=lazone.length ;
     if (len == 0)
     {
          message += "Vous n'avez pas saisi votre nom ;\n" ;
     }
	
     if (mod != "1")
     {
       var lazone=ltrim(document.civ.photo.value);
       var len=lazone.length ;
       if (len == 0)
       {
          message += "Vous n'avez pas choisi de photo;\n" ;
       }
     }

     var lazone=ltrim(document.civ.prenoms.value);
     var len=lazone.length ;
     if (len == 0)
     {
          message += "Vous n'avez pas indiqué votre(vos) prénoms;\n" ;
     }

     var lazone=ltrim(document.civ.dtnais.value);
     var len=lazone.length ;
     if ((len == 0)||(len < 10))
     {
            message += "Vous n'avez pas indiqué votre date de naissance;\n";
     }
     else
     {
       if (!(fnum(lazone)))
       {     
            message += "le format de la date de naissance est incorrect;\n" ;
       }
     }

     var lazone=ltrim(document.civ.comnais.value);
     var len=lazone.length ;
     if  (len == 0) 
     {
	  message += "Vous n'avez pas indiqué votre commune de naissance;\n";
     }


     var lazone=ltrim(document.civ.paynais.value);
     var len=lazone.length ;
     if (len == 0)
     {
	message += "Vous n'avez pas indiqué votre pays de naissance;\n";
     }

     if (document.civ.sitfam.selectedIndex == 0)
     {
       message += "Vous n'avez pas indiqué votre situation de famille;\n" ;
     }


     var mess1 = "Dans votre adresse cette année, \n" ;

     var lazone=ltrim(document.civ.adrrue1.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué le nom de votre rue;\n";
     }

     var lazone=ltrim(document.civ.adrcp1.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué le code postal;\n";
     }
     else
     {
     if (!(fnum(lazone)))
     {     
            mess1 += "le code postal semble incorrect;\n" ;
     }
     }

     var lazone=ltrim(document.civ.adrville1.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué votre ville;\n";
     }

     var lazone=ltrim(document.civ.pays1.value);
     var len=lazone.length ; 
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué votre pays ;\n";
     }
     if (lazone == 99)
     {
        if (document.civ.autrenat.selectedIndex == 0)
	  { 
		mess1 += "Vous n'avez pas précisé votre pays ;\n";
	  }
     }
	  
     var lazone=ltrim(document.civ.tel.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué le numéro de téléphone;\n";
     }
     else
     {
     if (!(fnum(lazone)))
     {     
            mess1 += "le numéro de teléphone semble incorrect;\n" ;
     }
     }

     var lazone=ltrim(document.civ.port.value);
     var len=lazone.length ;
     if (len != 0)
     {
    	 if (!(fnum(lazone)))
      {     
            mess1 += "le numéro de portable semble incorrect;\n" ;
      }
     }

     var lazone=ltrim(document.civ.mel.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas indiqué votre courriel;\n";
     }
     else
     {
		if (!(TestMel(lazone)))
	   	{
		   mess1 += "l'adresse mel est incorrecte;";
		}
     }

     var lazone=ltrim(document.civ.confmel.value);
     var len=lazone.length ;
     if (len == 0)
     {
	mess1 += "Vous n'avez pas confirmé votre courriel;\n";
     }
     else
     {
		var lazone1=ltrim(document.civ.mel.value);
		
		if (lazone != lazone1)
	   	{
		   mess1 += "les 2 adresses sont différentes;";
		}

     }


     if (mess1 != "Dans votre adresse cette année, \n" )
     { message += "\n"+mess1+"\n" ; }

    
     // l'adresse permanente est facultative, mais si certains champs saisis,
     // alors tous sont obligatoires

     var lazone=ltrim(document.civ.adrnum2.value + document.civ.adrrue2.value + document.civ.adrcp2.value + document.civ.adrville2.value + document.civ.pays2.value );
     var len=lazone.length ;
     if (len != 0)
     {

        var mess1 = "Dans votre adresse permanente, \n" ;

        var lazone=ltrim(document.civ.adrnum2.value);
        var len=lazone.length ;
        if (len == 0)
        {
	   mess1 += "le numéro est absent;\n";
        }

        var lazone=ltrim(document.civ.adrrue2.value);
        var len=lazone.length ;
        if (len == 0)
        {
	   mess1 += "Vous n'avez pas indiqué le nom de votre rue;\n";
        }

        var lazone=ltrim(document.civ.adrcp2.value);
        var len=lazone.length ;
        if (len == 0)
        {
	   mess1 += "Vous n'avez pas indiqué le code postal;\n";
        }
        else
        {
         if (!(fnum(lazone)))
         {     
            mess1 += "le code postal semble incorrect;\n" ;
         }
        }

        var lazone=ltrim(document.civ.adrville2.value);
        var len=lazone.length ;
        if (len == 0)
        {
	    mess1 += "Vous n'avez pas indiqué votre ville;\n";
        }

        var lazone=ltrim(document.civ.pays2.value);
        var len=lazone.length ;
        if (len == 0)
        {
	   mess1 += "Vous n'avez pas indiqué votre pays ;\n";
        }

        if (mess1 != "Dans votre adresse permanente, \n" )
        { message += "\n"+mess1+"\n" ; }

     }


     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}



function verif3()
{
 // contrôle de la saisie sur le 3eme onglet du formulaire d'inscription 
     var message = "";

     var lazone=ltrim(document.civ.etabscol.value);
     var len=lazone.length ;
     if ((len != 0) && (document.civ.acad.selectedIndex == 0) )
     {
          message += "Vous n'avez pas précisé votre académie ;\n";
     }
	if ((len == 0) && (document.civ.acad.selectedIndex != 0) )
     { 
	   message += "Vous n'avez pas indiqué l'établissement dans lequel vous êtes inscrit ;\n" ;
     }

	var lazon2=ltrim(document.civ.etabfra1.value);
	var len2=lazon2.length ;
	var lazon3=ltrim(document.civ.autrSitu.value);
	var len3=lazon3.length ;
	var situ=0 ;
	if (len != 0) situ = situ+1 ;
	if (len2 != 0)  situ = situ+1 ;
	if (len3 != 0)  situ = situ+1 ;
	if (situ > 1)
	{ 
	   message += "Vous ne devez saisir qu'un profil (étudiant/enseignant/autre situation) ;\n" ;
     }
         
     if (situ== 0) 
     {
          message += "Vous n'avez pas indiqué votre situation : enseignant, étudiant ou autre;\n" ;
     }

     if (document.civ.ins2.value == "O" )
     {

     	 var lazon3=ltrim(document.civ.etabfra2.value);
       var len3=lazon3.length ;
       if ((len3 == 0) && (len2 != 0))
       {
          message += "Vous n'avez pas indiqué le second établissement dans lequel vous êtes inscrit ;\n" ;
       }
	if ((len3 != 0) && (len2 == 0))
       {
          message += "Vous n'avez pas indiqué votre établissement ;\n" ;
       }

     }

     if (document.civ.mobilite[0].checked )
     {

       var lazone=ltrim(document.civ.etabet.value);
       var len=lazone.length ;
       if (len == 0)
       {
          message += "Vous n'avez pas indiqué l'établissement à l'étranger;\n" ;
       }

       if (document.civ.cadre.value == "Autre")
       {
           var lazone=ltrim(document.civ.autrecadre.value);
           var len=lazone.length ;
           if (len == 0)
           {
            message += "Vous n'avez pas indiqué le cadre de votre mobilité;\n" ;
           }
       }

   	// formulaire variable
  	if (document.civ.etabet) 
   	{   
	 if (document.civ.etabet.value == "Autres")
       {
           var lazone=ltrim(document.civ.autrepays.value);
           var len=lazone.length ;
           if (len == 0)
           {
            message += "Vous n'avez pas indiqué le pays de votre mobilité;\n" ;
           }
       }
   	}       

     }

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}

function verif4()
{
  
  // saisie facultative pour les non étudiants
  var lazone=ltrim(document.civ.etabfra1.value);
  var lenZ=lazone.length ;
  if (lenZ != 0) 
  {

	var message = "" ;
	maintenant = new Date(); an = maintenant.getYear() ; 

      var an1 = an - 1 ;
	var mess1 = "" + an1 + " - " + an + ":\n";
	
   	var lazone=ltrim(document.civ.etabl1.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'établissement ;\n" ;
      }

	var lazone=ltrim(document.civ.nivo1.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué le niveau ;\n" ;
      }

	var lazone=ltrim(document.civ.intitul1.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'intitulé ;\n" ;
      }

      if (mess1 != "" + an1 + " - " + an + ":\n")
      {
  	  message += mess1 + "\n" ;
	}

	var an2 = an - 2 ;
	var mess1 = "" + an2 + " - " + an1 + ":\n";
	
   	var lazone=ltrim(document.civ.etabl2.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'établissement ;\n" ;
      }

	var lazone=ltrim(document.civ.nivo2.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué le niveau;\n" ;
      }

	var lazone=ltrim(document.civ.intitul2.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'intitulé ;\n" ;
      }

      if (mess1 != "" + an2 + " - " + an1 + ":\n")
      {
  	  message += mess1 + "\n" ;
	}

	var an3 = an - 3 ;
	var mess1 = "" + an3 + " - " + an2 + ":\n";
	
   	var lazone=ltrim(document.civ.etabl3.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'établissement ;\n" ;
      }

	var lazone=ltrim(document.civ.nivo3.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué le niveau ;\n" ;
      }

	var lazone=ltrim(document.civ.intitul3.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'intitulé ;\n" ;
      }

      if (mess1 != "" + an3 + " - " + an2 + ":\n")
      {
  	  message += mess1 + "\n" ;
	}

	var an4 = an - 4 ;
	var mess1 = "" + an4 + " - " + an3 + ":\n";
	
   	var lazone=ltrim(document.civ.etabl4.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'établissement ;\n" ;
      }

	var lazone=ltrim(document.civ.nivo4.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué le niveau ;\n" ;
      }

	var lazone=ltrim(document.civ.intitul4.value);
      var len=lazone.length ;
      if (len == 0)
      {
         mess1 += "Vous n'avez pas indiqué l'intitulé ;\n" ;
      }

      if (mess1 != "" + an4 + " - " + an3 + ":\n")
      {
  	  message += mess1 + "\n" ;
	}

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }
  }
  else
  { return "ok" ; }

}

function verif5()
{
     var message = "";

	var lazone=ltrim(document.civ.dipl1.value);
      var len=lazone.length ;
      if (len == 0)
      {
         message += "Vous n'avez pas indiqué votre dernier diplôme ;\n" ;
      }

	var lazone=ltrim(document.civ.andipl1.value);
      var len=lazone.length ;
      if (len == 0)
      {
         message += "Vous n'avez pas indiqué l'année de votre dernier diplôme ;\n" ;
      }
	else
	{
	  if (!(fnum(lazone)))
        {     
            message += "l'année de votre dernier diplôme est incorrecte ;\n" ;
        }
	}

	var incomplet = 0 ;
	// 4 diplômes facultatifs

	var lazone1 =ltrim(document.civ.dipl2.value);
	var lazone2=ltrim(document.civ.andipl2.value);	 
	if ((lazone1 != "") || (lazone2 != ""))
	{
	  var len=lazone1.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }

	  var len=lazone2.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }
	  else
	  {
	    if (!(fnum(lazone2)))
          {     
            incomplet = 1 ;
          }
	  }
	}

	var lazone1 =ltrim(document.civ.dipl3.value);
	var lazone2=ltrim(document.civ.andipl3.value);	 
	if ((lazone1 != "") || (lazone2 != ""))
	{
	  var len=lazone1.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }

	  var len=lazone2.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }
	  else
	  {
	    if (!(fnum(lazone2)))
          {     
            incomplet = 1 ;
          }
	  }
	}

	var lazone1 =ltrim(document.civ.dipl4.value);
	var lazone2=ltrim(document.civ.andipl4.value);	 
	if ((lazone1 != "") || (lazone2 != ""))
	{
	  var len=lazone1.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }

	  var len=lazone2.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }
	  else
	  {
	    if (!(fnum(lazone2)))
          {     
            incomplet = 1 ;
          }
	  }
	}

	var lazone1 =ltrim(document.civ.dipl5.value);
	var lazone2=ltrim(document.civ.andipl5.value);	 
	if ((lazone1 != "") || (lazone2 != ""))
	{
	  var len=lazone1.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }

	  var len=lazone2.length ;
        if (len == 0)
        {
         incomplet = 1 ;
        }
	  else
	  {
	    if (!(fnum(lazone2)))
          {     
            incomplet = 1 ;
          }
	  }
	}

    	if (incomplet == 1)
	{
	  message += "\n seul votre dernier diplôme est obligatoire. \n";
	  message += "   Si vous devez en indiquer un précédent (4 possibles), veuillez saisir\n" ;
	  message += "   son intitulé et son année, puis préciser éventuellement la mention. \n\n" ;
	}

	// Baccalauréat
	
	var lazone=ltrim(document.civ.anbac.value);
      var len=lazone.length ;
      if (len == 0)
      {
         message += "Vous n'avez pas indiqué l'année d'obtention du Bac ;\n" ;
      }
	else
	{
	  if (!(fnum(lazone)))
        {     
            message += "l'année d'obtention du Bac est incorrecte ;\n" ;
        }
	}

	var lazone=ltrim(document.civ.sectionbac.value);
      var len=lazone.length ;
      if (len == 0)
      {
         message += "Vous n'avez pas indiqué la section du Bac ;\n" ;
      }
	
     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}

function verif6()
{
     var message = "";

	if (document.civ.CLevel.selectedIndex == 0)
	{ 
	  message += " veuillez préciser votre niveau de compréhension à l'oral ; \n" ;
	}

	if (document.civ.RLevel.selectedIndex == 0)
	{ 
	  message += " veuillez préciser votre niveau de compréhension en lecture; \n" ;
	}

	if (document.civ.IOLevel.selectedIndex == 0)
	{ 
	  message += " veuillez préciser votre faculté à prendre part à une conversation  ; \n" ;
	}

	if (document.civ.POLevel.selectedIndex == 0)
	{ 
	  message += " veuillez préciser votre faculté à vous exprimer oralement en continu ; \n" ;
	}

	if (document.civ.RLevel.selectedIndex == 0)
	{ 
	  message += " veuillez préciser votre niveau à l'écrit ; \n" ;
	}

	if (document.civ.attestNiv[0].checked)
	{ 
	  if (document.civ.intattest.value == "")
	  { 
	  message += " veuillez préciser l'intitulé de votre attestation ; \n" ;
	  }

	var lazone=ltrim(document.civ.instattest.value);
      
	  if (lazone == "")
	  { 
	  message += " veuillez préciser l'institution qui a délivré votre attestation ; \n" ;
	  }

	var lazone=ltrim(document.civ.anattest.value);
      
	  if (lazone == "")
	  { 
	  message += " veuillez préciser l'année de délivrance de votre attestation ; \n" ;
	  }
	  else
	  {
	    if (!(fnum(lazone)))
          {     
            message += "l'année de délivrance de votre attestation est incorrecte ;\n" ;
          }
	  }

	}

	if (document.civ.typsej1.selectedIndex == 0)
	{ 
	  message += " veuillez préciser le type de votre dernier séjour ; \n" ;
	}

	if (document.civ.dursej1.selectedIndex == 0 )
	{ 
	  message += " veuillez préciser la durée de votre dernier séjour ; \n" ;
	}
	var lazone=ltrim(document.civ.ma1s1.value);
	if ((lazone == "") || (lazone == "MM/AAAA"))
	{ 
	  message += "veuillez indiquer la période de votre dernier séjour (format MM/AAAA) ; \n" ;
	}
	else
	{
	  temp1=lazone.substring(0,2); 
	  temp2=lazone.substring(2,3);
	  temp3=lazone.substring(3); 
	  if ( !(fnum(temp1)) || (temp2 != "/") || !(fnum(temp3))  )
        { message += "veuillez respecter le format MM/AAAA pour le début de période; \n " ; }
	}

	var lazone=ltrim(document.civ.ma2s1.value);
	if ((lazone == "") || (lazone == "MM/AAAA"))
	{ 
	  message += "veuillez indiquer la période de votre dernier séjour (format MM/AAAA) ; \n" ;
	}
	else
	{
	   temp1=lazone.substring(0,2);
	  temp2=lazone.substring(2,3);
	  temp3=lazone.substring(3);
	  if ( !(fnum(temp1)) || (temp2 != "/") || !(fnum(temp3))  )
        { message += "veuillez respecter le format pour le début de période; \n " ; }
	}

	var lazone=ltrim(document.civ.lieusej1.value);
	if (lazone == "")
	{ 
	  message += "veuillez indiquer le lieu de votre dernier séjour ; \n" ;
	}

	// Seul un séjour est obligatoire. 
     
   if (document.civ.lang1)   // Si parametre multilangue non choisie on n'a pas l'info
   {
	var lazon1=ltrim(document.civ.lang1.value);
	var lazon2=ltrim(document.civ.nivLang1.value);
	if ( ((lazon1 != "") && (lazon2 == "")) || ((lazon1 == "") && (lazon2 != "")) )
	{ 
	  message += "Veuillez saisir la langue ET votre niveau ou ne rien saisir; \n" ;
      }

	var lazon1=ltrim(document.civ.lang2.value);
	var lazon2=ltrim(document.civ.nivLang2.value);
	if ( ((lazon1 != "") && (lazon2 == "")) || ((lazon1 == "") && (lazon2 != "")) )
	{ 
	  message += "Veuillez saisir la langue ET votre niveau ou ne rien saisir; \n" ;
      }

	var lazon1=ltrim(document.civ.lang3.value);
	var lazon2=ltrim(document.civ.nivLang3.value);
	if ( ((lazon1 != "") && (lazon2 == "")) || ((lazon1 == "") && (lazon2 != "")) )
	{ 
	  message += "Veuillez saisir la langue ET votre niveau ou ne rien saisir; \n" ;
      }
   }

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}

function verif7()
{
     var message = "";

	if (ltrim(document.civ.domint.value) == "")
	{
	     message += "Indiquez vos domaines d'intérêt; \n";
	}

	// formulaire variable 
	if (document.civ.motcl1) 
	{
	nombre = 0 ;
	nombre += (ltrim(document.civ.motcl1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.motcl2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.motcl3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.motcl4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.motcl5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.motcl6.value) == "" ? 0 : 1) ;
	
	if (nombre == 0) 
	{ message += "Veuillez donner au moins 1 mot clé caractérisant vos domaines d'intérêt; \n" ; }

	}

	if ( (document.civ.asso1.value == "") && ( (document.civ.activ1A.value != "") || (document.civ.activ1B.value != "") ) )
	{ message += "Vous avez omis de préciser l'association 1; \n" ; }

	if ( (document.civ.asso2.value == "") && ( (document.civ.activ2A.value != "") || (document.civ.activ2B.value != "") ) )
	{ message += "Vous avez omis de préciser l'association 2; \n" ; }

	if ( (document.civ.asso3.value == "") && ( (document.civ.activ3A.value != "") || (document.civ.activ3B.value != "") ) )
	{ message += "Vous avez omis de préciser l'association 3; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob1.value) == "" ? 0 : 1) ;
	nombre += (document.civ.durJob1.selectedIndex == 0 ? 0 : 1) ;
	nombre += (document.civ.modJob1.selectedIndex == 0 ? 0 : 1) ;
	nombre += (ltrim(document.civ.debJob1.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob1.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 1; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob2.value) == "" ? 0 : 1) ;
	if (document.civ.durJob2.selectedIndex) 
	{ nombre += (document.civ.durJob2.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob2.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob2.selectedIndex) 
	{ nombre += (document.civ.modJob2.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob2.value) == "" ? 0 : 1) ; }
	nombre += (ltrim(document.civ.debJob2.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob2.value) == "JJ/MM/AAAA" ? 0 : 1) ;

	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 2; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob3.value) == "" ? 0 : 1) ;
	if (document.civ.durJob3.selectedIndex) 
	{ nombre += (document.civ.durJob3.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob3.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob3.selectedIndex) 
	{ nombre += (document.civ.modJob3.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob3.value) == "" ? 0 : 1) ; }

	nombre += (ltrim(document.civ.debJob3.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob3.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 3; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob4.value) == "" ? 0 : 1) ;
	if (document.civ.durJob4.selectedIndex) 
	{ nombre += (document.civ.durJob4.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob4.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob4.selectedIndex) 
	{ nombre += (document.civ.modJob4.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob4.value) == "" ? 0 : 1) ; }

	nombre += (ltrim(document.civ.debJob4.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob4.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 4; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob5.value) == "" ? 0 : 1) ;
	if (document.civ.durJob5.selectedIndex) 
	{ nombre += (document.civ.durJob5.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob5.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob5.selectedIndex) 
	{ nombre += (document.civ.modJob5.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob5.value) == "" ? 0 : 1) ; }

	nombre += (ltrim(document.civ.debJob5.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob5.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 5; \n" ; }
	
	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob6.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob6.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob6.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob6.value) == "" ? 0 : 1) ;
	if (document.civ.durJob6.selectedIndex) 
	{ nombre += (document.civ.durJob6.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob6.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob6.selectedIndex) 
	{ nombre += (document.civ.modJob6.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob6.value) == "" ? 0 : 1) ; }

	nombre += (ltrim(document.civ.debJob6.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob6.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 6; \n" ; }

	nombre = 0 ;
	nombre += (ltrim(document.civ.typJob7.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.sctJob7.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.vilJob7.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.payJob7.value) == "" ? 0 : 1) ;
	if (document.civ.durJob7.selectedIndex) 
	{ nombre += (document.civ.durJob7.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.durJob7.value) == "" ? 0 : 1) ; }
	if (document.civ.modJob7.selectedIndex) 
	{ nombre += (document.civ.modJob7.selectedIndex == 0 ? 0 : 1) ; }
	else
	{ nombre += (ltrim(document.civ.modJob7.value) == "" ? 0 : 1) ; }

	nombre += (ltrim(document.civ.debJob7.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	nombre += (ltrim(document.civ.finJob7.value) == "JJ/MM/AAAA" ? 0 : 1) ;
	if ( (nombre != 0) && (nombre != 8) )
	{ message += "Veuillez renseigner l'ensemble des informations relatives à votre activité rémunérée 7; \n" ; }

	// formulaire variable
	if ((document.civ.autrecand) && (document.civ.autrecand[0].checked))
	{
	  if (ltrim(document.civ.detailcand.value) == "")
	  {
	     message += "Précisez le programme et l'organisme de bourses; \n";
	  }
	}

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}

function verif8()
{
     var message = "";

	if (ltrim(document.civ.proj1Fra.value) == "")
	{
	     message += "Indiquez en français votre projet pour les 2 ou 3 années à venir; \n";
	}

	if (ltrim(document.civ.proj1All.value) == "")
	{
	     message += "Indiquez en allemand votre projet pour les 2 ou 3 années à venir; \n";
	}
	
	if (ltrim(document.civ.proj2Fra.value) == "")
	{
	     message += "Indiquez en français votre projet à moyen et long termes; \n";
	}

	if (ltrim(document.civ.proj2All.value) == "")
	{
	     message += "Indiquez en allemand votre projet à moyen et long termes; \n";
	}

	// formulaire variable
	if (document.civ.MCproj1)
	{
	nombre = 0 ;
	nombre += (ltrim(document.civ.MCproj1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCproj2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCproj3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCproj4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCproj5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCproj6.value) == "" ? 0 : 1) ;
	if (nombre == 0) 
	{ message += "Veuillez donner au moins 1 mot clé caractérisant vos projets d'avenir; \n" ; }
	}

	if (ltrim(document.civ.motivFra.value) == "")
	{
	     message += "Indiquez en français vos motivations; \n";
	}

	// formulaire variable
	if (document.civ.MCmotF1)
	{
	nombre = 0 ;
	nombre += (ltrim(document.civ.MCmotF1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF6.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF7.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotF8.value) == "" ? 0 : 1) ;
	if (nombre == 0) 
	{ message += "Veuillez donner au moins 1 mot clé français caractérisant vos motivations; \n" ; }
	}

	if (ltrim(document.civ.motivAll.value) == "")
	{
	     message += "Indiquez en français vos motivations; \n";
	}

	// formulaire variable
	if (document.civ.MCmotA1)
	{
	nombre = 0 ;
	nombre += (ltrim(document.civ.MCmotA1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA3.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA4.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA5.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA6.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA7.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.MCmotA8.value) == "" ? 0 : 1) ;
	if (nombre == 0) 
	{ message += "Veuillez donner au moins 1 mot clé étranger caractérisant vos motivations; \n" ; }
	}

     if ( message != "" ) 
     { return message ; }
     else
     { return "ok" ; }

}

function verif9()
{
     var message = "";
	nombre = 0 ;
	
	nombre += (ltrim(document.civ.nom1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.fon1.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.inst1.value) == "" ? 0 : 1) ;
	
	nombre += (ltrim(document.civ.nom2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.fon2.value) == "" ? 0 : 1) ;
	nombre += (ltrim(document.civ.inst2.value) == "" ? 0 : 1) ;

	if ( (nombre != 0) && (nombre != 3) && (nombre != 6) )
	{ return ("Veuillez donner le nom, la fonction et l'institution de chaque personne sollicitée; \n") ; }

	// formulaire variable
	nombre = 0 ;
	if (document.civ.certif1) nombre += 1;
	if (document.civ.certif2) nombre += 1;
	if (document.civ.certif3) nombre += 1;

	if ((nombre == 1) && (!document.civ.certif1.checked))
	{ return ("vous devez biffer l'affirmation afin de pouvoir valider votre inscription") ; }
	if ((nombre == 2) && (document.civ.certif1.checked) && (document.civ.certif2.checked))
	{
	  return "ok" ; 
      }
      else
      {
 	  return ("vous devez biffer chacune des 2 affirmations afin de pouvoir valider votre inscription") ;
 	}
     if ((nombre == 3) && (document.civ.certif1.checked) && (document.civ.certif2.checked) && (document.civ.certif3.checked) )
     {
	return "ok" ; 
     }
     else
     {
	return ("vous devez biffer chacune des 3 affirmations afin de pouvoir valider votre inscription") ;
     }

}

function validation() 
{ 
     if (ltrim(document.form.login.value == "") )
     { 
        alert ('veuillez entrer votre Login'); 
        document.form.login.focus();
        return false; 
    	}
		
	if (ltrim(document.form.mdp.value == "")) 
	{ 
        alert ('veuillez entrer votre Mot de passe'); 
        document.form.mdp.focus(); 
        return false; 
    	}
  document.getElementById('wait2').style.visibility = 'visible';  
  return true;
}


// Fonction permettant de supprimer les espaces en debut d'une chaîne

function ltrim(chaine)
{
  if ((chaine) && (chaine.length>0) && (chaine!=null))
  {
    while (chaine.substring(0,1)==" ")
      chaine = chaine.substring(1,chaine.length)

    return(chaine)
  }

  return(chaine)
}

//***********************************************
//controle de numericite
function fnum(zone)
{
var ref="0123456789-";
chaine=zone+""
for(i=0;i<chaine.length;i++)
	{
	temp=chaine.substring(i,i+1);
	if (ref.indexOf(temp)== -1)
		return (false)
	}
return (true)
}



//**********************************************************************
// Teste si les caractères "@" et "." sont présents dans une adresse mél

function TestMel(Mel)
{
  melok = true;
  if (Mel != "")
  {
    position = Mel.indexOf("@");
    if (position != -1)
    {
       position1 = (Mel.indexOf(".",position) != -1);
       if (position1 != -1)
         melok = true;
       else
         melok = false;
    }
    else
    {
      melok = false;
    }
  }
  else
    melok = false;

  return(melok);
}

function check() 
{
	// si onglet "Voeux"

	if (document.civ.toutper)
	{	
		if ((document.civ.per1.checked == true) && (document.civ.per2.checked == true) && (document.civ.per3.checked == true) && (document.civ.per4.checked == true) && (document.civ.per5.checked == true) && (document.civ.per6.checked == true) )
		{ document.civ.toutper.checked = true ; }
		else
		{ document.civ.toutper.checked = false ; }

	}
}

function checkTout() 
{
	// si onglet "Voeux"

	if (document.civ.toutper)
	{
		if (document.civ.toutper.checked == true)
		{
		 	document.civ.per1.checked = true ;
			document.civ.per2.checked = true ;
			document.civ.per3.checked = true ;
			document.civ.per4.checked = true ;
			document.civ.per5.checked = true ;
			document.civ.per6.checked = true ;
		}
	}
}

