	function vai(mese,giorno) {
	var x=eval("top.mainFrame.document.frm_news."+mese+".value");
	var y=eval("top.mainFrame.document.frm_news."+giorno);
	
	if (x == 4 || x == 6 || x == 9 || x == 11) {
		var nLenght = 30; 
		} else {
		if (x == 2) {
			var nLenght = 28;
			} else { 
			var nLenght = 31;
			}		
		}

	
	var lungmese = y.length;
	
	// svuoto la lista dei giorni
	for (var i=lungmese; i > 0; i--) 
		y.options[0] = null;

	// riempio la lista dei giorni
	var giorno = new Option("Jour");
	y.options[0] = giorno;	
	for (var i=1; i <= nLenght; i++) {
	giorno = new Option(i);
	y.options[i] = giorno;
	}
		
	}



function controllo(frm)
{
  /////////////////form nella gestione delle news//////////////////////
		   if (frm == 'frm_news')
		   {
			   /*  if (window.document.frm_news.frm_sessione.value=='')
				 {
				   alert("Session d'affaires Obligatoire de Champ")
				   window.document.frm_news.frm_sessione.focus();
				   return false;
				 }
			   */
				if (window.document.frm_news.frm_evento.value=='0')
				{
				   alert('Tipologie obligatoire')
				   window.document.frm_news.frm_evento.focus();
				   return false;
				}
			
			     if (window.document.frm_news.frm_text_news.value=='')
				 {
				   alert("Le titre est obligatoire!")
				   window.document.frm_news.frm_text_news.focus();
				   return false;
				 }
			     if (window.document.frm_news.frm_text_detail.value=='')
				 {
				   alert("La description est obligatoire")
				   window.document.frm_news.frm_text_detail.focus();
				   return false;
				 }
 			}

  /////////////////form nella gestione delle voci del menu//////////////////////
		   if (frm == 'frm_menu')
		   {
			     if (window.document.frm_menu.frm_elem_menu.value=='')
				 {
				   alert("Element est obligatoire")
				   window.document.frm_menu.frm_elem_menu.focus();
				   return false;
				 }
			     if (window.document.frm_menu.frm_lien.value=='')
				 {
				   alert("Le Lien est obligatoire ")
				   window.document.frm_menu.frm_lien.focus();
				   return false;
				 }
			     if (window.document.frm_menu.frm_text_menu.value=='')
				 {
				   alert("Description est obligatoire ")
				   window.document.frm_menu.frm_text_menu.focus();
				   return false;
				 }
		   }
   
  /////////////////form nella gestione dei lien//////////////////////
		   if (frm == 'frm_lien')
		   {
			     if (window.document.frm_lien.frm_titre.value=='')
				 {
				   alert("Le Titre est Obligatoire ")
				   window.document.frm_lien.frm_titre.focus();
				   return false;
				 }
			     if (window.document.frm_lien.frm_lien.value=='')
				 {
				   alert("Le Lien est obligatoire ")
				   window.document.frm_lien.frm_lien.focus();
				   return false;
				 }
			     if (window.document.frm_lien.frm_description.value=='')
				 {
				   alert("La Description est obligatoire ")
				   window.document.frm_lien.frm_description.focus();
				   return false;
				 }
		
					var appoggio, i,j,appoggio1
					appoggio=0;
					appoggio1=0;
					for(i=2;i<10;i++)
					{
						if(window.document.frm_lien.elements[i].type=='checkbox')
						{	
							if (window.document.frm_lien.elements[i].checked==true)
							{appoggio= appoggio + 1	}	
						}
						
					}
					switch (appoggio)
					{
						case 0:
							alert("Au moins une composante doit etre choisi!");
							return false;
							break
					}
			 }
	 


  ///////////////////// form nella sessione groupes discussion per la registrazione //////////
		   if (frm == 'frm_reg')
		   {
			     if (window.document.frm_reg.frm_nom.value=='')
				 {
				   alert("Nom obligatoire")
				   window.document.frm_reg.frm_nom.focus();
				   return false;
				 }
		
			     if (window.document.frm_reg.frm_pays.value=='')
				 {
				   alert("Pays obligatoire")
				   window.document.frm_reg.frm_pays.focus();
				   return false;
				 }
			     if (window.document.frm_reg.frm_institution.value=='')
				 {
				   alert('Institution obligatoire')
				   window.document.frm_reg.frm_institution.focus();
				   return false;
				 }
			     if (window.document.frm_reg.frm_fonction.value=='')
				 {
				   alert("Fonction  obligatoire")
				   window.document.frm_reg.frm_fonction.focus();
				   return false;
				 }
			     if (window.document.frm_reg.frm_email.value=='')
				 {
				   alert("Email obligatoire")
				   window.document.frm_reg.frm_email.focus();
				   return false;
				 }
			     if (window.document.frm_reg.frm_username.value=='')
				 {
				   alert("Nom pour l'acces obligatoire")
				   window.document.frm_reg.frm_username.focus();
				   return false;
				 }
			     if (window.document.frm_reg.frm_password.value=='')
				 {
				   alert('Mot de passe obligatoire')
				   window.document.frm_reg.frm_password.focus();
				   return false;
				 }
				 if (document.frm_reg.frm_password.value != document.frm_reg.frm_password2.value)
				 {
					alert("Les deux mots de passe ne sont pas egaux!");
					document.frm_reg.frm_password.select();
					document.frm_reg.frm_password.focus();
					return false;
				 }
			 
	
				var appoggio, i,j,appoggio1
				appoggio=0;
				appoggio1=0;
				for(i=8;i<17;i++)
				{
					if(window.document.frm_reg.elements[i].type=='checkbox')
					{	
						if (window.document.frm_reg.elements[i].checked==true)
						{appoggio= appoggio + 1	}	
					}
					
				}
				switch (appoggio)
				{
					case 0:
						alert("Au moins une composante doit etre choisi!");
						return false;
						break
				}
				for(j=17;j<22;j++)
				{
					if(window.document.frm_reg.elements[j].type=='checkbox')
					{	
						if (window.document.frm_reg.elements[j].checked==true)
						{appoggio1= appoggio1 + 1	}	
					}
				}
				
				switch (appoggio1)
				{
					case 0:
						alert("Au moins un domaine doit etre choisi!");
						return false;
						break
				}
	      }


  ////////////////////////////////////////////////////////////////////////////
              //form per entrare nella gestione //
             // form per entrare nella sessione groupes discussion per l'invio delle email//
  ///////////////////////////////////////////////////////////////////////////
		   if (frm == 'frm_login')
		   {
			     if (window.document.frm_login.frm_username.value=='')
				 {
				   alert("Nom pour l'acces est obligatoire")
				   window.document.frm_login.frm_username.focus();
				   return false;
				 }
			     if (window.document.frm_login.frm_password.value=='')
				 {
				   alert("Mot de passe est obligatoire")
				   window.document.frm_login.frm_password.focus();
				   return false;
				 }
		    }
			if (frm == 'frm_email')
			{
				     if (window.document.frm_email.oggetto.value=='')
					 {
					   alert("Objet Obligatoire ")
					   window.document.frm_email.oggetto.focus();
					   return false;
					 }
				     if (window.document.frm_email.frm_composante.value=='')
					 {
					   alert("Composante Obligatoire ")
					   window.document.frm_email.frm_composante.focus();
					   return false;
					 }
				     if (window.document.frm_email.frm_domaine.value=='')
					 {
					   alert("Domaine Obligatoire ")
					   window.document.frm_email.frm_domaine.focus();
					   return false;
					 }
				     if (window.document.frm_email.testo.value=='')
					 {
					   alert("Texte Obligatoire ")
					   window.document.frm_email.testo.focus();
					   return false;
					 }
			}
	  
	  
///// form per gli allegati/////////////////////	  
		    if (frm == 'frm_allega')
		    {
			         if (window.document.frm_allega.cfile.value=='')
				     {
					   alert("Document Obligatoire ");
					   window.document.frm_allega.cfile.focus();
					   return false;
					 }
		    }
		  

	
	
	
///////////////////////////////////////gestione sisinas////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

		   if (frm == 'frm_grouciple')
		   {
			     if (window.document.frm_grouciple.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_grouciple.frm_libelle.focus();
				   return false;
				 }
			     if (window.document.frm_grouciple.frm_nordre.value=='')
				 {
				   alert("Nordre est obligatoire")
				   window.document.frm_grouciple.frm_nordre.focus();
				   return false;
				 }
		   }

		   if (frm == 'frm_composante')
		   {
			     if (window.document.frm_composante.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_composante.frm_libelle.focus();
				   return false;
				 }
			     if (window.document.frm_composante.frm_description.value=='')
				 {
				   alert("Description est obligatoire")
				   window.document.frm_composante.frm_description.focus();
				   return false;
				 }
			     if (window.document.frm_composante.frm_objectif.value=='')
				 {
				   alert("Objectif est obligatoire")
				   window.document.frm_composante.frm_objectif.focus();
				   return false;
				 }
		   }

		   if (frm == 'frm_secteur')
		   {
			     if (window.document.frm_secteur.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_secteur.frm_libelle.focus();
				   return false;
				 }
		   }

		   if (frm == 'frm_domaine')
		   {
			     if (window.document.frm_domaine.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_domaine.frm_libelle.focus();
				   return false;
				 }
		   }

		   if (frm == 'frm_statut')
		   {
			     if (window.document.frm_statut.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_statut.frm_libelle.focus();
				   return false;
				 }
		   }

		   if (frm == 'frm_institution')
		   {
			     if (window.document.frm_institution.frm_nom.value=='')
				 {
				   alert("Nom est obligatoire")
				   window.document.frm_institution.frm_nom.focus();
				   return false;
				 }
		
			     if (window.document.frm_institution.frm_statut.value=='0')
				 {
				   alert("Statut est obligatoire")
				   window.document.frm_institution.frm_statut.focus();
				   return false;
				 }
			     if (window.document.frm_institution.frm_zone.value=='')
				 {
				   alert("Zone est obligatoire")
				   window.document.frm_institution.frm_zone.focus();
				   return false;
				 }
			     if (window.document.frm_institution.frm_adresse.value=='')
				 {
				   alert("Adresse est obligatoire")
				   window.document.frm_institution.frm_adresse.focus();
				   return false;
				 }
			     if (window.document.frm_institution.frm_tel1.value=='')
				 {
				   alert("Phone est obligatoire")
				   window.document.frm_institution.frm_tel1.focus();
				   return false;
				 }
			     if (window.document.frm_institution.frm_tel2.value=='')
				 {
				   alert("Fax est obligatoire")
				   window.document.frm_institution.frm_tel2.focus();
				   return false;
				 }
		
			     if (window.document.frm_institution.frm_contacte.value=='')
				 {
				   alert("Contacte est obligatoire")
				   window.document.frm_institution.frm_contacte.focus();
				   return false;
				 }
			     if (window.document.frm_institution.frm_email.value=='')
				 {
				   alert("Email est obligatoire")
				   window.document.frm_institution.frm_email.focus();
				   return false;
				 }
		   }



		   if (frm == 'frm_statistique')
		   {
			     if (window.document.frm_statistique.frm_indicateur.value=='0')
				 {
				   alert("Indicateur est obligatoire")
				   window.document.frm_statistique.frm_indicateur.focus();
				   return false;
				 }

			     if (window.document.frm_statistique.frm_indicateur.value=='0')
				 {
				   alert("Indicateur est obligatoire")
				   window.document.frm_statistique.frm_indicateur.focus();
				   return false;
				 }

			     if (window.document.frm_statistique.frm_groupcible.value=='0')
				 {
				   alert("Groupe cible est obligatoire")
				   window.document.frm_statistique.frm_groupcible.focus();
				   return false;
				 }
			     if (window.document.frm_statistique.frm_represent.value=='0' ||window.document.frm_statistique.frm_represent.value=='')
				 {
				   alert("Niveau de Representativite est obligatoire")
				   window.document.frm_statistique.frm_represent.focus();
				   return false;
				 }

			     if (window.document.frm_statistique.frm_echantillon.value=='')
				 {
				   alert("Echantillon est obligatoire")
				   window.document.frm_statistique.frm_echantillon.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_statistique.frm_echantillon.value))
				     {
					   alert("Seulement nombre pour le champ Echantillon")
					   window.document.frm_statistique.frm_echantillon.focus();
					   return false;
					 }
					 else
					 {
						if (window.document.frm_statistique.frm_echantillon.value.indexOf('.')!=-1)			
						{
						     alert ('Seulement nombre pour le champ Echantillon');
						     window.document.frm_statistique.frm_echantillon.focus();
							 return false;
						}	    
					 }
				 }
				 
			     if (window.document.frm_statistique.frm_prevalence.value=='')
				 {
				   alert("Prevalence est obligatoire")
				   window.document.frm_statistique.frm_prevalence.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_statistique.frm_prevalence.value))
				     {
					   alert("Seulement nombre pour le champ Prevalence")
					   window.document.frm_statistique.frm_prevalence.focus();
					   return false;
					 }
				 }
			
			     if (window.document.frm_statistique.frm_anno.value=='')
				 {
				   alert("Annee est obligatoire!")
				   window.document.frm_statistique.frm_anno.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_statistique.frm_anno.value))
				     {
					   alert("Seulement nombre pour le champ Annee")
					   window.document.frm_statistique.frm_anno.focus();
					   return false;
					 }
					 else
					 {
						if (window.document.frm_statistique.frm_anno.value.indexOf('.')!=-1)			
						{
						     alert ('Seulement nombre pour le champ Annee');
						     window.document.frm_statistique.frm_anno.focus();
							 return false;
						}	    
					 }
				 }
		   }
		   
		   
		   if (frm == 'frm_indicatuer')
		   {
			     if (window.document.frm_indicatuer.frm_libelle.value=='')
				 {
				   alert("Libelle est obligatoire")
				   window.document.frm_indicatuer.frm_libelle.focus();
				   return false;
				 }
		
			     if (window.document.frm_indicatuer.frm_libelle_saisie.value=='')
				 {
				   alert("Libelle Saisie est obligatoire")
				   window.document.frm_indicatuer.frm_libelle_saisie.focus();
				   return false;
				 }
			     if (window.document.frm_indicatuer.frm_groupcib.value=='')
				 {
				   alert("Groupcible est obligatoire")
				   window.document.frm_indicatuer.frm_groupcib.focus();
				   return false;
				 }
			     if (window.document.frm_indicatuer.frm_composante.value=='')
				 {
				   alert("Composante est obligatoire")
				   window.document.frm_indicatuer.frm_composante.focus();
				   return false;
				 }
			     if (window.document.frm_indicatuer.frm_definition.value=='')
				 {
				   alert("Definition est obligatoire")
				   window.document.frm_indicatuer.frm_definition.focus();
				   return false;
				 }
			     if (window.document.frm_indicatuer.frm_cibleref.value=='')
				 {
				   alert("Cibleref est obligatoire")
				   window.document.frm_indicatuer.frm_cibleref.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_indicatuer.frm_cibleref.value))
				     {
					   alert("Seulement nombre pour le champ de cibleref")
					   window.document.frm_indicatuer.frm_cibleref.focus();
					   return false;
					 }
					 else
					 {
						if (window.document.frm_indicatuer.frm_cibleref.value.indexOf('.')!=-1)			
						{
						     alert ('Seulement nombre pour le champ de cibleref');
						     window.document.frm_indicatuer.frm_cibleref.focus();
							 return false;
						}	    
					 }
			     }
				 
		
			     if (window.document.frm_indicatuer.frm_critere_inf.value=='')
				 {
				   alert("Critere inf. est obligatoire")
				   window.document.frm_indicatuer.frm_critere_inf.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_indicatuer.frm_critere_inf.value))
				     {
					   alert("Seulement nombre pour le champ de cibleref Inf.")
					   window.document.frm_indicatuer.frm_critere_inf.focus();
					   return false;
					 }
					 else
					 {
						if (window.document.frm_indicatuer.frm_critere_inf.value.indexOf('.')!=-1)			
						{
						     alert ('Seulement nombre pour le champ de cibleref Inf.');
						     window.document.frm_indicatuer.frm_critere_inf.focus();
							 return false;
						}	    
					 }
			     }
				 
			     if (window.document.frm_indicatuer.frm_critere_sup.value=='')
				 {
				   alert("Critere sup. est obligatoire")
				   window.document.frm_indicatuer.frm_critere_sup.focus();
				   return false;
				 }
				 else
				 {
				     if (isNaN(window.document.frm_indicatuer.frm_critere_sup.value))
				     {
					   alert("Seulement nombre pour le champ de cibleref Sup.")
					   window.document.frm_indicatuer.frm_critere_sup.focus();
					   return false;
					 }
					 else
					 {
						if (window.document.frm_indicatuer.frm_critere_sup.value.indexOf('.')!=-1)			
						{
						     alert ('Seulement nombre pour le champ de cibleref Sup.');
						     window.document.frm_indicatuer.frm_critere_sup.focus();
							 return false;
						}	    
					 }
			     }
				 
		   }
 }		   

//////////////////////////////////////////////////////////////////////////////////////	

 ////////funzione per il controllo email///////
function mail(ind)
{
  var p=String(ind);
  if (ind!='')
	{
		if(p.indexOf('@')==-1)
 	    {
			alert("Il n' y a pas l'@ dans l'adresse!");
			return false;
		}
   		if(p.indexOf('@')== 0)
		{
			alert('Il n\'y a pas de nom devant l\'@!');					                                      
			return false;
		}
		var a=p.indexOf('@');
		if ((p.indexOf('.')==a+1)||(p.indexOf(' ')==a+1))
		{
			alert('Le domaine de l\'adresse est incorrecte!');					                                  
			return false;
		}
    	if(p.indexOf('..')!=-1)
	    {
			alert("Il y a plus de un '.' dans l'adresse");
		    return false;
	    }
		if((p.charAt(p.length-3)!=".")&&(p.charAt(p.length-4)!="."))
		{
			alert("Nom de domaine incorrecte!");
			return false;
    	}
	    if(p.charAt(p.length-1)==".")
    	{
			alert("L'adresse ne peut pas terminer par un '.'");
	    	return false;
	    }
    	if(p.charAt(p.length-2)==".")
    	{
			alert("Il y a un probleme avec les '.'");
	    	return false;
    	}
   }
}




 
 ///////funzione per il formato data////////////////////////

 function FormatData(oggetto)
 {	
	if(oggetto.value.length==10)
	{
	   c=oggetto.value.split("/");
 	       
 	   if (c.length!=3)
 	  {
		 alert("Le format de la date doit etre: jj/mm/aaaa")
		 oggetto.value=''
 	     return false;
 	  }
	
	   gg=c[0];
	   mm=c[1];
	   
	   aaaa=c[2];
	   oggi=new Date()
	   giorno=oggi.getDate()
	   mese=oggi.getMonth()+1
	   anno=oggi.getFullYear()
	   
   
			
		var data_odierna= new Date(anno,mese,giorno)
		var data= new Date(aaaa,mm,gg)
		/*if (data_odierna < data)
		 {		
		       alert("Une plus grande date à celle-là aujourd'hui ");
	 		   oggetto.value=''
		       return false;
		 }
	    **/
		  if (aaaa.length != 4 || isNaN(aaaa) || isNaN(gg) ||isNaN(mm) ||gg > 31 || mm > 12|| gg < 01 || mm < 01 || aaaa<1900)
		  {
		   	  alert ('Erreur dans la date! ');
				  oggetto.value=''
			  return false;
		  }
			
			if (mm == '04' || mm == '06' || mm == '09' || mm == '11')
		  {	
		   	  if (gg >30)
			  {
			     alert ('Le mois a 30 jours! ');
				 oggetto.value=''
				 return false;
			  }
		  }
		  bis=String(aaaa/4);
		  if (bis.indexOf('.')==-1)
		  {
		 	  if (mm ==02)
			  {
			 	 if (gg > 29)
				 {
					alert ('Février a 29 jours (année bisestile) ');
					oggetto.value=''
					return false;
				 }
			  }	
		  }
		  else
		  {
		  	  if (mm ==02)
			  {
			 	  if (gg > 28)
				  {
					alert ('Février a 28 jours ');
					oggetto.value=''
					return false;
				  }
			  }	
		  }
}
else if(oggetto.value.length==0)
{
  return false;
}
else if(oggetto.value.length!=10)
{
  alert('Le format de la date doit etre: jj/mm/aaaa')
  oggetto.value=''
  return false;
}
}