// Questa funzione mostra e nasconde i menu della barra di navigazione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 verifica se l'indirizzo di posta elettronica passato come// parametro è validofunction isEmail (s){	if (s == "")	return false;		// controlla se è uno spazio	if (s == " ") return false;		// ci deve essere almeno 1 carattere prima del carattere "@"	// così la ricerca parte dalla posizione 1 della stringa (cioè il secondo carattere)	var i = 1;	var sLength = s.length;		// cerca il carattere "@"	while ((i < sLength) && (s.charAt(i) != "@"))	{ i++	}		if ((i >= sLength) || (s.charAt(i) != "@")) return false;	else i += 2;	// cerca il carattere "."	while ((i < sLength) && (s.charAt(i) != "."))	{ i++	}		// ci devono essere almeno due caratteri dopo il "." per indicare il dominio di primo livello	if ((i >= sLength - 2) || (s.charAt(i) != ".")) return false;	else return true;}// fine isEmail// Questa funzione controlla i dati inseriti dall'utente nel modulo prima di spedirlofunction controllaContatti(){	if (!isEmail(document.forms["contatti"].email.value))	{		alert("You have not inserted your e-mail!");		document.forms["contatti"].email.focus();		return (false);	}	if (document.forms["contatti"].nome.value == "")	{		alert("You have not inserted your name!");		document.forms["contatti"].nome.focus();		return (false);	}	if (document.forms["contatti"].cognome.value == "")	{		alert("You have not inserted your surname!");		document.forms["contatti"].cognome.focus();		return (false);	}	if (document.forms["contatti"].messaggio.value == "")	{		alert("You have not inserted the text of message!");		document.forms["contatti"].messaggio.focus();		return (false);	}	else	{		// Copia l'indirizzo del mittente in un campo nascosto		document.forms["contatti"].postamittente.value = document.forms["contatti"].email.value;		return (true);	}}// fine controllaContatti// Questa funzione estrae l'ultima parte da un pathname che rappresenta il nome del file inviato// dall'utentefunction estraiNomeFile (theFilePathname){	// Esempio del pathname	// /Users/matteo/Desktop/Nome del documento.doc		// calcola la fine della stringa	finishChar = theFilePathname.length;		// trova l'ultima slash della stringa	startChar = theFilePathname.lastIndexOf("/");		// estrae la parte finale della stringa	myFileName = theFilePathname.substring(startChar + 1, finishChar);		return (myFileName);}// fine estraiNomeFile// Questa funzione controlla i dati inseriti dall'utente nel modulo prima di spedirlofunction controllaIscrizione(){	if (!isEmail(document.forms["iscrizione"].email.value))	{		alert("You have not inserted your e-mail!");		document.forms["iscrizione"].email.focus();		return (false);	}	if (document.forms["iscrizione"].nome.value == "")	{		alert("You have not inserted your name!");		document.forms["iscrizione"].nome.focus();		return (false);	}	if (document.forms["iscrizione"].cognome.value == "")	{		alert("You have not inserted your surname!");		document.forms["iscrizione"].cognome.focus();		return (false);	}	if (document.forms["iscrizione"].laurea.value == "")	{		alert("You have not inserted your degree!");		document.forms["iscrizione"].laurea.focus();		return (false);	}	if (document.forms["iscrizione"].recapito.value == "")	{		alert("You have not inserted your address!");		document.forms["iscrizione"].recapito.focus();		return (false);	}	if (document.forms["iscrizione"].cap.value == "")	{		alert("You have not inserted your postal code (ZIP)!");		document.forms["iscrizione"].cap.focus();		return (false);	}	if (document.forms["iscrizione"].citta.value == "")	{		alert("You have not inserted your town!");		document.forms["iscrizione"].citta.focus();		return (false);	}	if (document.forms["iscrizione"].provincia.value == "")	{		alert("You have not inserted your province!");		document.forms["iscrizione"].provincia.focus();		return (false);	}	if (document.forms["iscrizione"].stato.value == "")	{		alert("You have not inserted your country!");		document.forms["iscrizione"].stato.focus();		return (false);	}	if (document.forms["iscrizione"].telefono.value == "")	{		alert("You have not inserted your telephone number!");		document.forms["iscrizione"].telefono.focus();		return (false);	}		if (document.forms["iscrizione"].comeconosciuto.value == "Scegli una voce")	{		alert("You have not selected an item!");		document.forms["iscrizione"].comeconosciuto.focus();		return (false);	}	if ((document.forms["iscrizione"].comeconosciuto.value == "Giornali") && (document.forms["iscrizione"].altrocomeconosciuto.value == ""))	{		alert("Please insert the name of newspaper!");		document.forms["iscrizione"].altrocomeconosciuto.focus();		return (false);	}	if ((document.forms["iscrizione"].comeconosciuto.value == "Altri siti") && (document.forms["iscrizione"].altrocomeconosciuto.value == ""))	{		alert("Please insert the name of site!");		document.forms["iscrizione"].altrocomeconosciuto.focus();		return (false);	}	if ((document.forms["iscrizione"].comeconosciuto.value == "Fiera") && (document.forms["iscrizione"].altrocomeconosciuto.value == ""))	{		alert("Please insert the name of exhibition!");		document.forms["iscrizione"].altrocomeconosciuto.focus();		return (false);	}	if ((document.forms["iscrizione"].comeconosciuto.value == "Pubblicazioni") && (document.forms["iscrizione"].altrocomeconosciuto.value == ""))	{		alert("Please insert the name of magazine!");		document.forms["iscrizione"].altrocomeconosciuto.focus();		return (false);	}		if (document.forms["iscrizione"].thefile.value == "")	{		alert("You have not choosen the document of the curriculum!");		document.forms["iscrizione"].thefile.focus();		return (false);	}	else	{		// Copia il link per scaricare il file del curriculum in un campo nascosto		document.forms["iscrizione"].nomefile.value = estraiNomeFile(document.forms["iscrizione"].thefile.value);				return (true);	}}// fine controllaIscrizione// Questa funzione verifica la form della password prima di accedere all'area riservatafunction controllaModuloAreaRiservata (){	if (document.forms["moduloAreaRiservata"].parolasegreta.value == "")	{		alert("You have not inserted the password!");		return (false);	}		return (true);}// fine controllaModuloAreaRiservata// Funzione per il caricamento di una fotofunction loadPhoto (thePhotoNum, theGallery){	var myImage = new Image(320,240);	if (thePhotoNum <= 9)	{		myImage.src = "FotoGalleria" + "/foto_0" + thePhotoNum + ".jpg";	}	else	{		myImage.src = "FotoGalleria" + "/foto_" + thePhotoNum + ".jpg";	}		document.images["fotoGalleria" + theGallery].src = myImage.src;}// fine loadPhoto// Funzione per il caricamento di una foto dei campusfunction loadPhotoCampus (thePhotoNum, theGallery){	var myImage = new Image(320,240);	if (thePhotoNum <= 9)	{		myImage.src = "Foto" + theGallery + "/foto_0" + thePhotoNum + ".jpg";	}	else	{		myImage.src = "Foto" + theGallery + "/foto_" + thePhotoNum + ".jpg";	}		document.images["foto" + theGallery].src = myImage.src;}// fine loadPhotoCampus// Questa funzione apre una finestra popup con un bannerfunction popupWindow (){	myPage = "popupwindow_ing.htm";		myWind = window.open(myPage, "Avviso", "toolbar=no,directories=no,menubar=no,scrollbars=no,width=420,height=140");}// fine popupWindow