
/*	File air_nav2.js (please refer to air_nav.js)	*/

/*	Versione del 1/5/05 - 2/5/05 - 8/5/05 - 16/5/05 - 2/7/05 - 9/7/05 - 21/1/06 */
/*	Versione 24/8/06 - 26/9/06 - 3/10/06 - 29/11/06	- 4/12/06 */
/*	Versione del 31/1/2007	- 31/3/2007 - 4/5/07 - 2/6/07 */
/*	Versione del 10/8/08 - 31/8/07 - 24/10/07	- 16/11/07 */
/*	Versione del 16-03-08	*/
/*	Versione del 03-01-2009	- 01-11-09 */

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

var tipo_browser;
var dim_schermo;
var dim_screen;
var dim_finestra;
var dim_window;

tipo_browser = get_browser();	
dim_schermo = get_screen();
dim_screen 	= get_dim_screen(dim_schermo);

dim_finestra = get_dim_finestra();
dim_window   = get_dim_screen(dim_finestra);

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*	Caricamento del CSS in funzione della larghezza della finestra	*/

document.write("<link rel=stylesheet href=../air.css type=text/css>");

if (dim_schermo == "low")  	/* 800 x 600 */
{	document.write("<link rel=stylesheet href=../air_800.css type=text/css>");
} 
else if (dim_schermo == "high") 	/* 1024 x 768 */
{	document.write("<link rel=stylesheet href=../air_1024.css type=text/css>");
} 
else  if (dim_schermo == "large")	/* 1280 x 800 oppure 1024 */
{	document.write("<link rel=stylesheet href=../air_1280.css type=text/css>");
}
else
{	document.write("<link rel=stylesheet href=../air_1400.css type=text/css>");
}

	document.write("<link rel=stylesheet href=../air_print.css type=text/css media=print>");	
	
if (tipo_browser == "mz")
{	document.write("<link rel=stylesheet href=../air_firefox.css type=text/css>");
}

/*      --------------------    */

 

function ResetForm(){
	document.f3.reset();
	riempi_select();
	return true;
}

/*	Menu di navigazione	*/

function riempi_select() {

/*	Menu di navigazione - versione 30/3/2007 - 28/1/09	*/

	var cont_label  = new Array("Contenuti", "Dispense dei corsi", " > digitalizzazione società", " > Chiesa e Internet", " > Web 2.0", " > presenza religiosa", " > aspetti funzionali", " > scelte progettuali", " > presentazione contenuti", "Bibliografia");
	var cont_value = new Array("no_action", "/corsi/index.html", "/corsi/dispensa_1_digitalizzazione.html", "/corsi/dispensa_2_chiesa_internet.html", "/corsi/dispensa_3_web_2.0.html", "/corsi/dispensa_4_presenza_religiosa.html", "/corsi/dispensa_5_aspetti_funzionali.html", "/corsi/dispensa_6_scelte_progettuali.html", "/corsi/dispensa_7_presentazione_contenuti.html", "/corsi/air_bibliografia.html");
 
	var bd_label = new Array("Servizi", "Attività redazionale", "Progettazione siti Web", " > progetto Ufficio Virtuale", " > progetto ESM", " > progetto RDD", " > progetto CDG", " > progetto PUG", " > progetto SOL", " > progetto SRV", " > progetto RBS", " > progetto SRB", "Corsi Joomla 1.5", "Template Joomla", "Seminari", " > Società Informazione", " > Evoluzione del Web", " > Digital divide", " > Presenza religiosa");	
	var bd_value = new Array("no_action","/servizi/air_debanne_attivita_redazionale_it.html", "/servizi/air_debanne_progettazione_realizzazione_siti_it.html", "/servizi/air_debanne_siti_uv.htm", "/servizi/air_debanne_siti_esm.htm", "/servizi/air_debanne_siti_rdd.htm", "/servizi/air_debanne_siti_cdg.htm", "/servizi/air_debanne_siti_pug.htm", "/servizi/air_debanne_siti_sol.htm", "/servizi/air_debanne_siti_srv.htm", "/servizi/air_debanne_siti_RBS.htm", "/servizi/air_debanne_siti_SRB.htm", "/servizi/air_debanne_corsi_joomla_it.html", "/servizi/air_debanne_template_joomla_it.html", "/servizi/air_debanne_seminari.html", "/servizi/air_debanne_seminario_societa_informazione.html", "/servizi/air_debanne_seminario_web.html", "/servizi/air_debanne_seminario_divario_generazionale.html", "/servizi/air_debanne_seminario_chiesa_internet.html");	
 
  	var inter_label  = new Array("Contatta il Webteam", "Contattaci");
	var inter_value = new Array("no_action","/contattaci_ita.htm");	
	
	var ser_label  = new Array("Informazioni","Home Page", "Profilo Xavier Debanne"," > breve CV", " > pubblicazioni", " > relazioni a convegni", "Perché questo sito","Mappa del sito", "Informazioni sul sito");
	var ser_value = new Array("no_action","/index.html","/profilo/index.html","/profilo/air_debanne_cv_it.html", "/profilo/air_debanne_pubblicazioni_it.html", "/profilo/air_debanne_convegni_it.html", "/perche_ita.htm", "/mappa_ita.htm", "/informazioni_ita.htm");

/*	Fine menu di navigazione	*/

	nb_option = cont_label.length;

	for(i=0; i<nb_option; i++)
      	{
		lunghezza = new Option(cont_label[i]);
		position = document.f3.cont.length;
		document.f3.cont.options[position] = lunghezza;
		document.f3.cont.options[position].value = cont_value[i];
      	}

	nb_option = bd_label.length;

	for(i=0; i<nb_option; i++)
      	{
		lunghezza = new Option(bd_label[i]);
		position = document.f3.bd.length;
		document.f3.bd.options[position] = lunghezza;
		document.f3.bd.options[position].value = bd_value[i];
      	}

	nb_option = inter_label.length;

	for(i=0; i<nb_option; i++)
      	{
		lunghezza = new Option(inter_label[i]);
		position = document.f3.inter.length;
		document.f3.inter.options[position] = lunghezza;
		document.f3.inter.options[position].value = inter_value[i];
      	}

	nb_option = ser_label.length;

	for(i=0; i<nb_option; i++)
      	{
		lunghezza = new Option(ser_label[i]);
		position = document.f3.ser.length;
		document.f3.ser.options[position] = lunghezza;
		document.f3.ser.options[position].value = ser_value[i];
      	}
	return true;
}

function Fvai(valore){
	if (valore == "no_action") return true
	else window.location=valore;
	return true;
}

/*	Funzione di validazione utilizzata nei corsi	*/

function test_commento() {
	var commento = document.f_corso_1.commento.value;
	var email = document.f_corso_1.address.value;
	var lgco = commento.length;
	var lgem = email.length;

/*	Il campo commento non può essere vuto	*/

	if (lgco  == 0)	
	{	alert("Il campo 'Commento' deve essere riempito!"); 
		document.f_corso_1.commento.focus();
		return false; }

/*	La campo e-mail può essere vuoto; se riempito, deve essere valido	*/

	if (lgem > 0)
	{	if ((email.indexOf("@") == -1) |
		(email.indexOf(".") == -1) |
		(email.length < 7))
		{	alert("Il campo 'E-MAIL' non è valido"); 
			document.f_corso_1.address.focus();
			return false; 
		}
	}
	
	document.f_corso_1.submit();
	return true;
}

function reset_commento() {

	document.f_corso_1.reset();
	document.f_corso_1.commento.focus();
	
	return true;
}

/*      --------------------------------------------------------	*/
/*			Menu dei contenuti extra			*/
/*      --------------------------------------------------------	*/

function menu_contenuti_extra (lang)  {

	document.write("<div id='contenuti_extra'>");
	
    	if (lang == "it")
    	{	

		document.write("<a href='#'><b>Per saperne di più:</b></a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Seminario sulla società dell'informazione</a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Articoli disponibili in rete</a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Articoli della rivista La Civiltà Cattolica</a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Corso online di approfondimento</a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;24-8-06 | pippo pluto paperino</a>");

		document.write("<a href='#' onclick='alert(\"Non ancora attivo\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;7-5-06 | pippo pluto paperino</a>");

		document.write("<a href='#'>Per andare alla prima immagine dell'archivio</a>");
		
		document.write("<a href='#'>Per inviare una fotografia al Web Team per la sua pubblicazione</a>");

	} else
	alert("Error function menu_contenuti_extra");
	
    	document.write("</div>");
	
	return true;
}

/*	La funzione inserisce un back-slash davanti ai caratteri:	*/
/*	(, ), [, ], ", $, ?, ^, |, !, \ */

function mclink(stringa_in) {
	var i, lg_in;
	var stringa_out = "";
	lg_in = stringa_in.length;
	
	if (lg_in > 0) {
	
		for (i=0; i<lg_in; i++) {
			car = stringa_in.charAt(i);
		
			if (car == "("  || 
			    car == ")"  || 
			    car == "["  || 
			    car == "]"  ||
			    car == "\"" ||
			    car == "$"  ||
			    car == "?"  ||
			    car == "^"  ||
			    car == "|"  ||
			    car == "!"  ||
			    car == "\\") stringa_out = stringa_out.concat("\\");

			stringa_out = stringa_out.concat(stringa_in.charAt(i));
		}

		return stringa_out;
	}
	else return null;
}

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*    	-----------------------------------------------------------	*/
/*		Funzioni di servizio (dal file library.js - build 24/10/07)	*/
/*    	---------------------------------------------------------	*/

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

function get_browser ()  {
	var result;
	var isamac = false;

	if (document.layers) result = "n4"
	else
		if (document.all)
		{	if (navigator.appName == "Microsoft Internet Explorer") result = "ie"
			else
			if (navigator.appName == "Opera") result = "op"
			else result = "xx"
		}
		else
		{	if (!document.all && document.getElementById)
				result = "mz";
			else
				result = "xx";
		}
				
	if (navigator.platform.indexOf("Mac")>=0){ isamac = true; }

	return result;
}

function get_screen ()  {
	var result;
	if (window.screen.width <= 801) result = "low";
	else 
	if (window.screen.width <= 1025) result = "high";
	else 
	if (window.screen.width <= 1155) result = "high";
	else
	if (window.screen.width <= 1281) result = "large";
	else
	if (window.screen.width <= 1441) result = "xl";
	else result = "vl";
	
	return result;
}

function get_dim_finestra ()  {
	var result;
	var larghezza = get_window_w();
	
	if (larghezza <= 801) result = "low";
	else 
	if (larghezza <= 1025) result = "high";
	else
	if (larghezza <= 1155) result = "high";
	else
	if (larghezza <= 1281) result = "large";
	else
	if (larghezza <= 1441) result = "xl";
	else result = "vl";
	
	return result;
}

function get_dim_screen (dim)  {
	var result;

	if (dim == "low") result = "800";
	else 
	if (dim == "high") result = "1024";
	else
	if (dim == "large") result = "1280";
	else
	if (dim == "xl") result = "1400";
	else
	if (dim == "vl") result = "1600";
	else { alert("Errore funzione get_dim_screen() - Input invalido: " + dim); return "0"; }
	
	return result;
}

function get_window_w() {
	var retour;
	var myWidth = 0;
	var ff_scroll_verticale = 16;
	
	retour = get_window_browser();
	
	if(retour == "non-ie") 
	{	if (tipo_browser == "mz") myWidth = window.innerWidth - ff_scroll_verticale;
	  	else
	  	if (tipo_browser == "op") myWidth = window.innerWidth;  	
	}
	else if(retour == "ie-6+") myWidth = document.documentElement.clientWidth;
	else if(retour == "ie-4")  myWidth = document.body.clientWidth;

	else myWidth = window.screen.width;

	return myWidth;
}

function get_window_h() {
	var retour;
	var myHeight = 0;

	retour = get_window_browser();
	
	if(retour == "non-ie") myHeight = window.innerHeight;
	else if(retour == "ie-6+") myHeight = document.documentElement.clientHeight;
	else if(retour == "ie-4")  myHeight = document.body.clientHeight;
	


	else myHeight = window.screen.height;	

	return myHeight;
}

function get_window_browser() {

	if(typeof(window.innerWidth) == "number") return "non-ie";

	if(document.documentElement &&	 
		(document.documentElement.clientWidth || document.documentElement.clientHeight)) return "ie-6+"; 
 
	if(document.body && (document.body.clientWidth || document.body.clientHeight)) return "ie-4";
	
	return "??";
}

function fichier () {

	var protocol;
	var path;
	var separator;
	var file;

	protocol = window.location.protocol;

	path = window.location.pathname;

	separator = (protocol == "file:" && path.indexOf("/", 1) == -1 ? "\\" : "/");

	file = path.substring(path.lastIndexOf(separator) + 1);
	
	return file;
}