var tipoRicerca = null

function activateNome()
{
	document.ricerca.tipoRicerca[0].checked = "1";
	document.ricerca.codice.value = "";
	document.ricerca.nome.focus();
}

function activateCodice()
{
	document.ricerca.tipoRicerca[1].checked = "1";
	document.ricerca.descEstesa.checked = null;
	document.ricerca.nome.value = "";
	document.ricerca.codice.focus();
}

function check(varName)
{
	val = document.ricerca[varName].value;
 	if ((""+val == "undefined") || (val == ""))
	{
	   errore = true;
	   errTxt = errTxt + virgola + varName;
   	   virgola = ",";
	}
}

function confirmCerca() 
{
	errore = false;
	virgola = "";
	errTxt = "Il campo in base a cui ricercare (";
	if (document.ricerca.tipoRicerca[0].checked){
		check("nome");
	} else {
		check("codice");
	}
	errTxt = errTxt + ") NON puņ essere vuoto.\nCompleta il modulo ed invialo di nuovo.\nGrazie."
	if (errore)
	{
	   alert(errTxt);
	   errore = false;
	   virgola = "";
	   errTxt = "Non hai inserito nel modulo:\n";
	   return false;
	}
   /*
	*/
	return true;
}


