function controlla()
{
	var 
		Nome = document.contatti.nome.value,
		Cognome = document.contatti.cognome.value,
		Nomeazienda = document.contatti.nomeazienda.value
		Email = document.contatti.email.value,
		Indirizzo = document.contatti.indirizzo.value,
		Citta = document.contatti.citta.value,
		Stato = document.contatti.stato.value,
		Telefono = document.contatti.telefono.value,
		Testo = document.contatti.testo.value,
		
		email_reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
	if(Nome == "" || Nome == null)
	{
		alert("Il campo nome e' obbligatorio");
		document.contatti.nome.focus();
		return false;
	}
	else if(Cognome == "" || Cognome == null)
	{
		alert("Il campo cognome e' obbligatorio");
		document.contatti.cognome.focus();
		return false;
	}
	else if(Nomeazienda == "" || Nomeazienda == null)
	{
		alert("Il campo nome azienda e' obbligatorio");
		document.contatti.nomeazienda.focus();
		return false;
	}
	else if(Email == "" || Email == null)
	{
		alert("Il campo email e' obbligatorio");
		document.contatti.email.focus();
		return false;
	}
	else if(Indirizzo == "" || Indirizzo == null)
	{
		alert("Il campo indirizzo e' obbligatorio");
		document.contatti.indirizzo.focus();
		return false;
	}
	else if(Citta == "" || Citta == null)
	{
		alert("Il campo citt&aacute; e' obbligatorio");
		document.contatti.citta.focus();
		return false;
	}
	else if(Stato == "" || Stato == null)
	{
		alert("Il campo stato e' obbligatorio");
		document.contatti.stato.focus();
		return false;
	}
	else if(Telefono == "" || Telefono == null)
	{
		alert("Il campo telefono e' obbligatorio");
		document.contatti.telefono.focus();
		return false;
	}
	else if(Testo == "" || Testo == null)
	{
		alert("Il campo testo e' obbligatorio");
		document.contatti.testo.focus();
		return false;
	}
	if (!email_reg.test(Email)) 
	{
	    alert("L'indirizzo email inserito non e' corretto");
	    document.contatti.email.select();
	    return false;
	}
	else
		return true;
	return false;
}

function controlla_conv()
{
	var 
		Nome = document.convegni.nome.value,
		Cognome = document.convegni.cognome.value,
		Mail = document.convegni.mail.value,
		Azienda = document.convegni.azienda.value,
		
		email_reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
	if(Nome == "" || Nome == null)
	{
		alert("Il campo nome e' obbligatorio");
		document.convegni.nome.focus();
		return false;
	}
	else if(Cognome == "" || Cognome == null)
	{
		alert("Il campo cognome e' obbligatorio");
		document.convegni.cognome.focus();
		return false;
	}
	else if(Mail == "" || Mail == null)
	{
		alert("Il campo e-mail e' obbligatorio");
		document.convegni.mail.focus();
		return false;
	}
	else if(Azienda == "" || Azienda == null)
	{
		alert("Il campo azienda e' obbligatorio");
		document.convegni.azienda.focus();
		return false;
	}
	if (!email_reg.test(Mail)) 
	{
	    alert("L'indirizzo email inserito non e' corretto");
	    document.convegni.mail.select();
	    return false;
	}
	else
		return true;
	return false;
	}

function controlla_esporre()
{
	var 
		Nome = document.contatti.nome.value,
		Cognome = document.contatti.cognome.value,
		Nomeazienda = document.contatti.nomeazienda.value
		Email = document.contatti.email.value,
		Indirizzo = document.contatti.indirizzo.value
		Citta = document.contatti.citta.value,
		Stato = document.contatti.stato.value
		Telefono = document.contatti.telefono.value
		Sito = document.contatti.sito.value
		Testo = document.contatti.testo.value,
		Area = document.contatti.info.value,
		
		email_reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
	if(Nome == "" || Nome == null)
	{
		alert("Il campo nome e' obbligatorio");
		document.contatti.nome.focus();
		return false;
	}
	else if(Cognome == "" || Cognome == null)
	{
		alert("Il campo cognome e' obbligatorio");
		document.contatti.cognome.focus();
		return false;
	}
	else if(Nomeazienda == "" || Nomeazienda == null)
	{
		alert("Il campo Nome Azienda e' obbligatorio");
		document.contatti.nomeazienda.focus();
		return false;
	}
	else if(Email == "" || Email == null)
	{
		alert("Il campo email e' obbligatorio");
		document.contatti.email.focus();
		return false;
	}
	else if(Indirizzo == "" || Indirizzo == null)
	{
		alert("Il campo Indirizzo e' obbligatorio");
		document.contatti.indirizzo.focus();
		return false;
	}
	else if(Citta == "" || Citta == null)
	{
		alert("Il campo citta'; e' obbligatorio");
		document.contatti.citta.focus();
		return false;
	}
	else if(Stato == "" || Stato == null)
	{
		alert("Il campo stato e' obbligatorio");
		document.contatti.stato.focus();
		return false;
	}
	else if(Telefono == "" || Telefono == null)
	{
		alert("Il campo telefono e' obbligatorio");
		document.contatti.telefono.focus();
		return false;
	}
	else if(Testo == "" || Testo == null)
	{
		alert("Il campo testo e' obbligatorio");
		document.contatti.testo.focus();
		return false;
	}
	if (!email_reg.test(Email)) 
	{
	    alert("L'indirizzo email inserito non e' corretto");
	    document.contatti.email.select();
	    return false;
	}
	else
		return true;
	return false;
}

function controlla_pre()
{
	var f = document.pre;
	
	var
		c1 = f.ragione.value,
		c2 = f.iva.value,
		c3 = f.indirizzo.value,
		c4 = f.numero.value,
		c5 = f.citta.value,
		c6 = f.provincia.value,
		c7 = f.cap.value,
		
		c9 = f.telefono.value,
		c10 = f.fax.value,
		c11 = f.mail.value,
		c12 = f.nome.value,
		c13 = f.cognome.value,
		c14 = f.mail_ref.value,
		c15 = f.attivita,
		c15b = f.attivita_altro.value,
		c16 = f.p_nome_1.value,
		c17 = f.p_cognome_1.value,
		c18 = f.p_mail_1.value,
		c19 = f.p_funzione_1.value,
		c20 = f.p_nome_2.value,
		c21 = f.p_cognome_2.value,
		c22 = f.p_mail_2.value,
		c23 = f.p_funzione_2.value,
		c24 = f.p_nome_3.value,
		c25 = f.p_cognome_3.value,
		c26 = f.p_mail_3.value,
		c27 = f.p_funzione_3.value,
		c28 = f.p_nome_4.value,
		c29 = f.p_cognome_4.value,
		c30 = f.p_mail_4.value,
		c31 = f.p_funzione_4.value,
		c32 = f.p_nome_5.value,
		c33 = f.p_cognome_5.value,
		c34 = f.p_mail_5.value,
		c35 = f.p_funzione_5.value,
		c36 = f.tipologia,
		invitati = 0,
		
		reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/,
		partecipa = false,
		radio = false,
		attivita = "",
		tipra = false;
		
	for (var i = 0; i < c15.length; i++) 
		if (c15[i].checked) 
		{
			radio = true;
			attivita = c15[i].value;
		}
	
	for (var n = 0; n < c36.length; n++) 
		if (c36[n].checked) 
			tipra = true;
	
	if(c1 == "" || c1 == "undefined")
	{
		alert("Il campo Ragione Sociale è obbligatorio");
		f.ragione.focus();
		return false;
	}
	else if(c2 == "" || c2 == "undefined")
	{
		alert("Il campo Partita Iva è obbligatorio");
		f.iva.focus();
		return false;
	}
	else if(c3 == "" || c3 == "undefined")
	{
		alert("Il campo Indirizzo è obbligatorio");
		f.indirizzo.focus();
		return false;
	}
	else if(c4 == "" || c4 == "undefined")
	{
		alert("Il campo Numero è obbligatorio");
		f.numero.focus();
		return false;
	}
	else if(c5 == "" || c5 == "undefined")
	{
		alert("Il campo Città è obbligatorio");
		f.citta.focus();
		return false;
	}
	else if(c6 == "" || c6 == "undefined")
	{
		alert("Il campo Provincia è obbligatorio");
		f.provincia.focus();
		return false;
	}
	else if(c7 == "" || c7 == "undefined")
	{
		alert("Il campo CAP è obbligatorio");
		f.cap.focus();
		return false;
	}
	else if(c9 == "" || c9 == "undefined")
	{
		alert("Il campo Telefono è obbligatorio");
		f.telefono.focus();
		return false;
	}
	else if(c10 == "" || c10 == "undefined")
	{
		alert("Il campo Fax è obbligatorio");
		f.fax.focus();
		return false;
	}
	else if(c11 == "" || c11 == "undefined")
	{
		alert("Il campo E-mail è obbligatorio");
		f.mail.focus();
		return false;
	}
	else if(c12 == "" || c12 == "undefined")
	{
		alert("Il campo Nome Referente è obbligatorio");
		f.nome.focus();
		return false;
	}
	else if(c13 == "" || c13 == "undefined")
	{
		alert("Il campo Cognome Referente è obbligatorio");
		f.cognome.focus();
		return false;
	}
	else if(c14 == "" || c14 == "undefined")
	{
		alert("Il campo E-mail Referente è obbligatorio");
		f.mail_ref.focus();
		return false;
	}
	else if(!radio)
	{
		alert("Il campo Attività è obbligatorio");
		return false;
	}
	else if(attivita == 'attivita_altro' && (c15b == '' || c15b == "undefined"))
	{
		alert("Il campo Altra Attività è obbligatorio");
		return false;
	}
	else if(!tipra)
	{
		alert("Il campo Tipologia e obbligatorio");
		return false;
	}
	else if(!reg.test(c11))
	{
		alert("L'indirizzo E-mail fornito non è valido");
		f.mail.select();
		return false;
	}
	else if(!reg.test(c14))
	{
		alert("L'indirizzo E-mail fornito non è valido");
		f.mail_ref.select();
		return false;
	}
	
	if(c16 != "" && c16 != "undefined")
	{
		if(c17 == "" || c17 == "undefined")
		{
			alert("Il campo Cognome è obbligatorio");
			f.p_cognome_1.focus();
			return false;
		}
		else if(c18 == "" || c18 == "undefined")
		{
			alert("Il campo E-mail è obbligatorio");
			f.p_mail_1.focus();
			return false;
		}
		else if(!reg.test(c18))
		{
			alert("L'E-mail fornita non è valida");
			f.p_mail_1.select();
			return false;
		}
		else if(c19 == "" || c19 == "undefined")
		{
			alert("Il campo Funzione è obbligatorio");
			f.p_funzione_1.focus();
			return false;
		}
		else
			partecipa = true;
	}
	if(c20 != "" && c20 != "undefined")
	{
		if(c21 == "" || c21 == "undefined")
		{
			alert("Il campo Cognome è obbligatorio");
			f.p_cognome_2.focus();
			return false;
		}
		else if(c22 == "" || c22 == "undefined")
		{
			alert("Il campo E-mail è obbligatorio");
			f.p_mail_2.focus();
			return false;
		}
		else if(!reg.test(c22))
		{
			alert("L'E-mail fornita non è valida");
			f.p_mail_2.select();
			return false;
		}
		else if(c23 == "" || c23 == "undefined")
		{
			alert("Il campo Funzione è obbligatorio");
			f.p_funzione_2.focus();
			return false;
		}
		else
			partecipa = true;
	}
	if(c24 != "" && c24 != "undefined")
	{
		if(c25 == "" || c25 == "undefined")
		{
			alert("Il campo Cognome è obbligatorio");
			f.p_cognome_3.focus();
			return false;
		}
		else if(c26 == "" || c26 == "undefined")
		{
			alert("Il campo E-mail è obbligatorio");
			f.p_mail_3.focus();
			return false;
		}
		else if(!reg.test(c26))
		{
			alert("L'E-mail fornita non è valida");
			f.p_mail_3select();
			return false;
		}
		else if(c27 == "" || c27 == "undefined")
		{
			alert("Il campo Funzione è obbligatorio");
			f.p_funzione_3.focus();
			return false;
		}
		else
			partecipa = true;
	}
	if(c28 != "" && c28 != "undefined")
	{
		if(c29 == "" || c29 == "undefined")
		{
			alert("Il campo Cognome è obbligatorio");
			f.p_cognome_4.focus();
			return false;
		}
		else if(c30 == "" || c30 == "undefined")
		{
			alert("Il campo E-mail è obbligatorio");
			f.p_mail_4.focus();
			return false;
		}
		else if(!reg.test(c30))
		{
			alert("L'E-mail fornita non è valida");
			f.p_mail_4.select();
			return false;
		}
		else if(c31 == "" || c31 == "undefined")
		{
			alert("Il campo Funzione è obbligatorio");
			f.p_funzione_4.focus();
			return false;
		}
		else
			partecipa = true;
	}
	if(c32 != "" && c32 != "undefined")
	{
		if(c33 == "" || c33 == "undefined")
		{
			alert("Il campo Cognome è obbligatorio");
			f.p_cognome_5.focus();
			return false;
		}
		else if(c34 == "" || c34 == "undefined")
		{
			alert("Il campo E-mail è obbligatorio");
			f.p_mail_5.focus();
			return false;
		}
		else if(!reg.test(c34))
		{
			alert("L'E-mail fornita non è valida");
			f.p_mail_5.select();
			return false;
		}
		else if(c35 == "" || c35 == "undefined")
		{
			alert("Il campo Funzione è obbligatorio");
			f.p_funzione_5.focus();
			return false;
		}
		else
			partecipa = true;
	}
	
	if(partecipa)
	{
		return true;
	}
	else
	{
		alert("Devi inserire almeno un partecipante");
		f.p_nome_1.focus();
		return false;
	}
	return false;
}
