
/*	File cdg_hp.js - Main directory Chiesa del Gesù */

/*	Versione Home Page	*/

/*	Versione 23/2/06 - 4/3/06 - 29/3/06 - 7/4/06 - 22/4/06 - 31/5/06 - 6/6/06 - 12/7/06 - 17/8/06 */
/*	Versione 20/10/06 - 9/3/2007 - 25/3/07 - 21/5/07 - 3/6/07	*/
/*	Versione del 10/8/2007 - 24/10/2007 - 17/11/07			*/
/*	Versione del 27/04/2008	- 31/12/08 - 01/01/09 */
/*	Versione del 25-05-10		*/
/*	Versione del 18-03-2011	*/

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);

var lista_lingue = new Array();
	lista_lingue[0] = null;
	lista_lingue[1] = "it";
	lista_lingue[2] = "en";
	lista_lingue[3] = "fr";
	lista_lingue[4] = "sp";
	lista_lingue[5] = "pt";
	lista_lingue[6] = "de";
	
var gl_max_input = 1500;							/* 10-12-08	*/

gl_livello = 0;
gl_path = path_relativo(gl_livello);

/*	--------------- INIZIO SEZIONE PERSONALIZZAZIONI --------------------------------	*/

var gl_img_directory = "null";
var gl_liquid_data = new Array();	/* Tabella Master per la gestione delle immagini	*/
var gl_img_data = new Array();	/* Tabella principale per le immagini IPV			*/
var gl_img_alt  = new Array();	/* Tabella multi-lingua per gli "alt"				*/
var gl_img_did  = new Array();	/* Tabella multi-lingua per le didascalie			*/

var gl_area = new Array();		/* Tabella per la gestione delle mappe sensibili	*/
var gl_use_map_top = new Array(); 	/* 17-04-08 */
var gl_use_map_bottom = new Array();	/* 17-04-08 */

/*	1. Personalizzazione della tabella Master	*/
	
	gl_liquid_data[0]  = new Array("0", "0");
	gl_liquid_data[1]  = new Array("0", "0");
	gl_liquid_data[2]  = new Array("0", "0");
	gl_liquid_data[3]  = new Array("390", "770", "start", 0, 2);

/*	2. Immagini pseudo-vettoriali	--------------------------------------------	*/

	gl_img_directory = "images/ipv/";

	gl_img_data[0]=new Array("", "jpg", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0");
	gl_img_data[1]=new Array("080114_sedie_", "jpg", "170", "227", "216", "305", "216", "305", "216", "305", "216", "305");
	gl_img_data[2]=new Array("altare_sant_ignazio_", "jpg", "190", "285", "250", "375", "312", "468", "340", "510", "390", "585");
	gl_img_data[3]=new Array("090101_", "jpg", "190", "375", "250", "494", "312", "616", "340", "671", "390", "770");

	gl_img_alt[0]=new Array("null", "it", "en");
	gl_img_alt[1]=new Array("null", "Cliccare per chi volesse saperne di più", "inglese");
	gl_img_alt[2]=new Array("null", "Cliccare sulla fotografia per consultare la segnalazione. Photo: Fr. Don Dol, S.J.", "inglese");
	gl_img_alt[3]=new Array("null", "Cliccare sulla fotografia per .............", "inglese");
	
	gl_img_did[0]=new Array("null", "it", "en");
	gl_img_did[1]=new Array("null", "italiano", "inglese");
	gl_img_did[2]=new Array("null", "italiano", "inglese");
	gl_img_did[3]=new Array("null", "italiano", "inglese");
	
/*	3. Tabella aree sensibili	--------------------------------------------	*/

	gl_area[0] = new Array("rect", "html/d_notizie_it.html#2009_conoscere_uomo","Incontri di formazione: Conoscere l&#039;uomo",   "0",  "0", "190", "119",     "0", "0", "250", "158",     "0", "0", "312", "197",        "0", "0", "340", "214",      "0", "0", "390", "248");
	gl_area[1] = new Array("rect", "html/d_notizie_it.html#2009_conferenze_bibliche", "Conferenze bibliche nell&#039;anno paolino",         "43", "126", "143", "247",   "55", "166", "190", "326",  "70", "208", "237", "405",     "74", "226", "256", "442",   "88", "260", "298", "508");  	
	gl_area[2] = new Array("rect", "html/d_notizie_it.html#2009_cucci", "Conferenze del P. Cucci S.J. - Esperienza religiosa e riflessione psicologica",          "0", "252", "190", "375",    "0", "333", "250", "494",   "0", "415", "312", "616",      "0", "454", "340", "671",    "0", "520", "390", "770");

	
/*	4. Archivio fotografico / vignette	---------------------------------------------------	*/


/*	---------------------------------	*/

var gl_num_immagini = 90;	/* 90 / 8 = 11,25 quindi 12 pagine HTML		*/
var Num_pagine = 12;

/*	---------------------------------	*/

/*	Caricamento del CSS in funzione della larghezza della finestra	*/

if (dim_finestra == "low")  	/* 800 x 600 */
{	document.write("<link rel=stylesheet href=css/cdg_800_d.css type=text/css>");
	document.write("<link rel=stylesheet href=user_800.css type=text/css>");
}
else if (dim_finestra == "high") 	/* 1024 x 768 */
{	document.write("<link rel=stylesheet href=css/cdg_1024_d.css type=text/css>");
	document.write("<link rel=stylesheet href=user_1024.css type=text/css>");
} 
else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
{	document.write("<link rel=stylesheet href=css/cdg_1280_d.css type=text/css>");
	document.write("<link rel=stylesheet href=user_1280.css type=text/css>");
}
else  if (dim_finestra == "xl")		/* 1400 x 1050 */
{	document.write("<link rel=stylesheet href=css/cdg_1400_d.css type=text/css>");
	document.write("<link rel=stylesheet href=user_1400.css type=text/css>");
}
else	/*	+++++++++++++++++++++++++++++++++++++++ cdg_1600_d.css non esiste ancora ++++++++++++ */
{	document.write("<link rel=stylesheet href=css/cdg_1400_d.css type=text/css>");
	document.write("<link rel=stylesheet href=user_1600.css type=text/css>");
}
	document.write("<link rel=stylesheet href=css/cdg_print.css type=text/css media=print>");
	document.write("<link rel=stylesheet href=user_print.css type=text/css media=print>");
	
/*	25/05/2010 - Gestione dello scroll verticale	*/	
	if (tipo_browser != "ie") 
	{	document.write("<link rel=stylesheet href=cssjs/scroll_verticale.css type=text/css>");
		document.write("<link rel=stylesheet href=cssjs/scroll_verticale_print.css type=text/css media=print>");
	}
	else
	{	if (navigator.userAgent.indexOf("MSIE 8") > 0)
		{	document.write("<link rel=stylesheet href=cssjs/scroll_verticale.css type=text/css>");
			document.write("<link rel=stylesheet href=cssjs/scroll_verticale_print.css type=text/css media=print>");	
		}			
	}

/*      --------------------------------------------------------	*/
/*	Funzioni per il caricamento delle immagini della testata	*/
/*      --------------------------------------------------------	*/

function logo_alto (lang)  {
	
    if (lang == "it")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_800.png' alt='Per tornare alla home page'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1024.png' alt='Per tornare alla home page'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1280.png' alt='Per tornare alla home page'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1400.png' alt='Per tornare alla home page'>");
	}
	else
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1400.png' alt='Per tornare alla home page'>");
	}
	
    } else
    if (lang == "en")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_800.png' alt='To go back to the Home page'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1024.png' alt='To go back to the Home page'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1280.png' alt='To go back to the Home page'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1400.png' alt='To go back to the Home page'>");
	}
	else
	{	document.write("<img id='logo_alto' src='logos/logo_alto_e_1400.png' alt='To go back to the Home page'>");
	}
	
    } else
    alert("Error function logo_alto in hp.js");
	
    return true;
}

function logo_basso (lang)  {

/*	alert("inizio logo_basso");	*/

    if (lang == "it")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_800.png' alt='Per tornare alla home page'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1024.png' alt='Per tornare alla home page'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1280.png' alt='Per tornare alla home page'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1400.png' alt='Per tornare alla home page'>");
	}
	else
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1400.png' alt='Per tornare alla home page'>");
	}
	
    } else
    if (lang == "en")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_800.png' alt='To go back to the Home page'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1024.png' alt='To go back to the Home page'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1280.png' alt='To go back to the Home page'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1400.png' alt='To go back to the Home page'>");
	}
	else
	{	document.write("<img id='logo_basso' src='logos/logo_basso_e_1400.png' alt='To go back to the Home page'>");
	}
	
    } else
    alert("Error function logo_alto");
	
    return true;
}

function banner (lang)  {

/*	alert("inizio banner");	*/

    if (lang == "it")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='banner_n' src='logos/banner_base_800_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1024_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1280_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1400_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	}
	else
	{	document.write("<img id='banner_n' src='logos/banner_base_1400_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	}
	
    } else
    if (lang == "en")
    {	if (dim_finestra == "low")  		/* 800 x 600 */
	{	document.write("<img id='banner_n' src='logos/banner_base_800_en.png' alt='Rome (Italy) - Church the Gesù'>");
	}
	else if (dim_finestra == "high") 	/* 1024 x 768 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1024_en.png' alt='Rome (Italy) - Church the Gesù'>");
	} 
	else  if (dim_finestra == "large")	/* 1280 x 800 oppure 1024 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1280_en.png' alt='Rome (Italy) - Church the Gesù'>");
	}
	else  if (dim_finestra == "xl")		/* 1400 x 1050 */
	{	document.write("<img id='banner_n' src='logos/banner_base_1400_en.png' alt='Rome (Italy) - Church the Gesù'>");
	}
	else
	{	document.write("<img id='banner_n' src='logos/banner_base_1400_en.png' alt='Rome (Italy) - Church the Gesù'>");
	}
	
    } else
    alert("Error function banner");

    return true;
}

function spigolo ()  {

    document.write("<img id='spigolo_n' src='logos/spigolo1.png' alt=''>");

    return true;
}

/*      --------------------------------------------------------	*/
/*				Menu sinistro				*/
/*				 					*/
/*      			Versione del 17/8/2006			*/
/*      --------------------------------------------------------	*/

function menu_sinistro (lang)  {

	document.write("<div id='menu_left_d'>");
	
    	if (lang == "it")
	{	document.write("<a href='index.html'>Home Page</a>");
		document.write("<a href='html/d_patrimonio_it.html'>Il patrimonio culturale</a>");
		document.write("<a href='html/d_attivita_it.html'>Le attività della Chiesa</a>");
		document.write("<a href='html/d_memorie_it.html'>Le memorie dei Santi</a>");
		document.write("<a href='html/d_collabora_it.html'>Collabora con noi</a>");


		document.write("<a href='html/d_risorse_it.html'>Le risorse del sito</a>");
		document.write("<a href='html/d_dove_siamo_it.html'>Dove siamo</a>");
		document.write("<a href='html/d_contattaci_it.html'>Contattaci</a>");
		document.write("<a href='html/d_mappa_it.html'>Mappa del sito</a>");
		document.write("<a href='index_en.html'>English</a>");
	} else
	if (lang == "en")
	{	document.write("<a href='index_en.html'>Home Page</a>");
		document.write("<a href='html/d_patrimonio_en.html'>Cultural patrimony</a>");
		document.write("<a href='html/d_attivita_en.html'>Activities of the church</a>");
		document.write("<a href='html/d_memorie_en.html'>Saints' relics</a>");
		document.write("<a href='html/d_collabora_en.html'>Collaborate with us</a>");


		document.write("<a href='html/d_risorse_en.html'>Site resources</a>");
		document.write("<a href='html/d_dove_siamo_en.html'>Where we are</a>");
		document.write("<a href='html/d_contattaci_en.html'>Contact us</a>");
		document.write("<a href='html/d_mappa_en.html'>Site Map</a>");		
		document.write("<a href='index.html'>Italiano</a>");
	} else
	alert("Error function menu_sinistro");
	
    	document.write("</div>");
	
	return true;
}

/*      --------------------------------------------------------	*/
/*		Sezione indipendente da HP o PG				*/
/*									*/
/*			MASTER = HP					*/
/*									*/
/*			Versione del 17/11/07					*/
/*      --------------------------------------------------------	*/

/*	Funzioni utilizzate per la navigazione virtuale nella Chiesa	*/
/*      ------------------------------------------------------------	*/

var ImgDefault = -1;

var gl_img_prefisso = "img_";
var gl_img_prefisso_len;

	gl_img_prefisso_len = gl_img_prefisso.length;
	
function img_archivio (lang) {

	window.location = "archivio_fotografico_001_" + lang + ".html";
		
	return true;
}
	
/*	Funzione img_first()	- Versione del 17/11/2007	*/

function img_first (lang) {
	path = window.location.pathname;
	i = path.indexOf(gl_img_prefisso) + gl_img_prefisso_len;	/* per la lunghezza del prefisso	*/
	numero = path.substr(i,4) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero == 1) return true;
		
	file = gl_img_prefisso + "0001_" + lang + ".html";
		
	window.location = file;
	return true;
}

/*	Funzione img_prev()	- Versione del 17/11/2007	*/

function img_prev (lang) {
	path = window.location.pathname;
	i = path.indexOf(gl_img_prefisso) + gl_img_prefisso_len;	/* per la lunghezza del prefisso	*/
	numero = path.substr(i,4) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero > 1) numero = numero - 1;
	else return true;
		
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "000" + val;
	else
	if (lunghezza == 2) file = "00" + val;
	else
	if (lunghezza == 3) file = "0" + val;
	else
	if (lunghezza == 4) file = val;
	
	file = gl_img_prefisso + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

/*	Funzione img_next()	- Versione del 17/11/2007	*/

function img_next (lang) {
	path = window.location.pathname;
	i = path.indexOf(gl_img_prefisso) + gl_img_prefisso_len;	/* per la lunghezza del prefisso	*/
	numero = path.substr(i,4) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero < gl_num_immagini) numero = numero + 1;
	else return true;
		
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "000" + val;
	else
	if (lunghezza == 2) file = "00" + val;
	else
	if (lunghezza == 3) file = "0" + val;
	else
	if (lunghezza == 4) file = val;
	
	file = gl_img_prefisso + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

/*	Funzione img_last()	- Versione del 17/11/2007	*/

function img_last (lang) {
	path = window.location.pathname;
	i = path.indexOf(gl_img_prefisso) + gl_img_prefisso_len;	/* per la lunghezza del prefisso	*/
	numero = path.substr(i,4) * 1;	/* stringa multiplicata per 1 fornisce un numero */

	if (numero != gl_num_immagini) numero = gl_num_immagini;
	else return true;
	
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "000" + val;
	else
	if (lunghezza == 2) file = "00" + val;
	else
	if (lunghezza == 3) file = "0" + val;
	else
	if (lunghezza == 4) file = val;
	
	file = gl_img_prefisso + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

/*	******** FINE ******* */

function img_count (lang) {
	var i;
	var path;
	var current;
	var numero;
	var last;
	
	numero = "";
	
	path = window.location.pathname;
	i = path.indexOf("img_") + 4;	/* 4 per la lunghezza di "img_"	*/
	current = path.substr(i,4);
	lunghezza = current.length;

/*	Eliminazione dei zeri iniziali	*/

	for (i=0; i<lunghezza; i++)
	{	car = current.charAt(i);
		if (car == "0" & numero == "") continue;
		numero = numero + car;
	}
	
	if (numero == "") numero = "0";		/* per gestire la pagina img_0000_it.html" */
	
	last = numero + " / " + gl_num_immagini.toString();
	
	return last;
}

function img_max (stringa) {
	var max
	
	max = stringa + " / " + gl_num_immagini.toString();
	
	return max;
}


function img_vai (codice,lang) {

	if (codice == 1) {
	window.location = "archivio_fotografico_cappella_sacro_cuore_" + lang + ".html"; }
	else
	if (codice == 2) {
	window.location = "archivio_fotografico_sacrestia_" + lang + ".html"; }
	else
	if (codice == 3) {
	window.location = "archivio_fotografico_esterno_" + lang + ".html"; }
	else
	if (codice == 4) {
	window.location = "archivio_fotografico_san_francesco_saverio_" + lang + ".html"; }
	else
	{	alert ("Funzione img_vai - Codice errato = " + codice);
		return false;
	}
}

function page_first (lang) {

	file = "archivio_fotografico_001_" + lang + ".html";
	alert(file);
	window.location = file;
	return true;
}

function page_first (lang) {
	path = window.location.pathname;
	i = path.indexOf("grafico_") + 8;	/* 8 per la lunghezza di "grafico_"	*/
	numero = path.substr(i,3) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero == 1) return true;
	
	file = "archivio_fotografico_001_" + lang + ".html";
		
	window.location = file;
	return true;
}

function page_prev (lang) {
	path = window.location.pathname;
	i = path.indexOf("grafico_") + 8;	/* 8 per la lunghezza di "grafico_"	*/
	numero = path.substr(i,3) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero > 1) numero = numero - 1;
	else return true;
		
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "00" + val;
	else
	if (lunghezza == 2) file = "0" + val;
	else
	if (lunghezza == 3) file = val;
		
	file = "archivio_fotografico_" + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

function page_next (lang) {
	path = window.location.pathname;
	i = path.indexOf("grafico_") + 8;	/* 8 per la lunghezza di "grafico_"	*/
	numero = path.substr(i,3) * 1;	/* stringa multiplicata per 1 fornisce un numero */
	
	if (numero < Num_pagine) numero = numero + 1;
	else return true;
		
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "00" + val;
	else
	if (lunghezza == 2) file = "0" + val;
	else
	if (lunghezza == 3) file = val;
	
	file = "archivio_fotografico_" + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

function page_last (lang) {
	path = window.location.pathname;
	i = path.indexOf("grafico_") + 8;	/* 8 per la lunghezza di "grafico_"	*/
	numero = path.substr(i,3) * 1;	/* stringa multiplicata per 1 fornisce un numero */

	if (numero != Num_pagine) numero = Num_pagine;
	else return true;
	
	val = numero.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "00" + val;
	else
	if (lunghezza == 2) file = "0" + val;
	else
	if (lunghezza == 3) file = val;
	
	file = "archivio_fotografico_" + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}

function page_num (lang,numero_pagina) {
	
	if (numero_pagina <= 0) {
		alert("Numero pagina sbagliato (<0) " + numero_pagina);
		return false; }
	else
	if (numero_pagina > Num_pagine) {
		alert("Numero pagina sbagliato (>...) " + numero_pagina);
		return false; }
	
	val = numero_pagina.toString();
	lunghezza = val.length;
	
	if (lunghezza == 1) file = "00" + val;
	else
	if (lunghezza == 2) file = "0" + val;
	else
	if (lunghezza == 3) file = val;
	
	file = "archivio_fotografico_" + file + "_" + lang + ".html";
	
	window.location = file;
	return true;
}


/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*    	-----------------------------------------------------------	*/
/*		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";		/* 24-10-07: 1401 --> 1441 */
	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 == "standard") 
	{	if (tipo_browser == "mz") myWidth = window.innerWidth - ff_scroll_verticale;
	  	else
	  	if (tipo_browser == "ie") myWidth = window.innerWidth;
	  	else
	  	if (tipo_browser == "op") myWidth = window.innerWidth;
	  	else
	  	if (tipo_browser == "sa") myWidth = window.innerWidth;
	  	else
	  	if (tipo_browser == "cr") 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 == "standard") 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 "standard";
	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 "??";
}

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*					FROM LAYOUT.JS	01-01-09									*/

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*	Funzione scrivi_img () - Versione del 01/01/2009						*/

/*	La funzione scrive un'immagine in funzione della dimensione della 		*/
/*	finestra del browser. 													*/
/*	Eventualmente scrive le mappe sensibili									*/

/*	In input:																*/ 
/*		il numero dell'immagine (da 1 a n)									*/
/*		la lingua															*/
/*		la classe (non può essere vuota) per il tag <img>					*/

function scrivi_img (numero, lang, classe) {

	var i, j, dim, nome_immagine, mappa, forma, destinazione, coordinate, stringa;
	var c1, c2, c3, c4;
	var nome_mappa, area_inizio, area_fine;
	var nome_variabile, larghezza_img, altezza_img;
	var alt_img;
	var img_value = new Array();
	
/*	Ricupero delle caratteristiche dell'immagine					*/
 
	img_value = read_img_value (numero);
	if (img_value[0] == "error")
	{	document.write("<p>Error function scrivi_img()</p>");
		return false;
	}
	nome_variabile = img_value[0];
	larghezza_img = img_value[1];
	altezza_img = img_value[2];
	
/*	Test della lingua										*/
	
	if (lang != "it" && lang != "en" && lang != "fr" && lang != "sp" && lang != "pt" && lang != "de")
	{	alert("Funz. scrivi_img() - lingua: '" + lang + "' non supportata.");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}

/*	Test della classe										*/

	if (classe == "")
	{	alert("Funz. scrivi_img() - classe assente.");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}
	
/*	Ricerca "in tabella" se l'immagine è collegata ad una mappa sensibile	*/
	
	nome_mappa = gl_liquid_data[numero][2];
	if (nome_mappa == undefined) mappa = "";
	else
	{	mappa = " usemap='#" + nome_mappa + "'";
		area_inizio = gl_liquid_data[numero][3];	/* Index all'interno di gl_area	*/
		if (area_inizio == undefined)
		{	alert("Funz. scrivi_img() - Errore mappa sensibile: " + nome_mappa + " - area inizio undefined");
			document.write("<p>Error function scrivi_img()</p>");
			return false;
		}
		area_fine = gl_liquid_data[numero][4];	/* Index all'interno di gl_area	*/
		if (area_fine == undefined)
		{	alert("Funz. scrivi_img() - Errore mappa sensibile: " + nome_mappa + " - area fine undefined");
			document.write("<p>Error function scrivi_img()</p>");
			return false;
		}
		if (area_inizio > area_fine)
		{	alert("Funz. scrivi_img() - Errore mappa sensibile: " + nome_mappa + " - area inizio > area fine");
			document.write("<p>Error function scrivi_img()</p>");
			return false;
		}
	}
	
/*	Test della variabile gl_img_directory	*/
	
	if (gl_img_directory == "null")
	{	alert("Funz. scrivi_img() - Errore inizializzazione della variabile gl_img_directory. Verificare il file menu.js");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}	

/*	Inizio della funzione	*/

/*	Ricerca del testo per la proprietà ALT in funzione della lingua	*/

	dim = lista_lingue.length;
	for (i=0; i<dim; i++)
	{	if (lang == lista_lingue[i]) { alt_img = gl_img_alt[numero][i]; break; }
	}

	nome_immagine = gl_img_directory + gl_img_data[numero][0] + nome_variabile;
	
	document.write("<img class='" + classe + "' src='" + nome_immagine + "' width='" + larghezza_img + "' height='" + altezza_img + "' title='" + alt_img + "' alt='" + alt_img + "'" + mappa + ">");
	
/*	Scrittura della mappa sensibile				*/
/*	In input: il numero dell'immagine				*/

	if (mappa != "")
	{	area_inizio = gl_liquid_data[numero][3];	/* Index all'interno di gl_area	*/
		area_fine = gl_liquid_data[numero][4];	/* Index all'interno di gl_area	*/
		document.write("<map name='" + nome_mappa + "'>");
		
		for (i=area_inizio; i<=area_fine; i++)	/* Loop sulle aree sensibili		*/
		{	forma = gl_area[i][0];			/* forma gestita per adesso: "rect"	*/
			destinazione = gl_path + gl_area[i][1];
			alt_img = gl_area[i][2];		/* Qui esite un problema di lingua non ancora risolto	*/
			
			if (dim_finestra == "low")  		
			{	c1 = gl_area[i][3];
				c2 = gl_area[i][4];
				c3 = gl_area[i][5];
				c4 = gl_area[i][6];
			}
			else if (dim_finestra == "high") 			
			{	c1 = gl_area[i][7];
				c2 = gl_area[i][8];
				c3 = gl_area[i][9];
				c4 = gl_area[i][10];
			}
			else  if (dim_finestra == "large")
			{	c1 = gl_area[i][11];
				c2 = gl_area[i][12];
				c3 = gl_area[i][13];
				c4 = gl_area[i][14];
			}
			else  if (dim_finestra == "xl")			
			{	c1 = gl_area[i][15];
				c2 = gl_area[i][16];
				c3 = gl_area[i][17];
				c4 = gl_area[i][18];
			}
			else
			{	c1 = gl_area[i][19];
				c2 = gl_area[i][20];
				c3 = gl_area[i][21];
				c4 = gl_area[i][22];
			}
			
			coordinate = c1 + ", " + c2 + ", " + c3 + ", " + c4;
			document.write("<area shape='" + forma + "' href='" + destinazione + "' coords='" + coordinate + "' alt='" + alt_img + "' title='" + alt_img + "'>");
		}
		document.write("</map>");
	}
	
	return true;
}

function scrivi_img_old (numero, lang, classe) {
	var i, j, dim, nome_immagine;
	var nome_variabile, larghezza_img, altezza_img;
	var alt_img;
	var img_value = new Array();
	img_value = read_img_value (numero);
	if (img_value[0] == "error")
	{	document.write("<p>Error function scrivi_img()</p>");
		return false;
	}
	nome_variabile = img_value[0];
	larghezza_img = img_value[1];
	altezza_img = img_value[2];
	if (lang != "it" && lang != "en" && lang != "fr" && lang != "sp" && lang != "pt" && lang != "de")
	{	alert("Funz. scrivi_img() - lingua: '" + lang + "' non supportata.");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}
	if (classe == "")
	{	alert("Funz. scrivi_img() - classe assente.");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}
	if (gl_img_directory == "null")
	{	alert("Funz. scrivi_img() - Errore inizializzazione della variabile gl_img_directory. Verificare il file menu.js");
		document.write("<p>Error function scrivi_img()</p>");
		return false;
	}	
	dim = lista_lingue.length;
	for (i=0; i<dim; i++)
	{	if (lang == lista_lingue[i]) { alt_img = gl_img_alt[numero][i]; break; }
	}
	nome_immagine = gl_img_directory + gl_img_data[numero][0] + nome_variabile;
	document.write("<img class='" + classe + "' src='" + nome_immagine + "' width='" + larghezza_img + "' height='" + altezza_img + "' alt='" + alt_img + "'>");
	return true;
}
function scrivi_img_table (numero, classe, delta) {
	var dim;
	var nome_variabile, larghezza_img, altezza_img;
	var img_value = new Array();
	if (delta < 0 || delta > 50)
	{	alert("Funz. scrivi_img_table() - Il Delta richiesto " + delta + " non è valido.");
		return false;
	}
	img_value = read_img_value (numero);
	if (img_value[0] == "error")
	{	document.write("<table>");
		return false;
	}
	larghezza_img = img_value[1];
	if (delta != 0)
	{	dim = parseInt(larghezza_img) + delta;
		larghezza_img = dim + "";
	}
	if (classe == "") document.write("<table style='width: " + larghezza_img + "px'>");
	else document.write("<table class='" + classe + "' style='width: " + larghezza_img + "px'>");
	return true;
}
function scrivi_img_div (numero, classe, delta) {
	var dim;
	var nome_variabile, larghezza_img, altezza_img;
	var img_value = new Array();
	if (delta < 0 || delta > 50)
	{	alert("Funz. scrivi_img_div() - Il Delta richiesto " + delta + " non è valido.");
		return false;
	}
	img_value = read_img_value (numero);
	if (img_value[0] == "error")
	{	document.write("<div>");
		return false;
	}
	larghezza_img = img_value[1];
	if (delta != 0)
	{	dim = parseInt(larghezza_img) + delta;
		larghezza_img = dim + "";
	}
	if (classe == "") document.write("<div style='width: " + larghezza_img + "px'>");
	else document.write("<div class='" + classe + "' style='width: " + larghezza_img + "px'>");
	return true;
}
function scrivi_img_did (numero, lang) {
	var i, j, dim, img_max_img;
	var didascalia;
	img_max_img = gl_img_data.length - 1;
	if (numero <= 0 || numero > img_max_img)
	{	alert("Funz. scrivi_img_did() - L'immagine richiesta numero " + numero + " non esiste.");
		document.write("[Err. 1 - Didascalia dell'immagine " + numero + " non disponibile]");
		return false;
	}
	if (lang != "it" && lang != "en" && lang != "fr" && lang != "sp" && lang != "pt" && lang != "de")
	{	alert("Funz. scrivi_img_did() - lingua: '" + lang + "' non supportata.");
		document.write("[Err. 2 - Didascalia dell'immagine " + numero + " non disponibile]");
		return false;
	}
	i = gl_img_data.length;
	j = gl_img_did.length;
	if (i != j)
	{	alert("Funz. scrivi_img_did() - Incoerenza nella dimensione degli array. Dimensione gl_img_data = " + i + " - Dimensione gl_img_did = " + j);
		document.write("[Err. 3 - Didascalia dell'immagine " + numero + " non disponibile]");
		return false;
	}
	dim = lista_lingue.length;
	for (i=0; i<dim; i++)
	{	if (lang == lista_lingue[i]) { didascalia = gl_img_did[numero][i]; break; }
	}
	document.write(didascalia);
	return true;
}
function read_img_value (numero) {
	var i, j, img_max_img;
	var risultato = new Array();
	img_max_img = gl_img_data.length - 1;
	if (numero <= 0 || numero > img_max_img)
	{	alert("Funz. read_img_value() - L'immagine richiesta numero " + numero + " non esiste.");
		risultato[0] = "error";
		return risultato;
	}
	i = gl_img_data.length;
	j = gl_img_alt.length;
	if (i != j)
	{	alert("Funz. read_img_value() - Incoerenza nella dimensione degli array. Dimensione gl_img_data = " + i + " - Dimensione gl_img_alt = " + j);
		risultato[0] = "error";
		return risultato;
	}
    	if (dim_finestra == "low")  		
    	{	risultato[0] = "800." + gl_img_data[numero][1];
    		risultato[1] = gl_img_data[numero][2];
    		risultato[2] = gl_img_data[numero][3];
    	}
	else if (dim_finestra == "high") 			
    	{	risultato[0] = "1024." + gl_img_data[numero][1];
    		risultato[1] = gl_img_data[numero][4];
    		risultato[2] = gl_img_data[numero][5];
    	}
	else  if (dim_finestra == "large")
    	{	risultato[0] = "1280." + gl_img_data[numero][1];
    		risultato[1] = gl_img_data[numero][6];
    		risultato[2] = gl_img_data[numero][7];
    	}
	else  if (dim_finestra == "xl")			
    	{	risultato[0] = "1400." + gl_img_data[numero][1];
    		risultato[1] = gl_img_data[numero][8];
    		risultato[2] = gl_img_data[numero][9];
    	}
	else
    	{	risultato[0] = "1600." + gl_img_data[numero][1];
    		risultato[1] = gl_img_data[numero][10];
    		risultato[2] = gl_img_data[numero][11];
    	}
	return risultato;
}
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 ? "\\" : "/");
	if (protocol == "http:" && path == "/") path = path + gl_nome_hp;
	file = path.substring(path.lastIndexOf(separator) + 1);
	return file;
}
function dir_fichier () {
	var protocol, path, separator, dim, file;
	var path_array = new Array();
	protocol = window.location.protocol;
	path = window.location.pathname;
	separator = (protocol == "file:" && path.indexOf("/", 1) == -1 ? "\\" : "/");
	if (protocol == "http:" && path == "/") path = path + gl_nome_hp;
	path_array = path.split(separator);
	dim = path_array.length;
	if (dim < 2) 
	{	alert("Funz. dir_fichier() - Internal error - dim = " + dim);
		return "";
	}
	if (path_array[dim-2] == "") file = path_array[dim-1];
	else
	file = path_array[dim-2] + separator + path_array[dim-1];
	return file;
}
function fichier_lang (file) {
	var dim, pos, car;
	dim = file.length;
	if (dim <= 0) return "??";	
	pos = file.lastIndexOf(".");
	if (pos == -1) return "??";
	if (file.charAt(pos-3) != "_") return "??";	
	return file.substring(pos-2,pos);
}
function vai_hp () { 
	var i, dim, file, codice_file;
	var index, corpo, suffiso, virual_hp;
	if (def_test != 1)
	{	alert("E' stato richiesto l'utilizzo del menu verticale. Tuttavia e' probabile che la riga <script src='definition.js' type='text/javascript'></script> sia mancante all'inizio della pagina HTML");
		return false;
	}	
	file = fichier();
	codice_file = fichier_lang(file);
	if (codice_file == "??" || codice_file == "it") window.location = gl_path + gl_nome_hp;
	else
	{	index = gl_nome_hp.indexOf(".");
		corpo = gl_nome_hp.substring(0,index);
		suffisso = gl_nome_hp.substr(index);
		virtual_hp = corpo + "_" + codice_file + suffisso;
		window.location = gl_path + virtual_hp;
	}
}

/*	+++++++++++++++++++++++++++++++++ gl_path ++++++++++++++++++++++++++++++++++++++++	*/

/*	Funzione path_relativo() - Versione del 25/11/2008		*/

function path_relativo (livello) {
	if (livello == 0) path = "";
	else
	if (livello == 1) path = "../";
	else
	if (livello == 2) path = "../../";
	else
	if (livello == 3) path = "../../../";
	else
	if (livello == 4) path = "../../../../";
	else { alert("Error in path_relativo() chiamato da menu.js. Variable livello errata = -" + livello + "-. Caricamento css fallito."); return ""; }
	
	return path;
}

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

/*					FROM LIBRARY.JS	28/12/2008									*/

/*	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	*/

function str_vuota (stringa) {
	var i, dim, car;
	dim = stringa.length;
	if (dim <= 0) return true;
	for (i= 0; i<dim; i++)
	{	car = stringa.charAt(i);
		if (car == " ") continue;
		if (car == "\n" || car == "\r" || car == "\t" || car == "\f" || car == "\b") continue;
		return false;
	}
	return true;
}
function str_e_mail (stringa) {
	var dim;
	dim = stringa.length;
	if (dim <= 0) return false;
	l1 = stringa.indexOf("@");
	l2 = stringa.lastIndexOf("@");
	if (l1 != l2) return false;	
	if ((stringa.indexOf("@") == -1) | (stringa.indexOf(".") == -1) | (dim < 6)) return false;
	return true;
}
function str_numeri (stringa) {
	var i, dim, count;
	dim = stringa.length;
	count = 0;
	for (i=0; i<dim; i++)  {
		car = stringa.charAt(i);
		if (car == '0' || car == '1' || car == '2' || car == '3' || car == '4' || car == '5' || car == '6' || car == '7' || car == '8' || car == '9') count++;
	}
	if (count != dim) return false;
	return true;
}
function str_numeri_more (stringa) {
	var i, dim, count;
	dim = stringa.length;
	count = 0;
	for (i=0; i<dim; i++)  {
		car = stringa.charAt(i);
		if (car == '0' || car == '1' || car == '2' || car == '3' || car == '4' || car == '5' || car == '6' || car == '7' || car == '8' || car == '9' || car == '.' || car == ',' || car == '+' || car == '-' || car == ' ') count++;
	}
	if (count != dim) return false;
	return true;
}
function str_numero_telefonico (stringa) {
	var i, dim, count, count_plus, count_par_open, count_par_close;
	dim = stringa.length;
	count = 0;
	count_plus = 0;
	count_par_open = 0;
	count_par_close = 0;
	for (i=0; i<dim; i++)  {
		car = stringa.charAt(i);
		if (car == '0' || car == '1' || car == '2' || car == '3' || car == '4' || car == '5' || car == '6' || car == '7' || car == '8' || car == '9' || car == '(' || car == ')' || car == '+' || car == ' ') count++;
		if (car == '+') count_plus++;
		if (car == '(') count_par_open++;
		if (car == ')') count_par_close++;
	}
	if (count != dim) return false;
	if (count_plus > 1) return false;
	if (count_par_open > 1) return false;
	if (count_par_close > 1) return false;
	if (count_par_open != count_par_close) return false;
	return true;
}
function str_data (stringa) {
	var i, dim, giorno, mese, anno;
	dim = stringa.length;
	if (dim != 10) return 1;
	if (stringa.charAt(2) != "/") return 2;
	if (stringa.charAt(5) != "/") return 3;
	giorno = stringa.substr(0,2);
	if (str_numeri(giorno) != true) return 4;
	if (parseInt(giorno,10) > 31)  return 5;
	mese   = stringa.substr(3,2);
	if (str_numeri(mese) != true) return 6;
	if (parseInt(mese,10) > 12) return 7;
	anno   = stringa.substr(6,4);		
	if (str_numeri(anno) != true) return 8;
	if (parseInt(anno,10) < 1900) return 9;
	data = new Date(anno,mese-1,giorno);
	daa = data.getFullYear().toString();
	dmm = (data.getMonth()+1).toString();
	dmm = dmm.length == 1 ? "0" + dmm : dmm;
	dgg = data.getDate().toString();
	dgg = dgg.length == 1 ? "0" + dgg : dgg;
	data_calcolata = dgg + "/" + dmm + "/" + daa;
	if (data_calcolata != stringa) return 10;
	return 0;
}
function str_replace (stringa_in, car, pos) {
	var dim;
	var stringa_out = "";
	dim = car.length;
	if (dim != 1) { alert("Funz. str_replace() - errore car:" + car); return stringa_out; }
	dim = stringa_in.length;
	if (dim <= 0) return " ";
	if (pos < 0 || pos >= dim) { alert("Funz. str_replace() - errore pos = " + pos); return stringa_out; }
	if (pos == 0) stringa_out = car + stringa_in.substring(1,dim);
	else
	if (pos == dim-1) stringa_out = stringa_in.substring(0,pos) + car;
	else stringa_out = stringa_in.substring(0,pos) + car + stringa_in.substring(pos+1,dim);
	return stringa_out;
}
function str_pulire (stringa_in) {
	var i, dim, first, last;;
	var stringa_inter = "";
	var stringa_out = "";
	dim = stringa_in.length;
	if (dim == 0) return stringa_out;
	last = dim - 1;	
	first = -1;
	for (i=0; i<dim; i++)  
	{	car = stringa_in.charAt(i);
		if (car != " ") { first = i; break; }
	}
	if (first == -1) { return stringa_out; }
	stringa_inter = stringa_in.substring(first,last+1);
	dim = stringa_inter.length;	
	first = -1;
	last = dim - 1;
	for (i=last; i>=0; i--)
	{	car = stringa_inter.charAt(i);
		if (car != " ") { first = i; break; }
	}
	if (first == -1) stringa_out = stringa_inter;
	else stringa_out = stringa_inter.substring(0,first+1);
	return stringa_out;
}
function str_pulire_data (data_in) {
	var dim, car1, car2;
	var data_inter = "";
	var data_out = "";
	dim = data_in.length;
	if (dim != 10) return data_in;
	car1 = data_in.charAt(2);
	car2 = data_in.charAt(5);
	if (car1 == "." || car1 == "-") data_inter = str_replace(data_in, "/",2);
	else data_inter = data_in;
	if (car2 == "." || car2 == "-") data_out = str_replace(data_inter, "/",5);
	else data_out = data_inter;	
	return data_out;
}

