function checkAndSubmit()
{
	for (iUsers=0; iUsers<users.length; iUsers++)
	{
		if ((document.forms[0].username.value==users[iUsers]) && (document.forms[0].password.value==pwd[iUsers]))
		{
			// OK: elemento trovato --> aprire la pagina indice
			window.location.href = 'arcieri/' + users[iUsers] + '.htm';
/*			
			switch(iUsers)
			{
				case 0:
					window.location.href = 'arcieri/' + users[iUsers] + '.htm';
				break;
				case 1:
					window.location.href = 'arcieri/albanese.htm';
					break;
				case 2:
					window.location.href = 'arcieri/colafigli.htm';
					break;
				case 3:
					window.location.href = 'arcieri/demidi.htm';
					break;
				case 4:
					window.location.href = 'arcieri/dandrea.htm';
					break;
				case 5:
					window.location.href = 'arcieri/dore.htm';
					break;
				case 6:
					window.location.href = 'arcieri/ficini_d.htm';
					break;
				case 7:
					window.location.href = 'arcieri/ficini_o.htm';
					break;
				case 8:
					window.location.href = 'arcieri/marcheggiani.htm';
					break;
				case 9:
					window.location.href = 'arcieri/mattei.htm';
					break;
				case 10:
					window.location.href = 'arcieri/miconi.htm';
					break;
				case 11:
					window.location.href = 'arcieri/palucci.htm';
					break;
				case 12:
					window.location.href = 'arcieri/scotti.htm';
					break;
				case 13:
					window.location.href = 'arcieri/sonaglia.htm';
					break;
				case 14:
					window.location.href = 'arcieri/veschini.htm';
					break;
				case 15:
					window.location.href = 'arcieri/zorzetto.htm';
					break;
			}
*/			
//					window.location.href = 'res.htm';
			break;
		}

	}
}

function checkName()
{
	for (iUsers=0; iUsers<users.length; iUsers++)
	{
		if ((document.forms[0].username.value==users[iUsers]) && (document.forms[0].password.value==pwd[iUsers]))
		{
			window.location.href = 'arcieri/arciere.htm?id=' + iUsers;	
			break;
		}
	}	
}


function Modulo() 
{   
	var arciere = document.modulo.arciere.value;
	var gara = document.modulo.gara.value;
	var data = document.modulo.giorno.value + "/" + document.modulo.mese.value + "/" + document.modulo.anno.value;
	var turno = document.modulo.turno.value;
	var divisione = document.modulo.divisione.value;
	var classe = document.modulo.classe.value;
	var classe_gara = document.modulo.classe_gara.value;
	var categoria= document.modulo.categoria.value;
	var txt;
	
	var bError = false;
	
	if ((arciere == "") || (arciere == "undefined")) 
	{
		alert("Il campo arciere è obbligatorio.");
		document.modulo.arciere.focus();
		bError = true;
	} 
	else
		txt = "arciere: " + arciere + " --- ";

	if ((gara == "") || (gara == "undefined")) 
	{
		alert("Il campo gara è obbligatorio.");
		document.modulo.gara.focus();
		bError = true;
	} 
		txt += "gara: " + gara + " --- ";
	
	if ((data == "") || (data == "undefined")) 
	{
		alert("Il campo data è obbligatorio.");
		document.modulo.data.focus();
		bError = true;
	} 
		txt += "data: " + data + " --- ";
	
	if ((turno == "") || (turno == "undefined")) 
	{
		alert("Il campo turno è obbligatorio.");
		document.modulo.turno.focus();
		bError = true;
	} 
		txt += "turno: " + turno + " --- ";

	if ((divisione == "") || (divisione == "undefined")) 
	{
		alert("Il campo divisione è obbligatorio.");
		document.modulo.divisione.focus();
		bError = true;
	} 
		txt += "divisione: " + divisione + " --- ";

	if ((classe == "") || (classe == "undefined")) 
	{
		alert("Il campo classe è obbligatorio.");
		document.modulo.classe.focus();
		bError = true;
	} 
		txt += "classe: " + classe + " --- ";

	if ((classe_gara == "") || (classe_gara == "undefined")) 
	{
		alert("Il campo classe_gara è obbligatorio.");
		document.modulo.classe_gara.focus();
		bError = true;
	} 
		txt += "classe_gara: " + classe_gara + " --- ";

	if ((categoria == "") || (categoria == "undefined")) 
	{
		alert("Il campo categoria è obbligatorio.");
		document.modulo.categoria.focus();
		bError = true;
	} 
		txt += "categoria: " + categoria + " --- ";

		
	if (!bError)
	{
//		txt +=  "messaggio: " + testo;		
		location.href = "mailto:mapaluc@tin.it" + "?Subject=Richiesta Iscrizione Gara&Body=" + txt;
	}		
	else				
		txt = "";
} 

