function monthToNum(mois)
{
	if (mois == "Janvier")  return 1;
	if (mois == "Février")  return 2;
	if (mois == "Mars")  return 3;
	if (mois == "Avril")  return 4;
	if (mois == "Mai")  return 5;
	if (mois == "Juin")  return 6;
	if (mois == "Juillet")  return 7;
	if (mois == "Août")  return 8;
	if (mois == "Septembre")  return 9;	
	if (mois == "Octobre")  return 10;
	if (mois == "Novembre")  return 11;
	if (mois == "Décembre")  return 12;
    if (mois == "")  return ""; 
} 

function numToMonth(num)
{
	if (num == 1)  return "Janvier";
	if (num == 2)  return "Février";
	if (num == 3)  return "Mars";
	if (num == 4)  return "Avril";
	if (num == 5)  return "Mai";
	if (num == 6)  return "Juin";
	if (num == 7)  return"Juillet" ;
	if (num == 8)  return "Août";
	if (num == 9)  return"Septembre" ;	
	if (num == 10)  return "Octobre";
	if (num == 11)  return "Novembre";
	if (num == 12)  return "Décembre";
    if (num == "")  return "";
} 

function eMailValid(obj){
   var o,errors='';
   o=obj.value;
   if (o.length!=0) {
     if ((o.indexOf('@')<1) || (o.indexOf('@')==o.length-1)){
	   errors+='- l\'e-mail doit etre sous la forme: userName@domaine.\n';
	 }
	 if ((o.indexOf('.')<3) || (o.indexOf('.')==o.length-1)){
	   errors+='- l\'e-mail paraît invalide.\n';
	 }
   }
   if (errors) alert('Erreur(s) :\n'+errors);
}

function fieldsNotNull(form, friend){
   var f,o,errors='';
   f=form.nom;
   o=f.value;
   if (o=='') {
	   errors+='- Vous avez oublié l\'ecriture de votre nom.\n';
   }
   f=form.email;
   o=f.value;
   if (o!='') {
        if ((o.indexOf('@')<1) || (o.indexOf('@')==o.length-1)){
	       errors+='- votre e-mail doit etre sous la forme: userName@domaine.\n';
	    }
	    if ((o.indexOf('.')<3) || (o.indexOf('.')==o.length-1)){
	       errors+='- votre e-mail paraît invalide.\n';
	    }
   }
   else errors+='- Vous avez oublié l\'ecriture de votre e-mail.\n';
   
   if (friend=='o') {
    f=form.friendemail;
    o=f.value;
    if (o!='') {
        if ((o.indexOf('@')<1) || (o.indexOf('@')==o.length-1)){
	       errors+='- l\'e-mail de votre collègue doit etre sous la forme: userName@domaine.\n';
	    }
	    if ((o.indexOf('.')<3) || (o.indexOf('.')==o.length-1)){
	       errors+='- l\'e-mail de votre collègue paraît invalide.\n';
	    }
   }
   else errors+='- Vous avez oublié l\'ecriture d\'e-mail de votre collègue.\n';
  } 
  if (errors) {
      alert('Erreur(s) :\n'+errors);
	  return false;
   }
   return true;
}

function messageFieldsNotNull(form){
   var f,o,errors='';
   f=form.nom;
   o=f.value;
   if (o=='') {
	   errors+='- Vous avez oublié l\'ecriture de votre nom.\n';
   }
   f=form.email;
   o=f.value;
   if (o!='') {
        if ((o.indexOf('@')<1) || (o.indexOf('@')==o.length-1)){
	       errors+='- votre e-mail doit etre sous la forme: userName@domaine.\n';
	    }
	    if ((o.indexOf('.')<3) || (o.indexOf('.')==o.length-1)){
	       errors+='- votre e-mail paraît invalide.\n';
	    }
   }
   else errors+='- Vous avez oublié l\'ecriture de votre e-mail.\n';
   
   f=form.sujet;
   o=f.value;
   if (o=='') {
   		errors+='- Vous avez oublié l\'ecriture de sujet.\n';
   }
   
   f=form.message;
   o=f.value;
   if (o=='') {
   		errors+='- Vous avez oublié l\'ecriture de message.\n';
   }
   
   if (errors) {
      alert('Erreur(s) :\n'+errors);
	  return false;
   }
   return true;
}

function comptFieldsNotNull(name, pass){
   var on,op,errors='';
   on=name.value;
   op=pass.value;
   if (on=='') {
	   errors+='- Vous avez oublié l\'ecriture de votre nom.\n';
   }
   if (op=='') {
	   errors+='- Vous avez oublié l\'ecriture de votre mot de passe.\n';
   }
   
  if (errors) {
      alert('Erreur(s) :\n'+errors);
	  return false;
   }
   return true;
}

function sumCos(periode)
{
	var sum = 0;
	for(var j = 0; j <= 9; j++)
	{
		sum += Math.cos((10 * periode + j) * Math.PI / 180);
	}
	return Math.round(sum);
}