
function okdati() {

if (document.f.modulo.value == '') {
		alert('Completare la sezione 1');
		return false
	}
	
	if (document.f.modulo.value == 'modulo1') {
		// controllo primo form
  		
		if (document.f.m1_PR.selectedIndex == 0) {
			alert('Sezione 1\nSelezionare il campo \'provincia\'');
			return false;
		}
		
		if (document.f.m1_CboComune.selectedIndex == 0) {
			alert('Sezione 1\nSelezionare il campo \'comune\'');
			return false;
		}	
		if (document.f.m1_TxtToponimo.selectedIndex == 0) {
			alert('Sezione 1\nSelezionare il toponimo indirizzo');
			return false;
		}
		if (document.f.m1_TxtIndirizzo.value == '') {
			alert('Sezione 1\nInserire il campo \'Indirizzo\'');
			return false;		
		}
		if (document.f.m1_dalcivico.value != '') {		
			if (!check_num(document.f.m1_dalcivico.value)) {
				alert('Sezione 1\nInserire soltanto caratteri numerici per il numero civico');
				return false;
			}
		}
		
		document.f.m1_comune.value = document.f.m1_CboComune.options[document.f.m1_CboComune.selectedIndex].text;
				
	}
	
	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_ChkVisFab.checked == true) && (document.f.m2_ChkVisTer.checked == true)) {
		alert("Sezione 1\nSelezionare la 'Visura Fabbricati' o la 'Visura Terreni'");
		return false;
	}	
	
	if (document.f.m2_PR.selectedIndex == 0) {
		alert('Sezione 1\nSelezionare il campo \'provincia\'');
		return false;
	}

	if (document.f.m2_CboComune.selectedIndex == 0) {
		alert('Sezione 1\nSelezionare il campo \'comune\'');
		return false;
	} 
	
	if (document.f.m2_Foglio.value == '') {
		alert('Sezione 1\nInserire il campo \'Foglio\'');
		return false;	
	
	}
	
	if (document.f.m2_Particella.value == '') {
		alert('Sezione 1\nInserire il campo \'Particella\'');
		return false;		
	
	}
		
	if ((document.f.m2_Subalterno.value != '') && (document.f.m2_ChkVisTer.checked == true)) {
		alert('Sezione 1\nIl Campo Subalterno non va inserito nel caso di Visura Terreni');
		return false;
	}	
	
	document.f.m2_comune.value = document.f.m2_CboComune.options[document.f.m2_CboComune.selectedIndex].text;
			
	}		
	return true;
}
