//
// $Id$
// $Log$
//
// Function checkfm().
//
// La funzione verifica che i campi di input di tipo TEXT o TEXTAREA marcati come richiesti non siano 
// vuoti.
// Vuole in ingresso l'oggetto form
//
function checkfm(fm)
{
	var j = 0, e = "";
	var msg = "";
	for (j=0; j<fm.length; j++)
	{
		e = fm.elements[j];
		if (e.required)
		{
			switch (e.type)
			{
				case 'text':
				case 'hidden':
				case 'file':
				case 'password':
				case 'textarea':
					if (e.value.match(/^\s*$/))
					{
						msg += e.name + "\n";		
					}
					break;
				case 'select':
					if (e.selectedIndex == 0)
					{
						msg += e.name + "\n";		
					}
					break;
				default:
					break;
			}
		}				
	}
	if (msg)
	{
		msg = "_____________\n\n  ATTENZIONE\n _____________\n\nI seguenti campi sono obbligatori:\n\n" + msg;
		alert (msg);
		return false;
	}
	else
	{
		return true;
	}
}
