function errore(campo) {
   if (LANG == 0) {
   	alert("ATTENZIONE!\nImpossibile inviare il messaggio perchè il campo «"+campo+"»\nnon è stato correttamente valorizzato! Compilare attentamente tutti i campi obbligatori,\nquindi ritentare l'invio del messaggio.\nI campi obbligatori sono contrassegnati in grassetto.");
   } else {
      	alert("WARNING!\nThe field «"+campo+"» is not correctly filled out, so the\nmessage can't be sent! Please fill out carefully all the mandatory fields,\nthen try again to send the message.\nAll the bold fields are mandatory.");
   }
}

function inviaRichiesta() {
	var err="";
	var flag=0;
	
	document.Mail.NOME_COGNOME.value = document.Mail.realname.value;
	var name_text = document.Mail.NOME_COGNOME.value;
	var indemail = document.Mail.email.value;
	var msg_text = document.Mail.PROBLEMA.value;

	if (name_text == "" || name_text == null || name_text == "null") {
		if (LANG == 0) { err = "Nome e cognome"; } else { err = "Name and surname"; }
		flag=1;	
	}

	if ((indemail == "" || indemail == null || indemail == "null" || indemail.lastIndexOf("@") == -1 || indemail.lastIndexOf(".") == -1) && (flag==0)) {
		if (LANG == 0) { err = "Indirizzo e-mail"; } else { err = "E-mail address"; }
		flag=1;
	}
	
	if ((msg_text == "" || msg_text == null || msg_text == "null") && (flag==0)) {
		if (LANG == 0) { err = "Descrizione del problema rilevato"; } else { err = "Problem description"; }
		flag=1;
	}

	if (err != "" && flag!=0) {
		errore(err);
	}
	
	if (flag==0) {
		document.Mail.submit();
	}
}

