function actionAj() {
	var pars = '';
		if (document.forms[0].ragsoc.value != '') {
			pars +=	'ragsoc=' + document.forms[0].ragsoc.value;
		}
		pars += '&nome=' + document.forms[0].nome.value;
		pars += '&cognome=' + document.forms[0].cognome.value;
		if (document.forms[0].indirizzo.value != '') {
			pars += '&indirizzo=' + document.forms[0].indirizzo.value;
		}
		if (document.forms[0].cap.value != '') {
			pars += '&cap=' + document.forms[0].cap.value;
		}
		if (document.forms[0].provincia.value != '') {
			pars += '&provincia=' + document.forms[0].provincia.value;
		}
		if (document.forms[0].citta.value != '') {
			pars += '&citta=' + document.forms[0].citta.value;
		}
		if (document.forms[0].ragsoc.value != '') {
			pars += '&nazione=' + document.forms[0].nazione.value;
		}
		pars += '&email=' + document.forms[0].email.value;
		if (document.forms[0].telefono.value != '') {
			pars += '&telefono=' + document.forms[0].telefono.value;
		}
		pars += '&richiesta=' + document.forms[0].richiesta.value;

	sendmail('./invia_mail.php?' + pars);
}

function Controlla() {
	var re_emptyall = new RegExp("^[ ]*$");
	var re_not_number = new RegExp("[^0-9]");
	var re_email = /^([a-zA-Z0-9])+([\.&a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;

alert0 = "The field Company is mandatory";
alert1 = "The field Name is mandatory";
alert2 = "The field Surname is mandatory";
alert3 = "The field Address is mandatory";
alert4 = "The field Postal code is mandatory";
alert5 = "The field Province is mandatory";
alert6 = "The field City is mandatory";
alert7 = "The field Nation is mandatory";
alert8 = "The field E-mail is mandatory";
alert9 = "The field Request is mandatory";
alert10 = "The field Telephone is mandatory";
alert11 = "You must authorize handling of your personal data";

	// Controllo il campo nome
	if ( (document.forms[0].nome.value == "") || (re_emptyall.test(document.forms[0].nome.value)) ) {
		alert(alert1);
		document.forms[0].nome.focus();
		return false;
	} 

	// Controllo il cognome
	if ( (document.forms[0].cognome.value == "") || (re_emptyall.test(document.forms[0].cognome.value)) ){
		alert(alert2);
		document.forms[0].cognome.focus();
		return false;
	}	
//--	
	// Controllo il campo indirizzo
	if ( (document.forms[0].indirizzo.value == "") || (re_emptyall.test(document.forms[0].indirizzo.value)) ) {
		alert(alert3);
		document.forms[0].indirizzo.focus();
		return false;
	}
	
	// Controllo il campo CAP
	if ( (document.forms[0].cap.value == "") || (re_emptyall.test(document.forms[0].cap.value)) ) {
		alert(alert4);
		document.forms[0].cap.focus();
		return false;
	}
	
	// Controllo il campo Provincia
	if ( (document.forms[0].provincia.value == "") || (re_emptyall.test(document.forms[0].provincia.value)) ) {
		alert(alert5);
		document.forms[0].provincia.focus();
		return false;
	}
	
	// Controllo il campo Citta
	if ( (document.forms[0].citta.value == "") || (re_emptyall.test(document.forms[0].citta.value)) ) {
		alert(alert6);
		document.forms[0].citta.focus();
		return false;
	}
	
	// Controllo il campo Nazione
	if ( (document.forms[0].nazione.value == "") || (re_emptyall.test(document.forms[0].nazione.value)) ) {
		alert(alert7);
		document.forms[0].nazione.focus();
		return false;
	}
//--	
	// Controllo la mail
	if ( (document.forms[0].email.value == "") || (re_emptyall.test(document.forms[0].email.value)) ) {
		alert(alert8);
		document.forms[0].email.focus();
		return false;
	}
//--
	// Controllo telefono
	if ( (document.forms[0].telefono.value == "") || (re_emptyall.test(document.forms[0].telefono.value)) ) {
		alert(alert10);
		document.forms[0].telefono.focus();
		return false;
	}
//--
	// Controllo la richiesta
	if ( (document.forms[0].richiesta.value == "") || (re_emptyall.test(document.forms[0].richiesta.value)) ) {
		alert(alert9);
		document.forms[0].richiesta.focus();
		return false;
	}
	
	if (!re_email.test(document.forms[0].email.value)) {
			alert(alert9);
			document.forms[0].email.focus();
			return;
	 }

	if (document.forms[0].accetto.checked != 1) {
		alert(alert11);
		return false;
	}
	
	actionAj();

	return false;
}

function actionAjCataloghi() {
	var pars = '';
		if (document.forms[0].ragsoc.value != '') {
			pars +=	'ragsoc=' + document.forms[0].ragsoc.value;
		}
		pars += '&nome=' + document.forms[0].nome.value;
		pars += '&cognome=' + document.forms[0].cognome.value;
		if (document.forms[0].indirizzo.value != '') {
			pars += '&indirizzo=' + document.forms[0].indirizzo.value;
		}
		if (document.forms[0].cap.value != '') {
			pars += '&cap=' + document.forms[0].cap.value;
		}
		if (document.forms[0].provincia.value != '') {
			pars += '&provincia=' + document.forms[0].provincia.value;
		}
		if (document.forms[0].citta.value != '') {
			pars += '&citta=' + document.forms[0].citta.value;
		}
		if (document.forms[0].ragsoc.value != '') {
			pars += '&nazione=' + document.forms[0].nazione.value;
		}
		pars += '&email=' + document.forms[0].email.value;
		if (document.forms[0].telefono.value != '') {
			pars += '&telefono=' + document.forms[0].telefono.value;
		}
	
		pars += '&Florian_Notte=' + document.forms[0].Florian_Notte.checked;
		pars += '&Florian_Giorno=' + document.forms[0].Florian_Giorno.checked;
		pars += '&La_Notte=' + document.forms[0].La_Notte.checked;
		pars += '&Logica=' + document.forms[0].Logica.checked;
		pars += '&Atlante=' + document.forms[0].Atlante.checked;
		pars += '&Classico=' + document.forms[0].Classico.checked;
		pars += '&Sintesi=' + document.forms[0].Sintesi.checked;

	sendmail('./invia_mail_cataloghi.php?' + pars);
}

function ControllaCataloghi() {
	var re_emptyall = new RegExp("^[ ]*$");
	var re_not_number = new RegExp("[^0-9]");
	var re_email = /^([a-zA-Z0-9])+([\.&a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;

	alert0 = "The field Company is mandatory";
	alert1 = "The field Name is mandatory";
	alert2 = "The field Surname is mandatory";
	alert3 = "The field Address is mandatory";
	alert4 = "The field Postal code is mandatory";
	alert5 = "The field Province is mandatory";
	alert6 = "The field City is mandatory";
	alert7 = "The field Nation is mandatory";
	alert8 = "The field E-mail is mandatory";
	alert9 = "The field Request is mandatory";
	alert10 = "The field Telephone is numeric";
	alert11 = "You must authorize handling of your personal data";

	// Controllo il campo nome
	if ( (document.forms[0].nome.value == "") || (re_emptyall.test(document.forms[0].nome.value)) ) {
		alert(alert1);
		document.forms[0].nome.focus();
		return false;
	} 

	// Controllo il cognome
	if ( (document.forms[0].cognome.value == "") || (re_emptyall.test(document.forms[0].cognome.value)) ){
		alert(alert2);
		document.forms[0].cognome.focus();
		return false;
	}	
	
	// Controllo indirizzo
	if ( (document.forms[0].indirizzo.value == "") || (re_emptyall.test(document.forms[0].indirizzo.value)) ){
		alert(alert3);
		document.forms[0].indirizzo.focus();
		return false;
	}
	
	// Controllo il CAP
	if ( (document.forms[0].cap.value == "") || (re_emptyall.test(document.forms[0].cap.value)) ){
		alert(alert4);
		document.forms[0].cap.focus();
		return false;
	}
	
	// Controllo la provincia
	if ( (document.forms[0].provincia.value == "") || (re_emptyall.test(document.forms[0].provincia.value)) ){
		alert(alert5);
		document.forms[0].provincia.focus();
		return false;
	}
	
	// Controllo la citta
	if ( (document.forms[0].citta.value == "") || (re_emptyall.test(document.forms[0].citta.value)) ){
		alert(alert6);
		document.forms[0].citta.focus();
		return false;
	}

	// Controllo la nazione
	if ( (document.forms[0].nazione.value == "") || (re_emptyall.test(document.forms[0].nazione.value)) ){
		alert(alert7);
		document.forms[0].nazione.focus();
		return false;
	}
	
	// Controllo la mail
	if ( (document.forms[0].email.value == "") || (re_emptyall.test(document.forms[0].email.value)) ) {
		alert(alert8);
		document.forms[0].email.focus();
		return false;
	}

	/* Controllo la richiesta
	if ( (document.forms[0].richiesta.value == "") || (re_emptyall.test(document.forms[0].richiesta.value)) ) {
		alert(alert9);
		document.forms[0].richiesta.focus();
		return false;
	} */
	
	if (!re_email.test(document.forms[0].email.value)) {
			alert(alert8);
			document.forms[0].email.focus();
			return;
	 }

	if (document.forms[0].accetto.checked != 1) {
		alert(alert11);
		return false;
	}
	
	actionAjCataloghi();

	return false;
}