function CheckRegistrazioneDonatore(form_name){

	theForm = document.forms[form_name];
	
	/* DATI DELL'ORGANIZZAZIONE */
	if (theForm.idRegione.value == "")  {
		alert ("Selezionare la regione in cui risiede la sede legale dell'Organizzazione!")
		theForm.idRegione.focus()
		return false;
	}
		
	if (theForm.idEnteTipologia.value == "")  {
		alert ("Selezionare la tipologia dell'Organizzazione!")
		theForm.idEnteTipologia.focus()
		return false;
	}
	
	if (theForm.NomeOrganizzazione)  {
		if (theForm.NomeOrganizzazione.value == "")  {
			alert ("Nome dell'Organizzazione obbligatorio!")
			theForm.NomeOrganizzazione.focus()
			theForm.NomeOrganizzazione.select()
			return false;
		}
	} else {
		if (theForm.idOspedaliASL.value == "")  {
			alert ("Selezionare la ASL di riferimento!")
			theForm.idOspedaliASL.focus()
			return false;
		}
		
		if (theForm.idOspedaliEnte.value == "")  {
			alert ("Selezionare l'azienda ospedaliera!")
			theForm.idOspedaliEnte.focus()
			return false;
		}
		
		if (theForm.idOspedaliStruttura.value == "")  {
			alert ("Selezionare il presidio!")
			theForm.idOspedaliStruttura.focus()
			return false;
		}
		
		if (theForm.idOspedaliDipartimento.value == "")  {
			alert ("Selezionare il dipartimento!")
			theForm.idOspedaliDipartimento.focus()
			return false;
		}
		
	}
	
	if (theForm.CF.value == "")  {
		alert ("Codice fiscale obbligatorio!")
		theForm.CF.focus()
		theForm.CF.select()
		return false;
	} else {
		var erroreCF = ''
		if( theForm.CF.value.length == 16 ) {
			var erroreCF = ControllaCF(theForm.CF.value);
		} else if( theForm.CF.value.length == 11 ) {
			var erroreCF = ControllaPIVA(theForm.CF.value);
		} else {
			var erroreCF = "Il codice fiscale introdotto non e' valido" 
		}
		
		if (erroreCF != "")  {
			alert (erroreCF)
			theForm.CF.focus()
			theForm.CF.select()
			return false;
		}		
	}
	
	
	if (document.getElementById('VerificaCF').innerHTML != "")  {
		alert ("Da un controllo sul codice fiscale l'organizzazione risulta gia' registrata sul portale")
		return false;
	}		
		
	//sede legale	
	if (theForm.Indirizzo.value == "")  {
		alert ("Indirizzo della sede legale obbligatorio!")
		theForm.Indirizzo.focus()
		theForm.Indirizzo.select()
		return false;
	}
	
	if (theForm.Citta.value == "")  {
		alert ("Citta' della sede legale obbligatoria!")
		theForm.Citta.focus()
		theForm.Citta.select()
		return false;
	}
	
	if (theForm.idProvincia.value == "")  {
		alert ("Selezionare la provincia della sede legale!")
		theForm.idProvincia.focus()
		return false;
	}			
	
	if (theForm.CAP.value == "")  {
		alert ("CAP della sede legale obbligatorio!")
		theForm.CAP.focus()
		theForm.CAP.select()
		return false;
	}
	
	//sede operativa	
	if (theForm.SedeOperativaIndirizzo.value == "")  {
		alert ("Indirizzo della sede operativa obbligatorio!")
		theForm.SedeOperativaIndirizzo.focus()
		theForm.SedeOperativaIndirizzo.select()
		return false;
	}
	
	if (theForm.SedeOperativaCitta.value == "")  {
		alert ("Citta' della sede operativa obbligatoria!")
		theForm.SedeOperativaCitta.focus()
		theForm.SedeOperativaCitta.select()
		return false;
	}
	
	if (theForm.SedeOperativaidProvincia.value == "")  {
		alert ("Selezionare la provincia della sede operativa!")
		theForm.SedeOperativaidProvincia.focus()
		return false;
	}			
	
	if (theForm.SedeOperativaCAP.value == "")  {
		alert ("CAP della sede operativa obbligatorio!")
		theForm.SedeOperativaCAP.focus()
		theForm.SedeOperativaCAP.select()
		return false;
	}
		
	//recapiti
	if (theForm.Telefono.value == "")  {
		alert ("Telefono!")
		theForm.Telefono.focus()
		theForm.Telefono.select()
		return false;
	}										
	
	/* INFORMAZIONE UTENTE */
	if (theForm.Username.value == "")  {
		alert ("Username obbligatorio!")
		theForm.Username.focus()
		theForm.Username.select()
		return false;
	}
		
	if (theForm.Username.value.length <6)  {
		alert ("Lo username deve essere composta da almeno 6 caratteri alfanumerici!")
		theForm.Username.focus()
		theForm.Username.select()
		return false;
	}

	if (document.getElementById('VerificaUsername').innerHTML != "")  {
		alert ("Username gia' in uso! Scegliere un altro username.")
		theForm.Username.focus()
		theForm.Username.select()
		return false;
	}				
				
	var illegalChars = /[\W_]/; // allow only letters and numbers	

	if (illegalChars.test(theForm.Username.value)==true)  {		
		alert ("Solo lettere e numeri ammessi nello username!")
		theForm.Username.focus()
		theForm.Username.select()
		return false;
	}
		
	if (isEmail(theForm.Email.value)==false) {
		alert ("L'indirizzo e-mail inserito non e' corretto!")
		theForm.Email.focus()
		theForm.Email.select()
		return false;
	}	
	
	if (theForm.Email.value!=theForm.Email2.value) {
		alert ("L'indirizzo e-mail inserito nel campo di conferma non coincide con il primo indirizzo inserito!")
		theForm.Email.focus()
		theForm.Email.select()
		return false;
	}			

	if (theForm.Password.value == "")  {
		alert ("Inserire una Password!")
		theForm.Password.focus()
		theForm.Password.select()
		return false;
	}

	if (theForm.Password.value.length<6)  {
		alert ("La password deve essere composta da almeno 6 caratteri!")
		theForm.Password.focus()
		theForm.Password.select()
		return false;
	}

	if (illegalChars.test(theForm.Password.value)==true)  {
		alert ("Solo lettere e numeri ammessi nella password!")
		theForm.Password.focus()
		theForm.Password.select()
		return false;
	}
		
	if (theForm.Password.value!=theForm.Password2.value) {
		alert ("La password inserita nel campo di conferma non coincide con la prima password inserita!")
		theForm.Password.focus()
		theForm.Password.select()
		return false;
	}	
	
	/* CONTATTO DI RIFERIMENTO DELL'ORGANIZZAZIONE */
	if (theForm.NomeReferente.value == "")  {
		alert ("Nome del referente obbligatorio!")
		theForm.NomeReferente.focus()
		theForm.NomeReferente.select()
		return false;
	}	
	
	if (theForm.CognomeReferente.value == "")  {
		alert ("Cognome del referente obbligatorio!")
		theForm.CognomeReferente.focus()
		theForm.CognomeReferente.select()
		return false;
	}
	
	if (theForm.MansioneReferente.value == "")  {
		alert ("Mansione del referente obbligatoria!")
		theForm.MansioneReferente.focus()
		theForm.MansioneReferente.select()
		return false;
	}
	
	if (theForm.TelefonoReferente.value == "")  {
		alert ("Telefono del referente obbligatorio!")
		theForm.TelefonoReferente.focus()
		theForm.TelefonoReferente.select()
		return false;
	}			
	
	if (theForm.EmailReferente.value == "")  {
		alert ("Indirizzo e-mail del referente obbligatorio!")
		theForm.EmailReferente.focus()
		theForm.EmailReferente.select()
		return false;
	}	
	
	if (isEmail(theForm.EmailReferente.value)==false) {
		alert ("L'indirizzo e-mail del referente non e' corretto!")
		theForm.EmailReferente.focus()
		theForm.EmailReferente.select()
		return false;
	}	
		
	/* ALTRO */
	if (theForm.idCanale.value == "")  {
		alert ("Indica come siete venuti a conoscenza del BITeB!")
		theForm.idCanale.focus()
		return false;
	}																			
	
	/* PRIVACY */
	if (theForm.Autorizzazione.checked == false)  {
		alert ("Autorizzare il trattamento dei dati personali")
		return false;
	}
	
	return true;														

}
