// Questa funzione mostra e nasconde i menu della barra di navigazione
window.onload=showMenu;
function showMenu(id)
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++)
	{
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}
//	fine showMenu


// Questa funzione apre una finestra popup con la biografia di un docente
function apriBiografia (theDocente)
{
	myPage = "Docenti/" + theDocente + "_ita.htm";
	
	myWind = window.open(myPage, "Biografia", "toolbar=no,directories=no,menubar=no,scrollbars=yes,width=540,height=400");
}
// fine apriBiografia


// Questa funzione riporta true se la form riempita dall'utente è valida
function controllaFormPreiscrizioneLB (theForm)
{
	if (theForm.nome.value == "")
	{
		alert("Lo sentimos! \n\nEl nombre introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.nome.focus();
		return (false);
	}
	
	if (theForm.cognome.value == "")
	{
		alert("Lo sentimos! \n\nEl apellidos introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.cognome.focus();
		return (false);
	}
	
	if (theForm.cittadinanza.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudadania introducida no es valida, por favor, inserirla de nuevo.");
		theForm.cittadinanza.focus();
		return (false);
	}
	
	if (theForm.luogodinascita.value == "")
	{
		alert("Lo sentimos! \n\nEl lugar de nacimiento introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.luogodinascita.focus();
		return (false);
	}
	
	if ((theForm.nascitagiorno.value == "") || (theForm.nascitamese.value == "") || (theForm.nascitaanno.value == ""))
	{
		alert("Lo sentimos! \n\nLa fecha de nacimiento introducida no es valida, por favor, inserirla de nuevo.");
		theForm.nascitagiorno.focus();
		return (false);
	}
	
	if ((theForm.email.value == "") || (theForm.email.value.length < 5) || (theForm.email.value.indexOf("@") == -1))
	{
		alert("Lo sentimos! \n\nEl correo electronico introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.email.focus();
		return (false);
	}
	
	if (theForm.via.value == "")
	{
		alert("Lo sentimos! \n\nLa direccion introducida no es valida, por favor, inserirla de nuevo.");
		theForm.via.focus();
		return (false);
	}
	
	if (theForm.cap.value == "")
	{
		alert("Lo sentimos! \n\nEl pac introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.cap.focus();
		return (false);
	}
	
	if (theForm.citta.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudad introducida no es valida, por favor, inserirla de nuevo.");
		theForm.citta.focus();
		return (false);
	}
	
	if (theForm.provincia.value == "")
	{
		alert("Lo sentimos! \n\nLa provincia introducida no es valida, por favor, inserirla de nuevo.");
		theForm.provincia.focus();
		return (false);
	}
	
	if (theForm.stato.value == "")
	{
		alert("Lo sentimos! \n\nEl estado introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.stato.focus();
		return (false);
	}
	
	if (theForm.telefono.value == "")
	{
		alert("Lo sentimos! \n\nEl telefono introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.telefono.focus();
		return (false);
	}
	
	
	if (theForm.titolostudiodenominazione.value == "")
	{
		alert("Lo sentimos! \n\nLa denominacion del diploma introducido no es valida, por favor, inserirla de nuevo.");
		theForm.titolostudiodenominazione.focus();
		return (false);
	}
	
	if (theForm.titolostudioistituto.value == "")
	{
		alert("Lo sentimos! \n\nEl nombre de la escuela introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.titolostudioistituto.focus();
		return (false);
	}
	
	if (theForm.titolostudioanno.value == "")
	{
		alert("Lo sentimos! \n\nEl ano del titulo introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.titolostudioanno.focus();
		return (false);
	}
	
	if (theForm.titolostudiocitta.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudad de la escuela introducida no es valida, por favor, inserirla de nuevo.");
		theForm.titolostudiocitta.focus();
		return (false);
	}
	
	if (theForm.titolostudioprovincia.value == "")
	{
		alert("Lo sentimos! \n\nLa provincia de la escuela introducida no es valida, por favor, inserirla de nuevo.");
		theForm.titolostudioprovincia.focus();
		return (false);
	}
	
	if (theForm.titolostudiostato.value == "")
	{
		alert("Lo sentimos! \n\nEl estado de la escuela introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.titolostudiostato.focus();
		return (false);
	}
	
	theForm.emailmittente.value = theForm.email.value;
	theForm.nomemittente.value = theForm.nome.value;
	theForm.cognomemittente.value = theForm.cognome.value;
	theForm.indirizzo.value = "chiara.nicolai@fondazionecampus.it,marco.terranova@fondazionecampus.it,info@matteovarisco.com";
	theForm.subject.value = "Modulo Preiscrizione Triennale Campus Lucca Spagnolo";
	
	// Se ha passato tutti i controlli allora convalida la form
	return (true);
}
// fine controllaFormPreiscrizioneLB


// Questa funzione riporta true se la form riempita dall'utente è valida
function controllaFormPreiscrizioneLS (theForm)
{
	if (theForm.nome.value == "")
	{
		alert("Lo sentimos! \n\nEl nombre introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.nome.focus();
		return (false);
	}
	
	if (theForm.cognome.value == "")
	{
		alert("Lo sentimos! \n\nEl apellidos introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.cognome.focus();
		return (false);
	}
	
	if (theForm.cittadinanza.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudadania introducida no es valida, por favor, inserirla de nuevo.");
		theForm.cittadinanza.focus();
		return (false);
	}
	
	if (theForm.luogodinascita.value == "")
	{
		alert("Lo sentimos! \n\nEl lugar de nacimiento introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.luogodinascita.focus();
		return (false);
	}
	
	if ((theForm.nascitagiorno.value == "") || (theForm.nascitamese.value == "") || (theForm.nascitaanno.value == ""))
	{
		alert("Lo sentimos! \n\nLa fecha de nacimiento introducida no es valida, por favor, inserirla de nuevo");
		theForm.nascitagiorno.focus();
		return (false);
	}
	
	if ((theForm.email.value == "") || (theForm.email.value.length < 5) || (theForm.email.value.indexOf("@") == -1))
	{
		alert("Lo sentimos! \n\nEl correo electronico introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.email.focus();
		return (false);
	}
	
	
	if (theForm.via.value == "")
	{
		alert("Lo sentimos! \n\nLa direccion introducida no es valida, por favor, inserirla de nuevo.");
		theForm.via.focus();
		return (false);
	}
	
	if (theForm.cap.value == "")
	{
		alert("Lo sentimos! \n\nEl pac introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.cap.focus();
		return (false);
	}
	
	if (theForm.citta.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudad introducida no es valida, por favor, inserirla de nuevo.");
		theForm.citta.focus();
		return (false);
	}
	
	if (theForm.provincia.value == "")
	{
		alert("Lo sentimos! \n\nLa provincia introducida no es valida, por favor, inserirla de nuevo.");
		theForm.provincia.focus();
		return (false);
	}
	
	if (theForm.stato.value == "")
	{
		alert("Lo sentimos! \n\nEl estado introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.stato.focus();
		return (false);
	}
	
	if (theForm.telefono.value == "")
	{
		alert("Lo sentimos! \n\nEl telefono introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.telefono.focus();
		return (false);
	}
	
	
	if (theForm.corsodilaurea.value == "")
	{
		alert("Lo sentimos! \n\nLa denominacion de la licenciatura introducida no es valida, por favor, inserirla de nuevo.");
		theForm.corsodilaurea.focus();
		return (false);
	}
	
	if (theForm.annoaccademico.value == "")
	{
		alert("Lo sentimos! \n\nEl ano de la licenciatura introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.annoaccademico.focus();
		return (false);
	}
	
	if (theForm.universita.value == "")
	{
		alert("Lo sentimos! \n\nLa ciudad de la universidad introducida no es valida, por favor, inserirla de nuevo.");
		theForm.universita.focus();
		return (false);
	}
	
	if (theForm.universitastato.value == "")
	{
		alert("Lo sentimos! \n\nEl estado de la universidad introducido no es valido, por favor, inserirlo de nuevo.");
		theForm.universitastato.focus();
		return (false);
	}
	
	theForm.emailmittente.value = theForm.email.value;
	theForm.nomemittente.value = theForm.nome.value;
	theForm.cognomemittente.value = theForm.cognome.value;
	theForm.indirizzo.value = "chiara.nicolai@fondazionecampus.it,marco.terranova@fondazionecampus.it,info@matteovarisco.com";
	theForm.subject.value = "Modulo Preiscrizione Specialistica Campus Lucca Spagnolo";
	
	// Se ha passato tutti i controlli allora convalida la form
	return (true);
}
// fine controllaFormPreiscrizioneLS


// Variabili globali per tenere traccia delle foto caricate
var gCurrentPhotoIndex = 0;
var kMaxPhotos = 20;

var gPhotos = new Array(kMaxPhotos);
gPhotos[0] = "seminario_veduta";
gPhotos[1] = "parco_seminario";
gPhotos[2] = "campo_basket";
gPhotos[3] = "aula_studenti_professore";
gPhotos[4] = "studenti_aula_2";
gPhotos[5] = "studenti_aula";
gPhotos[6] = "studenti";
gPhotos[7] = "studentesse_libro";
gPhotos[8] = "aula_computer_alto";
gPhotos[9] = "studenti_al_computer";
gPhotos[10] = "aula_con_separatori";
gPhotos[11] = "camera_con_vista";
gPhotos[12] = "camera_finestra_aperta";
gPhotos[13] = "ragazzi_e_chitarra";
gPhotos[14] = "biblioteca";
gPhotos[15] = "biblioteca_tavolo";
gPhotos[16] = "caffetteria_campus_1";
gPhotos[17] = "caffetteria_campus_2";
gPhotos[18] = "taglio_torta_campus";
gPhotos[19] = "torta_campus";


// Funzione per il caricamento di una foto
function loadPhoto (thePhotoName)
{
	var myImage = new Image(320,240);
	myImage.src = "Foto/" + thePhotoName + ".jpg";
	
	document.images["foto"].src = myImage.src;
	
	if (thePhotoName == "seminario_veduta")							{	gCurrentPhotoIndex = 0;	}
	else if (thePhotoName == "parco_seminario")						{	gCurrentPhotoIndex = 1;	}
	else if (thePhotoName == "campo_basket")						{	gCurrentPhotoIndex = 2;	}
	else if (thePhotoName == "aula_studenti_professore")			{	gCurrentPhotoIndex = 3;	}
	else if (thePhotoName == "studenti_aula_2")						{	gCurrentPhotoIndex = 4;	}
	else if (thePhotoName == "studenti_aula")						{	gCurrentPhotoIndex = 5;	}
	else if (thePhotoName == "studenti")							{	gCurrentPhotoIndex = 6;	}
	else if (thePhotoName == "studentesse_libro")					{	gCurrentPhotoIndex = 7;	}
	else if (thePhotoName == "aula_computer_alto")					{	gCurrentPhotoIndex = 8;	}
	else if (thePhotoName == "studenti_al_computer")				{	gCurrentPhotoIndex = 9;	}
	else if (thePhotoName == "aula_con_separatori")					{	gCurrentPhotoIndex = 10;	}
	else if (thePhotoName == "camera_con_vista")					{	gCurrentPhotoIndex = 11;	}
	else if (thePhotoName == "camera_finestra_aperta")				{	gCurrentPhotoIndex = 12;	}
	else if (thePhotoName == "ragazzi_e_chitarra")					{	gCurrentPhotoIndex = 13;	}
	else if (thePhotoName == "biblioteca")							{	gCurrentPhotoIndex = 14;	}
	else if (thePhotoName == "biblioteca_tavolo")					{	gCurrentPhotoIndex = 15;	}
	else if (thePhotoName == "caffetteria_campus_1")				{	gCurrentPhotoIndex = 16;	}
	else if (thePhotoName == "caffetteria_campus_2")				{	gCurrentPhotoIndex = 17;	}
	else if (thePhotoName == "taglio_torta_campus")					{	gCurrentPhotoIndex = 18;	}
	else if (thePhotoName == "torta_campus")						{	gCurrentPhotoIndex = 19;	}
	
}
// fine loadPhoto


// Questa funzione carica la foto precedente a quella corrente
function previousPhoto ()
{
	// Decrementa il contatore delle foto
	if (gCurrentPhotoIndex > 0)
	{
		gCurrentPhotoIndex = (gCurrentPhotoIndex - 1);
	}
	else
	{
		gCurrentPhotoIndex = (kMaxPhotos - 1);
	}
	
	// Prende il nome della foto
	var myPhotoName = gPhotos[gCurrentPhotoIndex];
	
	// Richiama la routine che carica la foto
	loadPhoto(myPhotoName);
}
// fine previousPhoto


// Questa funzione carica la foto successiva a quella corrente
function nextPhoto ()
{
	// Decrementa il contatore delle foto
	if (gCurrentPhotoIndex < (kMaxPhotos - 1))
	{
		gCurrentPhotoIndex = (gCurrentPhotoIndex + 1);
	}
	else
	{
		gCurrentPhotoIndex = 0;
	}
	
	// Prende il nome della foto
	var myPhotoName = gPhotos[gCurrentPhotoIndex];
	
	// Richiama la routine che carica la foto
	loadPhoto(myPhotoName);
}
// fine nextPhoto


// Questa funzione apre una finestra popup con un banner
function popupPiantinaForesteria ()
{
	myPage = "popuppiantinaforesteria.htm";
	
	myWind = window.open(myPage, "Foresteria", "toolbar=no,directories=no,menubar=no,scrollbars=no,width=820,height=500");
}
// fine popupPiantinaForesteria

