function CheckForm(theForm) {
	var CheckOK = false;
	for(i=0;i<theForm.SETTORE.length;i++) {
		if(theForm.SETTORE[i].checked) {CheckOK = true;}
	}
	if(!CheckOK) {
		alert("Attenzione. E' necessario specificare almeno un settore di appartenenza.")
		return(false);
	}
	if(theForm.RAGIONE_SOCIALE.value == "") {
		alert("Il campo \"Ragione Sociale\" è obbligatorio.");
		theForm.RAGIONE_SOCIALE.focus();
		return(false);
	}
	if(theForm.PARTITA_IVA.value == "") {
		alert("Il campo \"Partita Iva\" è obbligatorio.");
		theForm.PARTITA_IVA.focus();
		return(false);
	}
	if(theForm.INDIRIZZO.value == "") {
		alert("Il campo \"Indirizzo\" è obbligatorio.");
		theForm.INDIRIZZO.focus();
		return(false);
	}
	if(theForm.LOCALITA.value == "") {
		alert("Il campo \"Località\" è obbligatorio.");
		theForm.LOCALITA.focus();
		return(false);
	}
	if(theForm.PROVINCIA.value == "") {
		alert("Il campo \"Provincia\" è obbligatorio.");
		theForm.PROVINCIA.focus();
		return(false);
	}
	if(theForm.CAP.value == "") {
		alert("Il campo \"CAP\" è obbligatorio.");
		theForm.CAP.focus();
		return(false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.CAP.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++) if (ch == checkOK.charAt(j)) break;
		if (j == checkOK.length) {allValid = false; break;}
	}
	if (!allValid) {
		alert("Inserire un numero valido nel campo \"CAP\".");
		theForm.CAP.focus();
		return(false);
	}
	if(theForm.TELEFONO.value == "") {
		alert("Il campo \"Telefono\" è obbligatorio.");
		theForm.TELEFONO.focus();
		return(false);
	}
	var checkOK = "0123456789+-/() ";
	var checkStr = theForm.TELEFONO.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++) if (ch == checkOK.charAt(j)) break;
		if (j == checkOK.length) {allValid = false; break;}
	}
	if (!allValid) {
		alert("Inserire soltanto numeri ed il simbolo + nel campo \"Telefono\".\nCome separatori usate () - / o lo spazio.");
		theForm.TELEFONO.focus();
		return(false);
	}
	if(theForm.EMAIL.value == "") {
		alert("Il campo \"E-Mail\" è obbligatorio.");
		theForm.EMAIL.focus();
		return(false);
	}
	if(theForm.NOME.value == "") {
		alert("Il campo \"Nome Referente\" è obbligatorio.");
		theForm.NOME.focus();
		return(false);
	}
	if(theForm.COGNOME.value == "") {
		alert("Il campo \"Cognome Referente\" è obbligatorio.");
		theForm.COGNOME.focus();
		return(false);
	}
	return(true);
}

