// JavaScript Document
function chk(){
f = document.fm;
	
	if (f.ragioneSociale.value.split(" ").length == (f.ragioneSociale.value.length+1)){
	alert("Attenzione! Non hai inserito la 'Ragione Sociale'");
	f.Nome.focus();
	f.Nome.select();
	return false;
	}
	if (f.citta.value.split(" ").length == (f.citta.value.length+1)){
	alert("Attenzione! Non hai inserito 'la cittā'");
	f.Cognome.focus();
	f.Cognome.select();
	return false;
	}
	if (f.Indirizzo.value.split(" ").length == (f.Indirizzo.value.length+1)){
	alert("Attenzione! Non hai inserito 'l'indirizzo'");
	f.Indirizzo.focus();
	f.Indirizzo.select();
	return false;
	}
	if (f.Cap.value.split(" ").length == (f.Cap.value.length+1)){
	alert("Attenzione! Non hai inserito 'il CAP'");
	f.Cap.focus();
	f.Cap.select();
	return false;
	}
	if (f.telefono.value.split(" ").length == (f.telefono.value.length+1)){
	alert("Attenzione! Non hai inserito 'il telefono'");
	f.Indirizzo.focus();
	f.Indirizzo.select();
	return false;
	}
	//Indica se la mail č corretta. true=corretta, false=non corretta
	var chkmail;
	if (f.Email.value.indexOf ('@',0) != -1) chkmail=true; else chkmail=false;
	if (chkmail)
		if (f.Email.value.split('@')[1].indexOf ('.',0) == -1) chkmail=false;
	if (!chkmail) {
		alert("Attenzione! L'e-mail inserita č sbagliata.");
		f.Email.select();
		f.Email.focus();
		return false;
	}
	if (isNaN(f.Cap.value) || f.Cap.value.split(" ").length == (f.Cap.value.length+1)){
	alert("Attenzione! Il Cap inserito deve contenere solo numeri");
	f.Cap.focus();
	f.Cap.select();
	return false;
	}
	if (isNaN(f.telefono.value) || f.telefono.value.split(" ").length == (f.telefono.value.length+1)){
	alert("Attenzione! il telefono deve contenere solo numeri");
	f.telefono.focus();
	f.telefono.select();
	return false;
	}

 document.forms['fm'].submit();
}
	

