//-----------------------------------------------------------------------------------------------------------
//--- FUNZIONI JS PER SITO SINS
//--- 
//--- Author: eTT s.r.l. - UG
//--- Edited: 30 July 2003
//---
//--- INDICE
//--- firstExample(parOne, parTwo): descrizione [UG, 30 July 2003]
//--- secondExample(): descrizione [UG, 30 July 2003]

//--- 	Indietro(): funzione per tornalre alla pagina precedente [UG, 30 July 2003]
//--- 	ApriFinestra(url, nome, opzioni): funzione per aprire una nuova finestra  
//--	url: nome file della finestra da aprire, nome: nome della finestra, opzioni: opzioni nuova finestra (es. width, height, ecc.) [UG, 30 July 2003]
//--- 	ChiudiFinestra(): funzione per chiudere una finestra [UG, 30 July 2003]
//--- 	StampaPagina(): funzione per la stampa della pagina corrente [UG, 30 July 2003]
//--- 	CheckAndSubmitElencoSociForm(): controlli per form di invio mail (modifica dati soci) e richiamo della pagina ElencoSociFormSubmit.asp per invio della mail [UG, 30 July 2003]
//--- 	ResetElencoSociForm(): funzione per la cancellazione delle text area del form invia mail (elenco soci)[UG, 30 July 2003]
//-----------------------------------------------------------------------------------------------------------

//--- 	Indietro(): funzione per tornalre alla pagina precedente [UG, 30 July 2003]
function Indietro()
{
	history.go(-1);
}

//--- 	ApriFinestra(url, nome, opzioni): funzione per aprire una nuova finestra  
//--	url: nome file della finestra da aprire, nome: nome della finestra, opzioni: opzioni nuova finestra (es. width, height, ecc.) [UG, 30 July 2003]
function ApriFinestra(url, nome, opzioni)
{
	window.open(url, nome, opzioni);
}

//--- 	ChiudiFinestra(): funzione per chiudere una finestra [UG, 30 July 2003]
function ChiudiFinestra()
{
	window.close();
}

//--- 	StampaPagina(): funzione per la stampa della pagina corrente [UG, 30 July 2003]
function StampaPagina()
{
	window.print();
}

//--- 	CheckAndSubmitElencoSociForm(): controlli per form di invio mail (modifica dati soci) e 
//---	richiamo della pagina ElencoSociFormSubmit.asp per invio della mail [UG, 30 July 2003]
function CheckAndSubmitElencoSociForm()
{
	if (theForm.txtNome.value == "") 
	{
		alert("Il campo 'Nome' non è stato compilato\n");
		theForm.txtNome.focus();
		return;
	}

	if (theForm.txtCognome.value == "") 
	{
		alert("Il campo 'Cognome' non è stato compilato\n");
		theForm.txtCognome.focus();
		return;
	}

	if (theForm.txtDipartimento.value == "") 
	{
		alert("Il campo 'Dipartimento' non è stato compilato\n");
		theForm.txtDipartimento.focus();
		return;
	}

	if (theForm.txtIstituto.value == "") 
	{
		alert("Il campo 'Università / Ente / Azienda' non è stato compilato\n");
		theForm.txtIstituto.focus();
		return;
	}

	if (theForm.txtIndirizzo.value == "") 
	{
		alert("Il campo 'Indirizzo' non è stato compilato\n");
		theForm.txtIndirizzo.focus();
		return;
	}

	if (theForm.txtCap.value == "")
	{
		alert("Il campo 'CAP' non è stato compilato\n");
		theForm.txtCap.focus();
		return;
	}

	if (theForm.txtCitta.value == "") 
	{
		alert("Il campo 'Città' non è stato compilato\n");
		theForm.txtCitta.focus();
		return;
	}

	if (theForm.txtNazione.value == "") 
	{
		alert("Il campo 'Nazione' non è stato compilato\n");
		theForm.txtNazione.focus();
		return;
	}
		
	if (theForm.txtTelefono.value == "") 
	{
		alert("Il campo 'Telefono' non è stato compilato\n");
		theForm.txtTelefono.focus();
		return;
	}

	if (theForm.txtFax.value == "") 
	{
		alert("Il campo 'Fax' non è stato compilato\n");
		theForm.txtFax.focus();
		return;
	}

	if (theForm.txtEMail.value == "") 
	{
		alert("Il campo 'Indirizzo E-Mail' non è stato compilato\n");
		theForm.txtEMail.focus();
		return;
	}

	// CAMPI COMPILATI
	theForm.action = "ElencoSociFormSubmit.asp";
	theForm.submit();
}

//--- 	ResetElencoSociForm(): funzione per la cancellazione delle text area del form invia mail (elenco soci)[UG, 30 July 2003]
function ResetElencoSociForm()
{
	theForm.txtNome.value = "";
	theForm.txtCognome.value = "";
	theForm.txtDipartimento.value = "";
	theForm.txtIstituto.value = "";
	theForm.txtIndirizzo.value = "";
	theForm.txtCap.value = "";
	theForm.txtCitta.value = "";
	theForm.txtNazione.value = "";
	theForm.txtTelefono.value = "";
	theForm.txtFax.value = "";
	theForm.txtEMail.value = "";
}

//--- 	check_login(): controllo accesso [UG, 28 July 2006]
function check_login()
{
	theForm = document.loginForm
	
	if (theForm.txtUsername.value == "")
	{
		alert("Il campo 'Username' non è stato compilato\n");
		theForm.txtUsername.focus();
		return;
	}

	if (theForm.txtPassword.value == "")
	{
		alert("Il campo 'Password' non è stato compilato\n");
		theForm.txtPassword.focus();
		return;
	}

	// CAMPI COMPILATI
	theForm.submit();

	theForm.txtUsername.disabled = true;
	theForm.txtPassword.disabled = true;	
	theForm.btnAccedi.disabled = true;

}


function check_modificaSocio()
{
	if (theForm.txtUsername.value == "") 
	{
		alert("Il campo 'Username' non è stato compilato\n");
		theForm.txtUsername.focus();
		return;
	}

	if (theForm.txtPassword.value == "") 
	{
		alert("Il campo 'Password' non è stato compilato\n");
		theForm.txtPassword.focus();
		return;
	}
	
	if (theForm.txtIdSins.value == "" || isNaN(theForm.txtIdSins.value)) 
	{
		alert("Il campo 'Id' non è stato compilato in modo corretto\n");
		theForm.txtIdSins.focus();
		return;
	}

	if (theForm.txtTitolo.value == "") 
	{
		alert("Il campo 'Titolo' non è stato compilato\n");
		theForm.txtTitolo.focus();
		return;
	}
	
	if (theForm.txtNome.value == "") 
	{
		alert("Il campo 'Nome' non è stato compilato\n");
		theForm.txtNome.focus();
		return;
	}
	
	if (theForm.txtCognome.value == "") 
	{
		alert("Il campo 'Cognome' non è stato compilato\n");
		theForm.txtCognome.focus();
		return;
	}
	
	if (theForm.txtDipartimento.value == "") 
	{
		alert("Il campo 'Dipartimento' non è stato compilato\n");
		theForm.txtDipartimento.focus();
		return;
	}
	if (theForm.txtIstituto.value == "") 
	{
		alert("Il campo 'Università/Ente/Azienda' non è stato compilato\n");
		theForm.txtIstituto.focus();
		return;
	}
	if (theForm.txtIndirizzo.value == "") 
	{
		alert("Il campo 'Indirizzo' non è stato compilato\n");
		theForm.txtIndirizzo.focus();
		return;
	}
	if (theForm.txtCap.value == "") 
	{
		alert("Il campo 'Cap' non è stato compilato\n");
		theForm.txtCap.focus();
		return;
	}
	if (theForm.txtCitta.value == "") 
	{
		alert("Il campo 'Citta' non è stato compilato\n");
		theForm.txtCitta.focus();
		return;
	}
	if (theForm.txtNazione.value == "") 
	{
		alert("Il campo 'Nazione' non è stato compilato\n");
		theForm.txtNazione.focus();
		return;
	}
	if (theForm.txtTelefono.value == "") 
	{
		alert("Il campo 'Telefono' non è stato compilato\n");
		theForm.txtTelefono.focus();
		return;
	}
	if (theForm.txtFax.value == "") 
	{
		alert("Il campo 'Fax' non è stato compilato\n");
		theForm.txtFax.focus();
		return;
	}
	if (theForm.txtEMail.value == "") 
	{
		alert("Il campo 'Indirizzo E-Mail' non è stato compilato\n");
		theForm.txtEMail.focus();
		return;
	}

	// CAMPI COMPILATI
	theForm.submit();

	theForm.btnReset.disabled = true;
	theForm.btnSalva.disabled = true;
}

function check_cercaSocio()
{
	if (theForm.txtCognome.value == "") 
	{
		alert("Il campo 'Cognome' non è stato compilato\n");
		theForm.txtCognome.focus();
		return;
	}
	// CAMPI COMPILATI
	theForm.submit();
	theForm.btnCerca.disabled = true;
}

function confirmSocioAction(idType, idSocio)
{
	//--- Controlli superati	
	if (confirm("Attenzione: \n\nSei sicuro di voler procedere?"))
	{		
		window.location.href = "modificaSocio_04.asp?id="+ idSocio +"&idType="+  idType;
	}	
}
