
<!-- Controlla il checkbox -->

function deptChecked(form) {
  for (i=0; i<form.Reg.length; i++) {
    if (form.Reg[i].checked) {
      return true;
    }
  }
  return false;
}


<!-- Valida campi testo -->
function validateForm(form) {
  if ( (form.cognome.value == "") )
	 { alert("Attenzione! Devi inserire il cognome"); 	form.cognome.focus();  return false; }
	 else 

  if ( (form.nome.value == "")  )
	 { alert("Attenzione! Devi inserire il nome"); form.nome.focus();  return false; }
	 else 

  if ( (form.ospedale.value == "")  )
	 { alert("Attenzione! Devi inserire l' ospedale"); form.ospedale.focus();  return false; }
	 else 

  if ( (form.istituto.value == "")  )
	 { alert("Attenzione! Devi inserire l' istituto"); form.istituto.focus();  return false; }
	 else 

  if ( (form.indirizzo.value == "")  )
	 { alert("Attenzione! Devi indicare l' indirizzo"); form.indirizzo.focus();  return false; }
	 else 

  if ( (form.cap.value == "")  )
	 { alert("Attenzione! Devi inserire il cap"); form.cap.focus();  return false; }
	 else 

   if ( (form.citta.value == "")  )
	 { alert("Attenzione! immetti la cittą"); form.citta.focus();  return false; }
	 else 
if ( (form.telefono.value == "")  )
	 { alert("Attenzione! immetti il telefono"); form.telefono.focus();  return false; }
	 else 
  if ( (form.fax.value == "")  )
	 { alert("Attenzione! immetti il fax"); form.fax.focus();  return false; }
	 else 
<!-- Validate email verifica la validitą formale-->  
  if  ( form.email.value.indexOf( "@") == -1 )
        { alert( "Inserisci un indirizzo valido per la e-mail" ); 
           return false; }
	if ( form.email.value.indexOf( ".") == -1 )
	{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
        return false; }

return true;
  
return true;

  }


 <!-- Valida campi testo -->
function valida(form) {
  if ( (form.centro.value == "") )
	 { alert("Attenzione! Devi inserire il centro"); 	form.centro.focus();  return false; }
	 else 

  if ( (form.nome_pz.value == "")  )
	 { alert("Attenzione! Devi inserire il nome"); form.nome_pz.focus();  return false; }
	 else 

  if ( (form.data_nascita.value == "")  )
	 { alert("Attenzione! Devi inserire la data di nascita"); form.data_nascita.focus();  return false; }
	 else 

  if ( (form.eta.value == "")  )
	 { alert("Attenzione! Devi inserire l' eta"); form.eta.focus();  return false; }
	 else 

 
  
  
  
  
  if ( (form.sesso.value == "")  )
	 { alert("Attenzione! Devi indicare il sesso"); form.sesso.focus();  return false; }
	 else 

  if ( (form.cap.value == "")  )
	 { alert("Attenzione! Devi inserire il cap"); form.cap.focus();  return false; }
	 else 

   if ( (form.citta.value == "")  )
	 { alert("Attenzione! immetti la cittą"); form.citta.focus();  return false; }
	 else 
if ( (form.telefono.value == "")  )
	 { alert("Attenzione! immetti il telefono"); form.telefono.focus();  return false; }
	 else 
  if ( (form.fax.value == "")  )
	 { alert("Attenzione! immetti il fax"); form.fax.focus();  return false; }
	 else 
<!-- Validate email verifica la validitą formale-->  
  if  ( form.email.value.indexOf( "@") == -1 )
        { alert( "Inserisci un indirizzo valido per la e-mail" ); 
           return false; }
	if ( form.email.value.indexOf( ".") == -1 )
	{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
        return false; }
        

var el = document.forms[0].elements;
	errors=''
	for(var i = 0 ; i < el.length ; ++i)
	{
		if(el[i].type == "radio")
		{
			var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
			itemchecked = radiogroup.checked;
			
			if ( radiogroup.length && radiogroup.length>1 )
			{
						for(var j = 0 ; j < radiogroup.length ; ++j)
						{
							if(radiogroup[j].checked)
							{
								itemchecked = true;
								break;
							}
						}

						if(!itemchecked)
						{ 
							errors+='Please select a for '+el[i].name+'\n';
							if(el[i].focus)
								el[i].focus();
									alert(errors);
										return false;
						}
				}
			}
	}
return true;





return true;
  
return true;

  }





function valid(form) {
  if ( (form.centro.value == "") )
	 { alert("Attenzione! Devi inserire il nome del centro"); 	form.centro.focus();  return false; }
	 else 

  if ( (form.nome_pz.value == "")  )
	 { alert("Attenzione! Devi inserire il nome del paziente"); form.nome_pz.focus();  return false; }
	 else 


if (form.data_nascita.value.substring(2,3) != "/" ||
   form.data_nascita.value.substring(5,6) != "/" ||
   isNaN(form.data_nascita.value.substring(0,2)) ||
   isNaN(form.data_nascita.value.substring(3,5)) ||
   isNaN(form.data_nascita.value.substring(6,10))) {
      alert("Inserire nascita in formato gg/mm/aaaa");
      form.data_nascita.value = "";
      form.data_nascita.focus();
      return false;
} else if (form.data_nascita.value.substring(0,2) > 31) {
   alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
   form.data_nascita.select();
   return false;
} else if (form.data_nascita.value.substring(3,5) > 12) {
   alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
   form.data_nascita.value = "";
   form.data_nascita.focus();
   return false;
} else if (form.data_nascita.value.substring(6,10) < 1900) {
   alert("Impossibile utilizzare un valore inferiore a 1900 per l'anno");
   form.data_nascita.value = "";
   form.data_nascita.focus();
   return false;
}
else




return true;
  
return true;

  }
  
  
  
<!-- inizio campi altro-->
//1   tipo lesione
function modifica(){
		var tiples=document.getElementById("tipo-lesione");
		tiples.className="prova2";

		
		}
		
function modifica2(){
		var tiples2=document.getElementById("tipo-lesione");
		tiples2.className="prova";

		
		}

//2 fegato
function fegat(){
		var feg=document.getElementById("fegato");
		feg.className="prova2";

		
		}
		
function fegat2(){
		var feg2=document.getElementById("fegato");
		feg2.className="prova";

		
		}
//3 eziologia cirrosi

function ezio(){
		var ez=document.getElementById("eziologia");
		ez.className="prova2";

		
		}
		
function ezio2(){
		var ez2=document.getElementById("eziologia");
		ez2.className="prova";

		
		}
//4 accesso

function access(){
		var ac=document.getElementById("acce");
		ac.className="prova2";

		
		}
		
function access2(){
		var ac2=document.getElementById("acce");
		ac2.className="prova";

		
		}
//5 terapia recidiva

function teraprec(){
		var terapi=document.getElementById("terapi");
		terapi.className="prova2";


		}
		
function teraprec2(){
		var terapi2=document.getElementById("terapi");
		terapi2.className="prova";
		
}
