
function okdati() {
var den, com, cf, nome, p_ccia, codfis, nm_reg;
 
	if (document.f.modulo.value == 'modulo1') {
		// controllo primo form 
		den = WordCount(document.f.m1_Denominazione,'');		
		if ((document.f.m1_ChkVisFab.checked == false) && (document.f.m1_ChkVisTer.checked == false)) {
			alert('Sezione 1:\nSelezionare il Tipo di Ricerca');
			return false;
		}
		if (document.f.m1_Denominazione.value == '') {
			alert("Sezione 1:\nInserire il campo 'Ragione sociale'");
			return false;
		}	
		if (document.f.m1_Iva.value != '') {
			if (!check_piva(document.f.m1_Iva,"pc")) {  	
				return false;
			}
		}
	}
		
	if (document.f.modulo.value == 'modulo2') {
		// controllo secondo form	
		if ((document.f.m2_ChkVisFab.checked == false) && (document.f.m2_ChkVisTer.checked == false)) {
			alert('Sezione 1:\nSelezionare il Tipo di Ricerca');
			return false;
		}		
		if (document.f.m2_Cognome.value == '') {
			alert("Sezione 1:\nInserire il campo 'Cognome'");
			return false;
		}		
		if (document.f.m2_Nome.value == '') {
			alert("Sezione 1:\nInserire il campo 'Nome'");
			return false;
		}	
		if (((document.f.m2_Gg.value == '') && (document.f.m2_Mm.value == '') && (document.f.m2_Aaaa.value == '')) && (document.f.m2_Cf.value == '')) {
			alert('Sezione 1:\nInserire il Codice Fiscale o la Data di Nascita');
			return false;
		}		
		if ((document.f.m2_Gg.value != '') || (document.f.m2_Mm.value != '') || (document.f.m2_Aaaa.value != '')) {
			if (check_data(document.f.m2_Gg, document.f.m2_Mm, document.f.m2_Aaaa)==false) {
				return false;
			}
		}		
		if (document.f.m2_Cf.value != '') {
			if (!check_piva(document.f.m2_Cf,"cf")) {  	
				return false;
			}	
		}
	}		
	return true;
}
