function checkCR(evt) {
    var evt  = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
  }
document.onkeypress = checkCR;



function trim(stringa) {
		while (stringa.substring(0,1) == ' ') {
			stringa = stringa.substring(1, stringa.length);
		}
		while (stringa.substring(stringa.length-1, stringa.length) == ' ') {
			stringa = stringa.substring(0,stringa.length-1);
		}
	return stringa;
}



function Validator_iscrizione() {
	var email = document.getElementById("indirizzo_iscrizione").value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert("Inserire un indirizzo email corretto!!\nPlease insert a valid email address!!");
		document.getElementById("indirizzo_iscrizione").select();
	return false;
	}

document.iscrizione.submit();
}



function biglietti() {
  alert("La vendita on line dei biglietti sara' attiva a breve.\nThe online sale will be active soon.");
}



function Validator_accredito() {
	var nome = trim(document.accredito.nome.value);
	var cognome = trim(document.accredito.cognome.value);
	var testata = trim(document.accredito.testata.value);
	var telefono = trim(document.accredito.telefono.value);
	var email = trim(document.accredito.email.value);
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	var qualifica = trim(document.accredito.qualifica.value);
	
	if ((nome == "") || (nome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.accredito.nome.focus();
	return false;
	}
	
	if ((cognome == "") || (cognome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.accredito.cognome.focus();
	return false;
	}
	
	if ((testata == "") || (testata == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.accredito.testata.focus();
	return false;
	}
	
	if ((telefono == "") || (telefono == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.accredito.telefono.focus();
	return false;
	}
	
	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert("Inserire un indirizzo email corretto!!\nPlease insert a valid email address!!");
		document.accredito.email.select();
	return false;
	}
	
	if ((qualifica == "") || (qualifica == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.accredito.qualifica.focus();
	return false;	
	}
	
return (true);
}



function Validator_contattaci() {	
	var nome = trim(document.contattaci.nome.value);
	var cognome = trim(document.contattaci.cognome.value);
	var cellulare = trim(document.contattaci.cellulare.value);
	var email = trim(document.contattaci.email.value);
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	
	if ((nome == "") || (nome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.contattaci.nome.focus();
	return false;
	}
	
	if ((cognome == "") || (cognome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.contattaci.cognome.focus();
	return false;
	}
	
	if ((cellulare == "") || (cellulare == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.contattaci.cellulare.focus();
	return false;
	}
	
	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert("Inserire un indirizzo email corretto!!\nPlease insert a valid email address!!");
		document.contattaci.email.select();
	return false;
	}

return (true);
}

function Validator_convegno() {	
	var nome = trim(document.contattaci.nome.value);
	var cognome = trim(document.contattaci.cognome.value);
	var email = trim(document.contattaci.email.value);
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	
	if ((nome == "") || (nome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.contattaci.nome.focus();
	return false;
	}
	
	if ((cognome == "") || (cognome == "undefined")) {
	   alert("I campi contrassegnati da * sono obbligatori!!\nFields marked by * are mandatory!!");
	   document.contattaci.cognome.focus();
	return false;
	}
		
	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert("Inserire un indirizzo email corretto!!\nPlease insert a valid email address!!");
		document.contattaci.email.select();
	return false;
	}

return (true);
}