
/*	File cdg_pg.js - Directory /css */

/*	Versione Pagina HTML	*/

/*	Versione 23/2/2006 - 4/3/06 - 29/3/06 - 7/4/06 - 22/4/06 - 31/5/06 - 9/6/06 - 13/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	- 09/06/2008 - 31/12/08 - 01/01/09 */
/*	Versione del 05-03-2010		*/

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 --------------------------------	*/

/*	Variabili globali per la gestione delle immagini pseudo-vettoriali	*/

var gl_img_directory = "null";
var gl_img_data = new Array();
var gl_img_alt  = new Array();
var gl_img_did  = new Array();

/*	---------------------------------	*/

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>");

if (tipo_browser == "mz")
{	document.write("<link rel=stylesheet href=../css/cdg_firefox.css type=text/css>");
}



/*	--------------------------------------------------------	*/
/*	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 pg.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_it.png' alt='Chiesa del Santissimo Nome di Gesù'>");
	}
	
    } else
    alert("Error function banner");

    return true;
}

function spigolo ()  {

/*	alert("inizio 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='d_patrimonio_it.html'>Il patrimonio culturale</a>");
		document.write("<a href='d_attivita_it.html'>Le attività della Chiesa</a>");
		document.write("<a href='d_memorie_it.html'>Le memorie dei Santi</a>");
		document.write("<a href='d_collabora_it.html'>Collabora con noi</a>");


		document.write("<a href='d_risorse_it.html'>Le risorse del sito</a>");
		document.write("<a href='d_dove_siamo_it.html'>Dove siamo</a>");
		document.write("<a href='d_contattaci_it.html'>Contattaci</a>");
		document.write("<a href='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='d_patrimonio_en.html'>Cultural patrimony</a>");
		document.write("<a href='d_attivita_en.html'>Activities of the church</a>");
		document.write("<a href='d_memorie_en.html'>Saints' relics</a>");
		document.write("<a href='d_collabora_en.html'>Collaborate with us</a>");


		document.write("<a href='d_risorse_en.html'>Site resources</a>");
		document.write("<a href='d_dove_siamo_en.html'>Where we are</a>");
		document.write("<a href='d_contattaci_en.html'>Contact us</a>");
		document.write("<a href='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;
}

/*      --------------------------------------------------------	*/
/*			Menu visita (soltanto in _pg.js)		*/
/*      --------------------------------------------------------	*/

function menu_visita (lang)  {

	document.write("<div id='menu_visita'>");
	
    	if (lang == "it")
    	{	

document.write("<a href='archivio_fotografico_viste_specifiche_it.html'>Viste specifiche:</a>");

document.write("<a href='#' onclick='img_vai(\"9\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Altare maggiore</a>");

document.write("<a href='#' onclick='img_vai(\"1\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Cappella Sacro Cuore</a>");

document.write("<a href='#' onclick='img_vai(\"10\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Corridoio di A. Pozzo</a>");

document.write("<a href='#' onclick='img_vai(\"3\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Esterno</a>");

document.write("<a href='#' onclick='img_vai(\"12\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Interno</a>");

document.write("<a href='#' onclick='img_vai(\"11\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Madonna della Strada</a>");

document.write("<a href='#' onclick='img_vai(\"2\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Sacrestia</a>");

document.write("<a href='#' onclick='img_vai(\"7\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;San Francesco Borgia</a>");

document.write("<a href='#' onclick='img_vai(\"4\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;San Francesco Saverio</a>");

document.write("<a href='#' onclick='img_vai(\"6\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;San Giuseppe Pignatelli</a>");

document.write("<a href='#' onclick='img_vai(\"8\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Sant'Ignazio di Loyola</a>");

document.write("<a href='#' onclick='img_vai(\"5\",\"it\");'><img class='icon_9x12' src='../icons/ArrowR.gif' alt='Segue testo cliccabile'>&nbsp;Stanze di sant'Ignazio</a>");

		document.write("<a href='img_0001_it.html'>Per andare alla prima immagine dell'archivio</a>");
		
		document.write("<a href='img_upload_it.html'>Per inviare una fotografia al Web Team per la sua pubblicazione</a>");





	} else
	if (lang == "en")
	{	document.write("<a href='img_0001_en.html'>For browsing the first picture</a>");
		document.write("<a href='img_upload_en.html'>For sending a picture to the Web Team</a>");
	} else
	alert("Error function menu_visita");
	
    	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
	if (codice == 5) {
	window.location = "archivio_fotografico_stanze_ignazio_" + lang + ".html"; }
	else
	if (codice == 6) {
	window.location = "archivio_fotografico_san_giuseppe_pignatelli_" + lang + ".html"; }
	else
	if (codice == 7) {
	window.location = "archivio_fotografico_san_francesco_borgia_" + lang + ".html"; }
	else
	if (codice == 8) {
	window.location = "archivio_fotografico_sant_ignazio_" + lang + ".html"; }
	else
	if (codice == 9) {
	window.location = "archivio_fotografico_altare_maggiore_" + lang + ".html"; }
	else
	if (codice == 10) {
	window.location = "archivio_fotografico_corridoio_" + lang + ".html"; }
	else
	if (codice == 11) {
	window.location = "archivio_fotografico_madonna_strada_" + lang + ".html"; }
	else
	if (codice == 12) {
	window.location = "archivio_fotografico_interno_" + 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 test dei moduli	*/
/*      ---------------------------	*/

/*		Versione del 09-06-2008		*/

function test_contattaci (lang) {

	var car = null;
	var count = 0;
	
	var indirizzo_pe = document.cdg_contattaci.email.value;
	var lgem = indirizzo_pe.length;
	
      var citta = document.cdg_contattaci.citta.value;
	var lgcitta = citta.length;
	
	var paese = document.cdg_contattaci.country.value;
	var lgpaese = paese.length;
	

	var stringa = document.cdg_contattaci.messaggio.value;	/* NB: textarea */
	var lunghezza = stringa.length;
	
	var subject;
	var lgsub;

	if (lang == "it")
	{	subject = "OK";
		var lgsub = 2;
	}
	else if (lang == "en")
	{	subject = document.cdg_contattaci.motivo.value;
		var lgsub = subject.length;
	}
	
/*	I campi Motivo / Subject, e-mail, città, paese e messaggio sono obbligatori */
	
	if (lgsub == 0)
	{	alert("The 'Subject' field must be fill in!");
		document.cdg_contattaci.motivo.focus();
		return false; }
	
	if (lgem == 0)
	{	if (lang == "it") alert("Il campo 'e-mail' è obbligatorio");
		else alert("The 'e-mail' field must be fill in!");
		document.cdg_contattaci.email.focus();
		return false; }
		
	if (lang == "it" && lgcitta == 0)
	{	alert("Il campo 'Città' è obbligatorio");
		document.cdg_contattaci.citta.focus();
		return false; }
		
	if (lgpaese == 0)
	{	if (lang == "it") alert("Il campo 'Paese' è obbligatorio");
		else alert("The 'Country' field must be fill in!");
		document.cdg_contattaci.country.focus();
		return false; }
		
/*	Il campo messaggio non può essere vuto	*/


	for (i=0; i<lunghezza; i++)  {
		car = stringa.charAt(i);
		if (car == "\t") break;		/* Tabulazione	*/
		if (car == "\f") break;
		if (car == "\n") break;
		count++;
	}
	if (count  == 0)	
	{	if (lang == "it") alert("Il campo 'Messaggio' deve essere riempito!");
		else alert("The 'Message' field must be fill in!");
		document.cdg_contattaci.messaggio.focus();
		return false; }

/*	La campo e-mail deve essere valido	*/

	if (lgem > 0)
	{	if ((indirizzo_pe.indexOf("@") == -1) |
		(indirizzo_pe.indexOf(".") == -1) |
		(indirizzo_pe.length < 7))
		{	if (lang == "it") alert("Il campo 'e-mail' non è valido"); 
			else alert("The field 'e-mail' is not valid");
			document.cdg_contattaci.email.focus();
			return false; 
		}
	}
	
	return true;
}

/*	----------------------------------------------------------	*/

/*		Versione del 25-03-2007						*/

function test_download (lang) {		/* Utilizzato in img_modulo_xx.html - 25/3/2007 */

        var motivo = document.cdg_richiesta_foto.motivo.value;
	var lgmo = motivo.length;
	
        var nc = document.cdg_richiesta_foto.nome_cognome.value;
	var lgnc = nc.length;
	
        var org = document.cdg_richiesta_foto.organizzazione.value;
	var lgorg = org.length;
	
        var settore = document.cdg_richiesta_foto.tipo_org.value;
        
        var attivita = document.cdg_richiesta_foto.attivita.value;
	
        var indirizzo_pe = document.cdg_richiesta_foto.email.value;
	var lgem = indirizzo_pe.length;
	
        var citta = document.cdg_richiesta_foto.citta.value;
	var lgcitta = citta.length;
	
	var paese = document.cdg_richiesta_foto.country.value;
	var lgpaese = paese.length;
	
        var identi = document.cdg_richiesta_foto.identificativo.value;
	var lgid = identi.length;
	
	if (lgmo == 0)
	{	if (lang == "it") alert("Il campo 'Motivo della richiesta' deve essere riempito!");
		else alert("The 'Why' field must be fill in!");
		document.cdg_richiesta_foto.motivo.focus();
		return false; }
		
	if (lgnc == 0)
	{	if (lang == "it") alert("Il campo 'Nome Cognome' deve essere riempito!");
		else alert("The 'First name / Name' field must be fill in!");
		document.cdg_richiesta_foto.nome_cognome.focus();
		return false; }
		
	if (lgorg == 0)
	{	if (lang == "it") alert("Il campo 'Organizzazione' deve essere riempito!");
		else alert("The 'Organization' field must be fill in!");
		document.cdg_richiesta_foto.organizzazione.focus();
		return false; }
		
	if (settore == "0")
	{	if (lang == "it") alert("Selezionare un valore per il 'Tipo di organizzazione'");
		else alert("The 'Type of organization' field must be fill in!");
		document.cdg_richiesta_foto.tipo_org.focus();
		return false; }
		
	if (attivita == "0")
	{	if (lang == "it") alert("Selezionare un valore per la 'Attività svolta nell'organizzazione'");
		else alert("The 'Activity' field must be fill in!");
		document.cdg_richiesta_foto.attivita.focus();
		return false; }
		
	if (lgem == 0)
	{	if (lang == "it") alert("Il campo 'E-mail' deve essere riempito!");
		else alert("The 'E-mail' field must be fill in!");
		document.cdg_richiesta_foto.email.focus();
		return false; }
		
	if (lgcitta == 0)
	{	alert("Il campo 'Città' è obbligatorio");
		document.cdg_richiesta_foto.citta.focus();
		return false; }
		
	if (lgpaese == 0)
	{	if (lang == "it") alert("Il campo 'Paese' è obbligatorio");
		else alert("The 'Country' field must be fill in!");
		document.cdg_richiesta_foto.country.focus();
		return false; }	
		
	if (lgid == 0)
	{	if (lang == "it") alert("Il campo 'Identificativo' deve essere riempito!");
		else alert("The 'Code' field must be fill in!");
		document.cdg_richiesta_foto.identificativo.focus();
		return false;
	}
	
/*	La campo e-mail deve essere valido	*/

	if ((indirizzo_pe.indexOf("@") == -1) |
		(indirizzo_pe.indexOf(".") == -1) |
		(indirizzo_pe.length < 7))
		{	if (lang == "it") alert("Il campo 'e-mail' non è valido"); 
			else alert("The field 'e-mail' is not valid");
			document.cdg_richiesta_foto.email.focus();
			return false; 
	}
	
/*	L'identificativo deve essere numerico	*/	

	count = 0;
	for (i=0; i<lgid; i++)  {
		car = identi.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  != lgid)	
	{	if (lang == "it") alert("Il campo 'Identificativo' deve essere numerico!");
			else alert("The 'Code' field nust be numeric!");
			document.cdg_richiesta_foto.identificativo.focus();
			return false; 
	}
	
	if (identi < 1 || identi > gl_num_immagini)
	{	if (lang == "it") alert("L'identificativo non corrisponde ad un numero valido di immagine. Il valore deve essere compreso tra 1 e " + gl_num_immagini);
			else alert("The identifier is not valid. The range is [1 - " + gl_num_immagini + "]");
			document.cdg_richiesta_foto.identificativo.focus();
			return false; 
	}
	
	return true;
}

/*	----------------------------------------------------------	*/

/*		Versione del 09-06-2008						*/

function test_aiuto (lang) {		/* Utilizzato in d_aiutaci_modulo_xx.html */

        var nome = document.cdg_aiuto.nome.value;
	var lgno = nome.length;
	
        var cognome = document.cdg_aiuto.cognome.value;
	var lgco = cognome.length;
	
        var indirizzo = document.cdg_aiuto.indirizzo.value;
	var lgind = indirizzo.length;
	
        var cap = document.cdg_aiuto.cap.value;
       	var lgcap = cap.length;
        
        var citta = document.cdg_aiuto.citta.value;
       	var lgcitta = citta.length;
	
        var indirizzo_pe = document.cdg_aiuto.email.value;
	var lgem = indirizzo_pe.length;
	
        var data = document.cdg_aiuto.data.value;
	var lgdata = data.length;
	
	if (lgno == 0)
	{	if (lang == "it") alert("Il campo 'Nome' deve essere riempito!");
		else alert("The 'First name' field must be fill in!");
		document.cdg_aiuto.nome.focus();
		return false; }
		
	if (lgco == 0)
	{	if (lang == "it") alert("Il campo 'Cognome' deve essere riempito!");
		else alert("The 'Name' field must be fill in!");
		document.cdg_aiuto.cognome.focus();
		return false; }
		
	if (lgind == 0)
	{	if (lang == "it") alert("Il campo 'Indirizzo' deve essere riempito!");
		else alert("The 'Address' field must be fill in!");
		document.cdg_aiuto.indirizzo.focus();
		return false; }
		
	if (lgcap == 0)
	{	if (lang == "it") alert("Il campo 'CAP' deve essere riempito!");
		else alert("The 'Postcode' field must be fill in!");
		document.cdg_aiuto.cap.focus();
		return false; }
		
	if (lgcap != 5)
	{	if (lang == "it") alert("La lunghezza del campo 'CAP' deve essere di 5!");
		else alert("The length of the 'Postcode' field must be 5!");
		document.cdg_aiuto.cap.focus();
		return false;
	}	
	else
	{	count = 0;
		for (i=0; i<lgcap; i++)  {
			car = cap.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  != lgcap)	
		{	if (lang == "it") alert("Il campo 'CAP' deve essere numerico!");
			else alert("The 'Postcode' field nust be numeric!");
			document.cdg_aiuto.cap.focus();
			return false; 
		}
	}
		
	if (lgcitta == 0)
	{	if (lang == "it") alert("Il campo 'Città' deve essere riempito!");
		else alert("The 'City' field must be fill in!");
		document.cdg_aiuto.citta.focus();
		return false; }
		
	if (lgem == 0)
	{	if (lang == "it") alert("Il campo 'E-mail' deve essere riempito!");
		else alert("The 'E-mail' field must be fill in!");
		document.cdg_aiuto.email.focus();
		return false; }
		
/*	La campo e-mail deve essere valido	*/

	if ((indirizzo_pe.indexOf("@") == -1) |
		(indirizzo_pe.indexOf(".") == -1) |
		(indirizzo_pe.length < 7))
		{	if (lang == "it") alert("Il campo 'E-MAIL' non è valido"); 
			else alert("The field 'E-MAIL' is not valid");
			document.cdg_aiuto.email.focus();
			return false; 
	}
	
	if (lgdata == 0)
	{	if (lang == "it") alert("Il campo 'Data operazione' deve essere riempito!");
		else alert("The 'Date' field must be fill in!");
		document.cdg_aiuto.data.focus();
		return false; }
		
	return true;
}

/*	----------------------------------------------------------	*/

/*		Versione del ??-?-200?						*/

function test_upload (lang) {		/* Utilizzato in img_upload_xx.html */

        var descrizione = document.cdg_upload_foto.descrizione.value;
	var lgdesc = descrizione.length;
	
	var dimensione = document.cdg_upload_foto.dimensione.value;
	var lgdim = dimensione.length;
	        
	var nome_file = document.cdg_upload_foto.nome_file.value;
       	var lgnf = nome_file.length;
	    
        var nome = document.cdg_upload_foto.nome.value;
	var lgno = nome.length;
	
        var cognome = document.cdg_upload_foto.cognome.value;
	var lgco = cognome.length;
	
        var indirizzo_pe = document.cdg_upload_foto.email.value;
	var lgem = indirizzo_pe.length;
	

	

	if (lgdesc == 0)
	{	if (lang == "it") alert("Il campo 'Descrizione' deve essere riempito!");
		else alert("The 'Description' field must be fill in!");
		document.cdg_upload_foto.descrizione.focus();
		return false; }
		
	if (lgdim == 0)
	{	if (lang == "it") alert("Il campo 'Dimensione' deve essere riempito!");
		else alert("The 'Dimension' field must be fill in!");
		document.cdg_upload_foto.dimensione.focus();
		return false; }
		
	if (lgnf == 0)
	{	if (lang == "it") alert("Il campo 'Nome del file' deve essere riempito!");
		else alert("The 'File name' field must be fill in!");
		document.cdg_upload_foto.nome_file.focus();
		return false; }	
	
	if (lgno == 0)
	{	if (lang == "it") alert("Il campo 'Nome' deve essere riempito!");
		else alert("The 'First name' field must be fill in!");
		document.cdg_upload_foto.nome.focus();
		return false; }
		
	if (lgco == 0)
	{	if (lang == "it") alert("Il campo 'Cognome' deve essere riempito!");
		else alert("The 'Name' field must be fill in!");
		document.cdg_upload_foto.cognome.focus();
		return false; }
		

		
	if (lgem == 0)
	{	if (lang == "it") alert("Il campo 'E-mail' deve essere riempito!");
		else alert("The 'E-mail' field must be fill in!");
		document.cdg_upload_foto.email.focus();
		return false; }
		
/*	La campo e-mail deve essere valido	*/

	if ((indirizzo_pe.indexOf("@") == -1) |
		(indirizzo_pe.indexOf(".") == -1) |
		(indirizzo_pe.length < 7))
		{	if (lang == "it") alert("Il campo 'E-MAIL' non è valido"); 
			else alert("The field 'E-MAIL' is not valid");
			document.cdg_upload_foto.email.focus();
			return false; 
	}
	
	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;	/* In Firefox, 16 pixel	da togliere a window.innerWidth */
	
	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";	/* Non Internet Explorer */

	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;
}	
