function messaggio(txt) {
	alert("Campo obbligatorio mancante.\nE' necessario inserire il campo '"+txt+"'");
}

function conferma() {

	var agree=confirm("Sei sicuro di voler continuare?");
	if (agree)
		return true ;
	else
		return false ;
}

function tavola(obj) {

	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Testo
	if (obj.testo.value=='') {
		messaggio("Testo");
		return false;
	}
}

function album(obj) {

	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}

function associazione(obj) {

	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}

function pagina(obj) {

	//Test Titolo
	if (obj.titolo.value=='') {
		messaggio("Titolo");
		return false;
	}
}

function paginapdf(obj) {

	//Test Titolo
	if (obj.titolo.value=='') {
		messaggio("Titolo");
		return false;
	}
}

function atto(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Oggetto
	if (obj.oggetto.value=='') {
		messaggio("Oggetto");
		return false;
	}
	
	//Test Numero
	if (obj.numero.value=='') {
		messaggio("Numero");
		return false;
	}
	//Test Giorno
	if (obj.giorno.value=='') {
		messaggio("Giorno");
		return false;
	} else {
		if (obj.giorno.value.length != 2 || obj.giorno.value > 31) {
			alert("Campo errato:\nil giorno e' un numero di due cifre\ncompreso tra 01 e 31");
			return false;
		}
	}
	//Test Mese
	if (obj.mese.value=='') {
		messaggio("Mese");
		return false;
	} else {
		if (obj.mese.value.length != 2 || obj.mese.value > 12) {
			alert("Campo errato:\nil mese e' un numero di due cifre\ncompreso tra 01 e 12");
			return false;
		}
	}
	
	//Test Anno
	if (obj.anno.value=='') {
		messaggio("Anno");
		return false;
	} else {
		if (obj.anno.value.length != 4) {
			alert("Campo errato:\nl'anno e' un numero di quattro cifre");
			return false;
		}
	}
}

function bando(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Oggetto
	if (obj.oggetto.value=='') {
		messaggio("Oggetto");
		return false;
	}
	//Test Data Attivazione
	if (obj.data_attivazione.value=='') {
		messaggio("Data Attivazione");
		return false;
	}
	//Test Data Scadenza
	if (obj.data_scadenza.value=='') {
		messaggio("Data Scadenza");
		return false;
	}
}

function foto(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	
	//Test Ordine
	if (obj.ordine.value=='') {
		messaggio("Ordine");
		return false;
	}
}

function modfoto(obj)
{
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}

function galleria(obj)
{
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Testo
	if (obj.testo.value=='') {
		messaggio("Testo");
		return false;
	}
}

function bando(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Titolo
	if (obj.titolo.value=='') {
		messaggio("Testo");
		return false;
	}
	//Test Testo
	if (obj.testo.value=='') {
		messaggio("Testo");
		return false;
	}
}

function checkfile(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Descrizione
	if (obj.descrizione.value=='') {
		messaggio("Descrizione");
		return false;
	}
}

function prgc(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}

function pubblicazione(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Titolo
	if (obj.titolo.value=='') {
		messaggio("Titolo");
		return false;
	}
}

function sindaco(obj)
{
	//Test File
	if (obj.file.value=='') {
		messaggio("File");
		return false;
	}
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}

function attivita(obj)
{
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
}



function delgroups() {

	var agree=confirm("Sei sicuro di voler continuare?\nVerranno cancellati anche tutti\ni documenti del gruppo.");
	if (agree)
		return true ;
	else
		return false ;
}

function ufficio(obj)
{
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
		
	} else {
		if (obj.nome.value.indexOf('/',0) != -1) {
			alert("Carattere non valido nel campo Gruppo");
			return false;
		}
		if (obj.nome.value.indexOf('\\',0) != -1) {
			alert("Carattere non valido nel campo Gruppo");
			return false;
		}
		if (obj.nome.value.indexOf('@',0) != -1) {
			alert("Carattere non valido nel campo Gruppo");
			return false;
		}
		if (obj.nome.value.indexOf('|',0) != -1) {
			alert("Carattere non valido nel campo Gruppo");
			return false;
		}
	}
	//Test Telefono
	if (obj.telefono.value=='') {
		messaggio("Telefono");
		return false;
	}
	//Test Fax
	if (obj.fax.value=='') {
		messaggio("Fax");
		return false;
	}
}

function valnomail(obj)
{
	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Cognome
	if (obj.cognome.value=='') {
		messaggio("Cognome");
		return false;
	}
	
	//Test Username
	if (obj.nocache_username.value=='') {
		messaggio("Username");
		return false;
	}
	
	//Test Password
	if (obj.nocache_password.value=='') {
		messaggio("Password");
		return false;
	}
	
	//Test Password
	if (obj.nocache_password.value!=obj.password.value) {
		alert("Le due password non coincidono");
		return false;
	}
}

function validate(obj)
{

	//Test Nome
	if (obj.nome.value=='') {
		messaggio("Nome");
		return false;
	}
	//Test Cognome
	if (obj.cognome.value=='') {
		messaggio("Cognome");
		return false;
	}
	
	//Test Email
	if (obj.email.value=='') {
		messaggio("Email");
		return false;
	}
	
	//Test Username
	if (obj.nocache_username.value=='') {
		messaggio("Username");
		return false;
	}
	
	//Test Password
	if (obj.nocache_password.value=='') {
		messaggio("Password");
		return false;
	}
	
	//Test Password
	if (obj.nocache_password.value!=obj.password.value) {
		alert("Le due password non coincidono");
		return false;
	}
	
	if (obj.id_ufficio.selectedIndex == 0) {
		if (obj.gruppo.value=='') {
			messaggio("Gruppo");
			return false;
		}
	}
}