function controlla() {
	var errori = new String();
	
	errori+=convalida("Descrizione", "Nome Yacht", "r");
	errori+=convalida("Lunghezza", "Lunghezza", "numero");
	errori+=convalida("Armatore", "Armatore", "r");
	errori+=convalida("EMail", "EMail", "email");

	if(errori!="") {
		alert("Non posso continuare:\n"+errori);
		document.SiNo = false;
	} else {
		document.SiNo = true;
	}
}

function convalida(campo, descrizione, tipo) {
	var valore = new String(document.getElementById(campo).value);
	switch (tipo) {
	case "r":
		if(valore=="")	return "- "+descrizione+" deve contenere dati.\n";
		break;
	case "email":
		if(valore.search(/.+@.+\..+/i)) return "- "+descrizione+" deve essere un'email.\n";
		break;
	case "numero":
		if(valore.search(/\d+[,\d*|\.\d*]*$/)) return "- "+descrizione+" deve essere un numero.\n";
		break;
	}
	return "";
}

