// funzione che esegue i controlli sul form newsletter

function controlli_newsletter_en()
		{
			var cognome = document.form_newsletter.Surname.value;
			var nome = document.form_newsletter.Name.value;
			var email = document.form_newsletter.Email.value;
			var societa = document.form_newsletter.Company.value;
			var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
			var errors = new Array();
			var str = "";

			// CONTROLLO COGNOME
			if (cognome == "") {
			   errors=errors.concat("* \"Surname\" field is required.\n\n");
			}
			// CONTROLLO NOME
			if (nome == "") {
			   errors=errors.concat("* \"Name\" field is required.\n\n");
			}
			// CONTROLLO SOCIETA'
			if (societa == "") {
			   errors=errors.concat("* \"Company\" field is required\n\n");
			}
			// CONTROLLO EMAIL
			if (!email_reg_exp.test(email) || (email == "")) {
			   errors=errors.concat("* \"Email\" field is required. Make sure to write it correctly.\n\n");
			}
			// controllo se ci sono stati errori nella compilazione del form
			if (errors.length > 0){
				for (i=0;i<errors.length;i++){
					str += errors[i];
				}
				alert (str);
				return false;
			}
			//INVIA IL MODULO
			else {
			   return true;
			}
		}

function controlli_newsletter_it()
		{
			var cognome = document.form_newsletter.Surname.value;
			var nome = document.form_newsletter.Name.value;
			var email = document.form_newsletter.Email.value;
			var societa = document.form_newsletter.Company.value;
			var trattamentoDati = document.form_newsletter.trattamentoDati.checked;
			var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
			var errors = new Array();
			var str = "";

			// CONTROLLO COGNOME
			if (cognome == "") {
			   errors=errors.concat("* Il campo \"cognome\" è obbligatorio.\n\n");
			}
			// CONTROLLO NOME
			if (nome == "") {
			   errors=errors.concat("* Il campo \"nome\" è obbligatorio.\n\n");
			}
			// CONTROLLO SOCIETA'
			if (societa == "") {
			   errors=errors.concat("* Il campo \"società\" è obbligatorio.\n\n");
			}
			// CONTROLLO EMAIL
			if (!email_reg_exp.test(email) || (email == "")) {
			   errors=errors.concat("* Il campo \"e-mail\" è obbligatorio. Assicurati di scriverlo nella forma corretta.\n\n");
			}
			// CONTROLLO TRATTAMENTO DATI
			if (trattamentoDati == false) {
				 errors=errors.concat("* Per procedere devi dare il consenso per il trattamento dei dati personali.");
			}
			// controllo se ci sono stati errori nella compilazione del form
			if (errors.length > 0){
				for (i=0;i<errors.length;i++){
					str += errors[i];
				}
				alert (str);
				return false;
			}
			//INVIA IL MODULO
			else {
			   return true;
			}
		}

// funzione che esegue i controlli sul form mail

function controlli_mail_en()
		{
			var cognome = document.form_mail.cognome.value;
			var nome = document.form_mail.nome.value;
			var telefono = document.form_mail.telefono.value;
			var email = document.form_mail.email.value;
			var messaggio = document.form_mail.messaggio.value;
			var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
			var errors = new Array();
			var str = "";

			// CONTROLLO COGNOME
			if (cognome == "") {
			   errors=errors.concat("* \"Surname\" field is required.\n\n");
			}
			// CONTROLLO NOME
			if (nome == "") {
			   errors=errors.concat("* \"Name\" field is required.\n\n");
			}
			// CONTROLLO TELEFONO
			if (telefono == "") {
			   errors=errors.concat("* \"Telephone\" field is required\n\n");
			}
			// CONTROLLO EMAIL
			if (!email_reg_exp.test(email) || (email == "")) {
			   errors=errors.concat("* \"Email\" field is required. Make sure to write it correctly.\n\n");
			}
			// CONTROLLO MESSAGGIO
			if (messaggio == "") {
			   errors=errors.concat("* \"Message\" field is required\n\n");
			}
			// controllo se ci sono stati errori nella compilazione del form
			if (errors.length > 0){
				for (i=0;i<errors.length;i++){
					str += errors[i];
				}
				alert (str);
				return false;
			}
			//INVIA IL MODULO
			else {
			   return true;
			}
		}

function controlli_mail_it()
		{
			var cognome = document.form_mail.cognome.value;
			var nome = document.form_mail.nome.value;
			var telefono = document.form_mail.telefono.value;
			var email = document.form_mail.email.value;
			var messaggio = document.form_mail.messaggio.value;
			var trattamentoDati = document.form_mail.trattamentoDati.checked;
			var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
			var errors = new Array();
			var str = "";

			// CONTROLLO COGNOME
			if (cognome == "") {
			   errors=errors.concat("* Il campo \"cognome\" è obbligatorio.\n\n");
			}
			// CONTROLLO NOME
			if (nome == "") {
			   errors=errors.concat("* Il campo \"nome\" è obbligatorio.\n\n");
			}
			// CONTROLLO TELEFONO
			if (telefono == "") {
			   errors=errors.concat("* Il campo \"telefono\" è obbligatorio.\n\n");
			}
			// CONTROLLO EMAIL
			if (!email_reg_exp.test(email) || (email == "")) {
			   errors=errors.concat("* Il campo \"e-mail\" è obbligatorio. Assicurati di scriverlo nella forma corretta.\n\n");
			}
			// CONTROLLO MESSAGGIO
			if (messaggio == "") {
			   errors=errors.concat("* Il campo \"messaggio\" è obbligatorio.\n\n");
			}
			// CONTROLLO TRATTAMENTO DATI
			if (trattamentoDati == false) {
				 errors=errors.concat("* Per procedere devi dare il consenso per il trattamento dei dati personali.");
			}
			// controllo se ci sono stati errori nella compilazione del form
			if (errors.length > 0){
				for (i=0;i<errors.length;i++){
					str += errors[i];
				}
				alert (str);
				return false;
			}
			//INVIA IL MODULO
			else {
			   return true;
			}
		}