﻿
function okDatiModulo()
{
    try
    {
    	var IdModulo=document.f.modulo.value;
	    var ris;
	    
		ris = okdati();		

	    return ris;
    }
    catch(err)
    {
        err.message = 'okDatiModulo() :: ' + err.message;
        throw(err);
    }
}

function okdati()
{
	var CurrFile = location.pathname.split('/');
	var logmsg = '';
    try
    {
    	if (document.f.modulo.value == 'modulo1')
	    {
		    if (document.f.m1_PR.selectedIndex == 0)
		    {
				jAlertWrapper('Selezionare la Provincia di Ricerca', 'Sezione A');
				return false;
			}
			if (document.f.m1_Comune.selectedIndex == -1 || document.f.m1_Comune.options.length == 1)
			{
				jAlertWrapper('Selezionare il Comune di Ricerca', 'Sezione A');
				return false;
			}	
			else if (document.f.m1_Comune.selectedIndex == 0)
			{
				jAlertWrapper('Selezionare il Comune di Ricerca', 'Sezione A');
				return false;
			}	
			if (document.f.m1_Foglio.value == '')
			{
				jAlertWrapper('Inserire il campo Foglio', 'Sezione A');
				return false;
			}	
			if (document.f.m1_Particella.value == '')
			{
				jAlertWrapper('Inserire il campo Particella', 'Sezione A');
				return false;
			}
		}
	
		logmsg = document.f.m1_PR.value + ', ' + document.f.m1_Comune.value + ', ' + document.f.m1_Foglio.value + ', ' + document.f.m1_Particella.value;
	}
	catch(err)
    {
        err.message = 'okdati(modulo1) :: ' + err.message;
        throw(err);
        
        return false;
    }

	//Tutto ok, scrivo log
	var paramErr = new Array('javascript', '0', '['+ sessId + '] :: ' + 'okdati (' + logmsg + ')', 'true', CurrFile[CurrFile.length - 1]);		
	Log(paramErr);
	
	return true;
}


function FiltroPr()
{
	if ((document.f.m1_PR.value == 'BZ')||(document.f.m1_PR.value == 'TN'))
	{
		jAlertWrapper('Attenzione: il servizio non è attivo per le province di Trento e Bolzano', 'Sezione A');
		document.f.m1_PR.selectedIndex = 0;
		
		for (var i = document.f.m1_Comune.length; i>=1; i--)
		{
          document.f.m1_Comune.options[i] = null;
		}
		
		document.f.m1_Foglio.value = '';
		document.f.m1_Particella.value = '';
	}
	else
	{
		ComboComune(document.f.m1_TextHidden.value,document.f.m1_Comune,document.f.m1_PR);
	}
}
