var tabs = new Array();
var lastSelectedTab;
var mainImage = new Object();

this.mainImage.images = new Array();
this.mainImage.images.push("images/main_images/docu0001.JPG");
this.mainImage.images.push("images/main_images/docu0002.JPG");
this.mainImage.images.push("images/main_images/docu0003.JPG");
this.mainImage.images.push("images/main_images/docu0004.JPG");
this.mainImage.images.push("images/main_images/docu0005.JPG");
this.mainImage.images.push("images/main_images/docu0006.JPG");
this.mainImage.images.push("images/main_images/docu0007.JPG");
this.mainImage.images.push("images/main_images/docu0008.JPG");
this.mainImage.images.push("images/main_images/docu0009.JPG");
this.mainImage.images.push("images/main_images/docu0010.JPG");
this.mainImage.images.push("images/main_images/docu0011.JPG");
this.mainImage.images.push("images/main_images/docu0012.JPG");
this.mainImage.images.push("images/main_images/docu0013.JPG");
this.mainImage.images.push("images/main_images/docu0014.JPG");
this.mainImage.images.push("images/main_images/docu0015.JPG");
this.mainImage.images.push("images/main_images/docu0016.JPG");
this.mainImage.images.push("images/main_images/docu0017.JPG");
this.mainImage.images.push("images/main_images/docu0018.JPG");
this.mainImage.images.push("images/main_images/docu0019.JPG");
this.mainImage.images.push("images/main_images/docu0020.JPG");
this.mainImage.images.push("images/main_images/docu0021.JPG");
this.mainImage.images.push("images/main_images/docu0022.JPG");
this.mainImage.images.push("images/main_images/docu0023.JPG");
this.mainImage.images.push("images/main_images/docu0024.JPG");
this.mainImage.images.push("images/main_images/docu0025.JPG");
this.mainImage.images.push("images/main_images/docu0026.JPG");
this.mainImage.images.push("images/main_images/docu0027.JPG");
this.mainImage.images.push("images/main_images/docu0028.JPG");
this.mainImage.images.push("images/main_images/docu0029.JPG");
this.mainImage.images.push("images/main_images/docu0030.JPG");
this.mainImage.images.push("images/main_images/docu0031.JPG");
this.mainImage.images.push("images/main_images/docu0032.JPG");
this.mainImage.images.push("images/main_images/docu0033.JPG");
this.mainImage.images.push("images/main_images/docu0034.JPG");
this.mainImage.images.push("images/main_images/docu0035.JPG");
this.mainImage.images.push("images/main_images/docu0036.JPG");
this.mainImage.images.push("images/main_images/docu0037.JPG");
this.mainImage.images.push("images/main_images/docu0038.JPG");
this.mainImage.images.push("images/main_images/docu0039.JPG");
this.mainImage.images.push("images/main_images/docu0040.JPG");
this.mainImage.images.push("images/main_images/docu0041.JPG");
this.mainImage.images.push("images/main_images/docu0042.JPG");
this.mainImage.images.push("images/main_images/docu0043.JPG");
this.mainImage.images.push("images/main_images/docu0044.JPG");
this.mainImage.images.push("images/main_images/docu0046.JPG");
this.mainImage.images.push("images/main_images/docu0047.JPG");
this.mainImage.images.push("images/main_images/docu0048.JPG");
this.mainImage.images.push("images/main_images/docu0049.JPG");
this.mainImage.images.push("images/main_images/docu0050.JPG");
this.mainImage.images.push("images/main_images/docu0051.JPG");
this.mainImage.images.push("images/main_images/docu0052.JPG");
this.mainImage.images.push("images/main_images/docu0053.JPG");
this.mainImage.images.push("images/main_images/docu0054.JPG");
this.mainImage.images.push("images/main_images/docu0055.JPG");
this.mainImage.images.push("images/main_images/docu0056.JPG");
this.mainImage.index = -1;

function changeMainImage() {	
	if (++this.mainImage.index >= this.mainImage.images.length) {
		this.mainImage.index = 0;
	}
	document.getElementById("main_image").src = this.mainImage.images[this.mainImage.index];
	setTimeout("changeMainImage()", 3000);
}

function registerTab(tab, def) {
	var id = tab.id;
	var ob = null;
	for (var i = 0; i < this.tabs.length; i++) {
		if (this.tabs[i].id == id) {
			ob = this.tabs[i];
			break;
		}
	}
	if (ob == null) {
		ob = new Object();
		ob.id = id
		ob.isSelected = def;
		ob.selected = "images/tab_" + id + "_selected.gif";
		ob.not_selected = "images/tab_" + id + ".gif";
		ob.focused = "images/tab_" + id + "_focused.gif";
		ob.page = id + ".html";
		this.tabs.push(ob);
		if (def) {
			this.lastSelectedTab = new Object();
			this.lastSelectedTab.tab = tab;
			this.lastSelectedTab.item = ob;
			document.getElementById("page").src = ob.page;
		}
		tab.src = def ? ob.selected : ob.not_selected;
	}
	else {
		return;
	}	
}

function selectTab(tab) {	
	var id = tab.id;
	if (this.lastSelectedTab.tab.id != id) {
		var ob = null;
		for (var i = 0; i < this.tabs.length; i++) {
			if (this.tabs[i].id == id) {
				ob = this.tabs[i];
				break;
			}
		}
		if (ob != null) {
			this.lastSelectedTab.item.isSelected = false;
			this.lastSelectedTab.tab.src = this.lastSelectedTab.item.not_selected;
			
			tab.src = ob.selected;
			this.lastSelectedTab.tab = tab;
			this.lastSelectedTab.item = ob;
			ob.isSelected = true;
			document.getElementById("page").src = ob.page;
		}
	}
}

function getAndSelectTab(id) {
	var ob = document.getElementById(id);
	selectTab(ob);
}

function focusTab(tab, focused) {
	var id = tab.id;
	var ob = null;
	for (var i = 0; i < this.tabs.length; i++) {
		if (this.tabs[i].id == id) {
			ob = this.tabs[i];
			break;
		}
	}
	if (ob != null) {
		if (!ob.isSelected) {
			tab.src = focused ? ob.focused : ob.not_selected;
		}
	}
}

function englishVersion(object, focused) {
	if (focused) {
		object.src = "images/english_version_focused.jpg";
	}
	else {
		object.src = "images/english_version.jpg";
	}
}

function fillMapAlt() {
	var tab = "\t";
	var crlf = "\n";
	var alt;
	
	// Val D'Aosta
	alt = "";
	document.getElementById("val_d_aosta").alt = alt;
	document.getElementById("val_d_aosta").title = alt;
	
	// Piemonte
	alt = getMapAltHeader("Piemonte", 1, "9");
	alt += getMapAltCity("Alessandria", 2, "437", true);
	alt += getMapAltCity("Cavaglia'", 2, "299", true);
	alt += getMapAltCity("Cervere", 3, "259", true);
	alt += getMapAltCity("Cuneo", 3, "182", true);
	alt += getMapAltCity("Leini'", 3, "362", true);
	alt += getMapAltCity("San Pietro Mosezzo", 1, "414", true);
	alt += getMapAltCity("Settimo Torinese", 1, "200", true);
	alt += getMapAltCity("Torino", 3, "917", true);
	alt += getMapAltCity("Tortona", 3, "208", false);
//	alt += getMapAltCity("Crevoladossola", 2, "66", true);
//	alt += getMapAltCity("Diano D'Alba", 2, "76", true);
//	alt += getMapAltCity("Verrone", 3, "150", false);
	document.getElementById("piemonte").alt = alt;
	document.getElementById("piemonte").title = alt;
	
	// Lombardia
	alt = getMapAltHeader("Lombardia", 1, "14");
	alt += getMapAltCity("Abbiategrasso", 2, "125", true);
	alt += getMapAltCity("Azzano San Paolo", 1, "600", true);
	alt += getMapAltCity("Berbenno in Valtellina", 1, "153", true);
	alt += getMapAltCity("Brescia", 3, "643", true);
	alt += getMapAltCity("Cassano Magnago", 1, "373", true);
	alt += getMapAltCity("Como", 3, "264", true);
	alt += getMapAltCity("Cremona", 2, "294", true);
	alt += getMapAltCity("Cura Carpignano-Pavia", 1, "399", true);
	alt += getMapAltCity("Lainate", 3, "295", true);
	alt += getMapAltCity("Milano", 3, "668", true);
	alt += getMapAltCity("Mantova", 2, "240", true);
	alt += getMapAltCity("Nova Milanese", 2, "272", true);
	alt += getMapAltCity("Oggiono", 2, "247", true);
	alt += getMapAltCity("Paderno Dugnano", 1, "444", false);
//	alt += getMapAltCity("Cardano al Campo", 1, "132", true);
//	alt += getMapAltCity("Lodi", 3, "170", true);
//	alt += getMapAltCity("Saronno", 2, "106", true);
//	alt += getMapAltCity("San Genesio e Uniti", 1, "329", true);
//	alt += getMapAltCity("Varese", 3, "229", true);
//	alt += getMapAltCity("Vigevano", 2, "55", false);
	document.getElementById("lombardia").alt = alt;
	document.getElementById("lombardia").title = alt;
	
	// Trentino Alto Adige
	alt = getMapAltHeader("Trentino Alto Adige", 1, "3");	
	alt += getMapAltCity("Arco", 4, "73", true);
	alt += getMapAltCity("Bolzano", 4, "310", true);
	alt += getMapAltCity("Gardolo", 4, "356", false);
	document.getElementById("trentino_alto_adige").alt = alt;
	document.getElementById("trentino_alto_adige").title = alt;
	
	// Veneto
	alt = getMapAltHeader("Veneto", 3, "11");
	alt += getMapAltCity("Arino di Dolo", 3, "64", true);
	alt += getMapAltCity("Belluno", 4, "148", true);
	alt += getMapAltCity("Chioggia", 3, "42", true);
	alt += getMapAltCity("Feltre", 4, "49", true);
	alt += getMapAltCity("Jesolo", 4, "131", true);
	alt += getMapAltCity("Padova - Zona Industriale", 1, "420", true);
	alt += getMapAltCity("Silea - Treviso", 3, "427", true);
	alt += getMapAltCity("Thiene", 4, "147", true);
	alt += getMapAltCity("Venezia Mestre", 3, "297", true);
	alt += getMapAltCity("Vicenza", 4, "350", true);
	alt += getMapAltCity("Verona", 4, "559", false);
//	alt += getMapAltCity("Cassolo", 4, "91", true);
//	alt += getMapAltCity("Portogruaro", 3, "131", true);
	document.getElementById("veneto").alt = alt;
	document.getElementById("veneto").title = alt;
	
	// Friuli Venezia Giulia
	alt = getMapAltHeader("Friuli Venezia Giulia", 1, "3");
	alt += getMapAltCity("Monfalcone", 3, "322", true);
	alt += getMapAltCity("Pordenone", 3, "258", true);
	alt += getMapAltCity("Udine", 4, "497", false);
//	alt += getMapAltCity("Gorizia(Piedimonte)", 2, "85", true);
	document.getElementById("friuli_venezia_giulia").alt = alt;
	document.getElementById("friuli_venezia_giulia").title = alt;
	
	// Liguria
	alt = getMapAltHeader("Liguria", 2, "7");
	alt += getMapAltCity("Borghetto S.Spirito", 1, "120", true);
	alt += getMapAltCity("Carasco", 3, "141", true);
	alt += getMapAltCity("Genova", 3, "454", true);
	alt += getMapAltCity("Imperia", 3, "80", true);
	alt += getMapAltCity("La Spezia", 2, "210", true);
	alt += getMapAltCity("San Remo", 2, "114", true);
	alt += getMapAltCity("Vado Ligure", 2, "160", false);
//	alt += getMapAltCity("Albenga", 3, "78", true);
//	alt += getMapAltCity("Loano", 3, "58", true);
	document.getElementById("liguria").alt = alt;
	document.getElementById("liguria").title = alt;
	
	// Emilia Romagna
	alt = getMapAltHeader("Emilia Romagna", 1, "8");
	alt += getMapAltCity("Bologna", 3, "592", true);
	alt += getMapAltCity("Cervia", 3, "45", true);
	alt += getMapAltCity("Modena", 3, "303", true);
	alt += getMapAltCity("Piacenza", 2, "160", true);
	alt += getMapAltCity("Parma", 3, "711", true);
	alt += getMapAltCity("Pontelagoscuro", 2, "390", true);
	alt += getMapAltCity("Ravenna", 2, "130", true);
	alt += getMapAltCity("Santarcangelo Romagna", 1, "589", false);
//	alt += getMapAltCity("Cesena", 3, "58", true);
//	alt += getMapAltCity("Imola", 3, "150", true);
//	alt += getMapAltCity("Forlì", 3, "96", true);
//	alt += getMapAltCity("Reggio Emilia", 2, "283", true);
	document.getElementById("emilia_romagna").alt = alt;
	document.getElementById("emilia_romagna").title = alt;
	
	// Toscana
	alt = getMapAltHeader("Toscana", 2, "8");
	alt += getMapAltCity("Borgo San Lorenzo", 1, "47", true);
	alt += getMapAltCity("Calenzano", 2, "687", true);
	alt += getMapAltCity("Grosseto", 2, "97", true);
	alt += getMapAltCity("Isola d'Arbia", 2, "314", true);
	alt += getMapAltCity("Livorno", 3, "277", true);
	alt += getMapAltCity("Macciano - Chiusi", 1, "62", true);
	alt += getMapAltCity("Migliarino Pisano", 2, "677", true);
	alt += getMapAltCity("Piombino", 2, "177", true);
//	alt += getMapAltCity("Arezzo", 3, "156", true);
//	alt += getMapAltCity("Massa Carrara", 2, "148", true);
//	alt += getMapAltCity("Pisa", 3, "109", true);
//	alt += getMapAltCity("Pontedera", 2, "170", true);
//	alt += getMapAltCity("Prato", 3, "2", "124", true);
//	alt += getMapAltCity("Volterra", 3, "24", false);
	document.getElementById("toscana_1").alt = alt;
	document.getElementById("toscana_1").title = alt;
	document.getElementById("toscana_2").alt = alt;
	document.getElementById("toscana_2").title = alt;
	
	// Umbria
	alt = getMapAltHeader("Umbria", 2, "2");
	alt += getMapAltCity("Città di Castello", 2, "50", true);
	alt += getMapAltCity("Spoleto", 3, "554", true);
//	alt += getMapAltCity("Perugia", 3, "266", true);
//	alt += getMapAltCity("Terni", 3, "192", false);
	document.getElementById("umbria").alt = alt;
	document.getElementById("umbria").title = alt;
	
	// Marche
	alt = getMapAltHeader("Marche", 3, "3");
	alt += getMapAltCity("Ancona", 4, "572", true);
	alt += getMapAltCity("Ascoli Piceno", 3, "249", true);
	alt += getMapAltCity("Fano", 4, "48", true);
//	alt += getMapAltCity("Fabriano", 3, "20", true);
//	alt += getMapAltCity("Fermo - Paludi San Marco", 1, "208", true);
//	alt += getMapAltCity("Pesaro", 4, "231", true);
//	alt += getMapAltCity("Pollenza", 4, "184", false);
	document.getElementById("marche").alt = alt;
	document.getElementById("marche").title = alt;
	
	// Lazio
	alt = getMapAltHeader("Lazio", 2, "7");
	alt += getMapAltCity("Frosinone", 2, "256", true);
	alt += getMapAltCity("Ladispoli", 2, "200", true);
	alt += getMapAltCity("Padiglione di Anzio", 1, "471", true);
	alt += getMapAltCity("Rieti", 3, "131", true);
	alt += getMapAltCity("Roma", 3, "962", true);
	alt += getMapAltCity("Villa Adriano - Tivoli", 1, "330", true);
	alt += getMapAltCity("Viterbo", 3, "159", false);
//	alt += getMapAltCity("Albano Laziale", 2, "914", true);
	document.getElementById("lazio").alt = alt;
	document.getElementById("lazio").title = alt;
	
	// Abruzzo
	alt = getMapAltHeader("Abruzzo", 2, "4");
	alt += getMapAltCity("Cappelle dei Marsi", 1, "171", true);
	alt += getMapAltCity("L'Aquila", 3, "81", true);
	alt += getMapAltCity("Pescara", 3, "482", true);
	alt += getMapAltCity("Vasto", 3, "168", true);
//	alt += getMapAltCity("Villanova di Cepagatti", 1, "355", false);
	document.getElementById("abruzzo").alt = alt;
	document.getElementById("abruzzo").title = alt;
	
	// Molise
	alt = getMapAltHeader("Molise", 1, "1");
	alt += getMapAltCity("Ripalimosani", 1, "76", false);
	document.getElementById("molise").alt = alt;
	document.getElementById("molise").title = alt;
	
	// Campania
	alt = getMapAltHeader("Campania", 2, "5");
	alt += getMapAltCity("Apollosa", 2, "126", true);
	alt += getMapAltCity("Eboli", 3, "547", true);
	alt += getMapAltCity("Manocalzati", 2, "235", true);
	alt += getMapAltCity("Napoli", 3, "1101", true);
	alt += getMapAltCity("Teverola", 2, "416", true);
//	alt += getMapAltCity("Fisciano", 3, "412", true);
//	alt += getMapAltCity("Marzano Appio", 2, "234", true);
//	alt += getMapAltCity("Trecase", 3, "24", false);
	document.getElementById("campania").alt = alt;
	document.getElementById("campania").title = alt;
	

	// Puglia
	alt = getMapAltHeader("Puglia", 3, "4");
	alt += getMapAltCity("Bari", 4, "852", true);
	alt += getMapAltCity("Lecce", 4, "596", true);
	alt += getMapAltCity("Manfredonia (Loc. Capparelli)", 1, "84", true);
	alt += getMapAltCity("Taranto", 4, "174", true);
//	alt += getMapAltCity("Barletta", 4, "289", true);
//	alt += getMapAltCity("Brindisi", 4, "133", true);
//	alt += getMapAltCity("Modugno", 3, "562", true);
//	alt += getMapAltCity("Trani", 4, "55", false);
	document.getElementById("puglia").alt = alt;
	document.getElementById("puglia").title = alt;
	
	// Basilicata
	alt = getMapAltHeader("Basilicata", 2, "2");
	alt += getMapAltCity("Matera", 3, "181", true);
	alt += getMapAltCity("Polla - Zona Ind.", 2, "214", true);
//	alt += getMapAltCity("Potenza", 3, "219", false);
	document.getElementById("basilicata").alt = alt;
	document.getElementById("basilicata").title = alt;
	
	// Calabria
	alt = getMapAltHeader("Calabria", 3, "3");
	alt += getMapAltCity("Lamezia Terme", 3, "418", true);
	alt += getMapAltCity("Pellaro - Reggio Calabria", 2, "302", true);
	alt += getMapAltCity("Zumpano", 3, "370", false);
//	alt += getMapAltCity("Gioia Tauro", 3, "276", true);
	document.getElementById("calabria").alt = alt;
	document.getElementById("calabria").title = alt;
	
	// Sicilia
	alt = getMapAltHeader("Sicilia", 1, "5");
	alt += getMapAltCity("Agrigento", 1, "157", true);
	alt += getMapAltCity("Catania", 2, "660", true);
	alt += getMapAltCity("Enna Bassa", 1, "169", true);
	alt += getMapAltCity("Ficarazzi", 1, "591", true);
	alt += getMapAltCity("Messina", 2, "344", true);
//	alt += getMapAltCity("Palermo", 2, "575", false);
	document.getElementById("sicilia").alt = alt;
	document.getElementById("sicilia").title = alt;
	
	// Sardegna
	alt = getMapAltHeader("Sardegna", 3, "5");
	alt += getMapAltCity("Alghero - Regione Galboneddu", 1, "217", true);
	alt += getMapAltCity("Cagliari - Elmas", 3, "505", true);
	alt += getMapAltCity("Nuoro", 4, "123", true);
	alt += getMapAltCity("Olbia", 4, "105", true);
	alt += getMapAltCity("Oristano", 3, "149", false);
//	alt += getMapAltCity("Sassari", 4, "109", false);
	document.getElementById("sardegna").alt = alt;
	document.getElementById("sardegna").title = alt;
}
function fillMapAltOld() {
	var tab = "\t";
	var crlf = "\n";
	var alt;
	
	// Val D'Aosta
	alt = "";
	document.getElementById("val_d_aosta").alt = alt;
	document.getElementById("val_d_aosta").title = alt;
	
	// Piemonte
	alt = getMapAltHeader("Piemonte", 1, "11");
	alt += getMapAltCity("Alessandria", 2, "481", true);
	alt += getMapAltCity("Cavaglia'", 2, "184", true);
	alt += getMapAltCity("Cervere", 3, "162", true);
	alt += getMapAltCity("Crevoladossola", 2, "66", true);
	alt += getMapAltCity("Cuneo", 3, "234", true);
	alt += getMapAltCity("Diano D'Alba", 2, "76", true);
	alt += getMapAltCity("Leini'", 3, "393", true);
	alt += getMapAltCity("San Pietro Mosezzo", 1, "385", true);
	alt += getMapAltCity("Settimo Torinese", 1, "910", true);
	alt += getMapAltCity("Tortona", 3, "74", true);
	alt += getMapAltCity("Verrone", 3, "150", false);
	document.getElementById("piemonte").alt = alt;
	document.getElementById("piemonte").title = alt;
	
	// Lombardia
	alt = getMapAltHeader("Lombardia", 1, "18");
	alt += getMapAltCity("Abbiategrasso", 2, "110", true);
	alt += getMapAltCity("Azzano San Paolo", 1, "620", true);
	alt += getMapAltCity("Berbenno in Valtellina", 1, "170", true);
	alt += getMapAltCity("Brescia", 3, "612", true);
	alt += getMapAltCity("Cardano al Campo", 1, "132", true);
	alt += getMapAltCity("Cassano Magnago", 1, "176", true);
	alt += getMapAltCity("Como", 3, "257", true);
	alt += getMapAltCity("Cremona", 2, "176", true);
	alt += getMapAltCity("Lodi", 3, "170", true);
	alt += getMapAltCity("Milano", 3, "790", true);
	alt += getMapAltCity("Mantova", 2, "233", true);
	alt += getMapAltCity("Nova Milanese", 2, "253", true);
	alt += getMapAltCity("Oggiono", 2, "235", true);
	alt += getMapAltCity("Paderno Dugnano", 1, "507", true);
	alt += getMapAltCity("Saronno", 2, "106", true);
	alt += getMapAltCity("San Genensio e Uniti", 1, "329", true);
	alt += getMapAltCity("Varese", 3, "229", true);
	alt += getMapAltCity("Vigevano", 2, "55", false);
	document.getElementById("lombardia").alt = alt;
	document.getElementById("lombardia").title = alt;
	
	// Trentino Alto Adige
	alt = getMapAltHeader("Trentino Alto Adige", 1, "3");	
	alt += getMapAltCity("Arco", 4, "87", true);
	alt += getMapAltCity("Bolzano", 4, "520", true);
	alt += getMapAltCity("Gardolo", 4, "412", false);
	document.getElementById("trentino_alto_adige").alt = alt;
	document.getElementById("trentino_alto_adige").title = alt;
	
	// Veneto
	alt = getMapAltHeader("Veneto", 3, "13");
	alt += getMapAltCity("Arino di Dolo", 3, "74", true);
	alt += getMapAltCity("Belluno", 4, "163", true);
	alt += getMapAltCity("Cassolo", 4, "91", true);
	alt += getMapAltCity("Chioggia", 3, "54", true);
	alt += getMapAltCity("Feltre", 4, "51", true);
	alt += getMapAltCity("Jesolo", 4, "123", true);
	alt += getMapAltCity("Padova - Zona Industriale", 1, "402", true);
	alt += getMapAltCity("Portogruaro", 3, "131", true);
	alt += getMapAltCity("Silea - Treviso", 3, "431", true);
	alt += getMapAltCity("Thiene", 4, "154", true);
	alt += getMapAltCity("Venezia Mestre", 3, "312", true);
	alt += getMapAltCity("Vicenza", 4, "242", true);
	alt += getMapAltCity("Verona", 4, "546", false);
	document.getElementById("veneto").alt = alt;
	document.getElementById("veneto").title = alt;
	
	// Friuli Venezia Giulia
	alt = getMapAltHeader("Friuli Venezia Giulia", 1, "4");
	alt += getMapAltCity("Gorizia(Piedimonte)", 2, "85", true);
	alt += getMapAltCity("Monfalcone", 3, "294", true);
	alt += getMapAltCity("Pordenone", 3, "224", true);
	alt += getMapAltCity("Udine", 4, "439", false);
	document.getElementById("friuli_venezia_giulia").alt = alt;
	document.getElementById("friuli_venezia_giulia").title = alt;
	
	// Liguria
	alt = getMapAltHeader("Liguria", 2, "7");
	alt += getMapAltCity("Albenga", 3, "78", true);
	alt += getMapAltCity("Genova", 3, "697", true);
	alt += getMapAltCity("Imperia", 3, "48", true);
	alt += getMapAltCity("La Spezia", 2, "238", true);
	alt += getMapAltCity("Loano", 3, "58", true);
	alt += getMapAltCity("San Remo", 2, "165", true);
	alt += getMapAltCity("Vado Ligure", 2, "210", false);
	document.getElementById("liguria").alt = alt;
	document.getElementById("liguria").title = alt;
	
	// Emilia Romagna
	alt = getMapAltHeader("Emilia Romagna", 1, "12");
	alt += getMapAltCity("Bologna", 3, "450", true);
	alt += getMapAltCity("Cervia", 3, "85", true);
	alt += getMapAltCity("Cesena", 3, "58", true);
	alt += getMapAltCity("Imola", 3, "150", true);

	alt += getMapAltCity("Forlì", 3, "96", true);
	alt += getMapAltCity("Modena", 3, "272", true);
	alt += getMapAltCity("Piacenza", 2, "155", true);
	alt += getMapAltCity("Parma", 3, "385", true);
	alt += getMapAltCity("Pontelagoscuro", 2, "398", true);
	alt += getMapAltCity("Ravenna", 2, "149", true);
	alt += getMapAltCity("Reggio Emilia", 2, "283", true);
	alt += getMapAltCity("Santarcangelo Romagna", 1, "246", false);
	document.getElementById("emilia_romagna").alt = alt;
	document.getElementById("emilia_romagna").title = alt;
	
	// Toscana
	alt = getMapAltHeader("Toscana", 2, "14");
	alt += getMapAltCity("Arezzo", 3, "156", true);
	alt += getMapAltCity("Borgo San Lorenzo", 1, "47", true);
	alt += getMapAltCity("Calenzano", 2, "554", true);
	alt += getMapAltCity("Grosseto", 2, "111", true);
	alt += getMapAltCity("Isola d'Arbia", 2, "149", true);

	alt += getMapAltCity("Livorno", 3, "116", true);
	alt += getMapAltCity("Macciano - Chiusi", 1, "67", true);
	alt += getMapAltCity("Massa Carrara", 2, "148", true);
	alt += getMapAltCity("Migliarino Pisano", 2, "395", true);
	alt += getMapAltCity("Pisa", 3, "109", true);
	alt += getMapAltCity("Piombino", 2, "239", true);
	alt += getMapAltCity("Pontedera", 2, "170", true);
	alt += getMapAltCity("Prato", 3, "2", "124", true);
	alt += getMapAltCity("Volterra", 3, "24", false);
	document.getElementById("toscana_1").alt = alt;
	document.getElementById("toscana_1").title = alt;
	document.getElementById("toscana_2").alt = alt;
	document.getElementById("toscana_2").title = alt;
	
	// Umbria
	alt = getMapAltHeader("Umbria", 2, "4");
	alt += getMapAltCity("Città di Castello", 2, "74", true);
	alt += getMapAltCity("Perugia", 3, "266", true);
	alt += getMapAltCity("Spoleto", 3, "128", true);
	alt += getMapAltCity("Terni", 3, "192", false);
	document.getElementById("umbria").alt = alt;
	document.getElementById("umbria").title = alt;
	
	// Marche
	alt = getMapAltHeader("Marche", 3, "7");
	alt += getMapAltCity("Ancona", 4, "373", true);
	alt += getMapAltCity("Ascoli Piceno", 3, "146", true);
	alt += getMapAltCity("Fabriano", 3, "20", true);
	alt += getMapAltCity("Fano", 4, "57", true);
	alt += getMapAltCity("Fermo - Paludi San Marco", 1, "208", true);
	alt += getMapAltCity("Pesaro", 4, "231", true);
	alt += getMapAltCity("Pollenza", 4, "184", false);
	document.getElementById("marche").alt = alt;
	document.getElementById("marche").title = alt;
	
	// Lazio
	alt = getMapAltHeader("Lazio", 2, "7");
	alt += getMapAltCity("Albano Laziale", 2, "914", true);
	alt += getMapAltCity("Frosinone", 2, "236", true);
	alt += getMapAltCity("Ladispoli", 2, "205", true);
	alt += getMapAltCity("Padiglione di Anzio", 1, "298", true);
	alt += getMapAltCity("Rieti", 3, "123", true);
	alt += getMapAltCity("Villa Adriano - Tivoli", 1, "310", true);
	alt += getMapAltCity("Viterbo", 3, "152", false);
	document.getElementById("lazio").alt = alt;
	document.getElementById("lazio").title = alt;
	
	// Abruzzo
	alt = getMapAltHeader("Abruzzo", 2, "4");
	alt += getMapAltCity("Cappelle dei Marsi", 1, "186", true);
	alt += getMapAltCity("L'Aquila", 3, "102", true);
	alt += getMapAltCity("Vasto", 3, "283", true);
	alt += getMapAltCity("Villanosa di Cepagatti", 1, "355", false);
	document.getElementById("abruzzo").alt = alt;
	document.getElementById("abruzzo").title = alt;
	
	// Molise
	alt = getMapAltHeader("Molise", 1, "1");
	alt += getMapAltCity("Ripalimosani", 1, "103", false);
	document.getElementById("molise").alt = alt;
	document.getElementById("molise").title = alt;
	
	// Campania
	alt = getMapAltHeader("Campania", 2, "8");
	alt += getMapAltCity("Apollosa", 2, "141", true);
	alt += getMapAltCity("Eboli", 3, "565", true);
	alt += getMapAltCity("Fisciano", 3, "412", true);
	alt += getMapAltCity("Manocalzati", 2, "276", true);
	alt += getMapAltCity("Marzano Appio", 2, "234", true);
	alt += getMapAltCity("Napoli", 3, "772", true);
	alt += getMapAltCity("Teverola", 2, "292", true);
	alt += getMapAltCity("Trecase", 3, "24", false);
	document.getElementById("campania").alt = alt;
	document.getElementById("campania").title = alt;
	
	// Puglia
	alt = getMapAltHeader("Puglia", 3, "7");
	alt += getMapAltCity("Barletta", 4, "289", true);
	alt += getMapAltCity("Brindisi", 4, "133", true);
	alt += getMapAltCity("Lecce", 4, "535", true);
	alt += getMapAltCity("Manfredonia (Loc. Capparelli)", 1, "208", true);
	alt += getMapAltCity("Modugno", 3, "562", true);
	alt += getMapAltCity("Taranto", 4, "190", true);
	alt += getMapAltCity("Trani", 4, "55", false);
	document.getElementById("puglia").alt = alt;
	document.getElementById("puglia").title = alt;
	
	// Basilicata
	alt = getMapAltHeader("Basilicata", 2, "3");
	alt += getMapAltCity("Matera", 3, "205", true);
	alt += getMapAltCity("Polla - Zona Ind.", 2, "62", true);
	alt += getMapAltCity("Potenza", 3, "219", false);
	document.getElementById("basilicata").alt = alt;
	document.getElementById("basilicata").title = alt;
	
	// Calabria
	alt = getMapAltHeader("Calabria", 3, "4");
	alt += getMapAltCity("Gioia Tauro", 3, "276", true);
	alt += getMapAltCity("Lamezia Terme", 3, "271", true);
	alt += getMapAltCity("Pellaro - Reggio Calabria", 2, "283", true);
	alt += getMapAltCity("Zumpano", 3, "413", false);
	document.getElementById("calabria").alt = alt;
	document.getElementById("calabria").title = alt;
	
	// Sicilia
	alt = getMapAltHeader("Sicilia", 1, "5");
	alt += getMapAltCity("Agrigento", 1, "216", true);
	alt += getMapAltCity("Catania", 2, "772", true);
	alt += getMapAltCity("Enna Bassa", 1, "161", true);
	alt += getMapAltCity("Messina", 2, "421", true);
	alt += getMapAltCity("Palermo", 2, "575", false);
	document.getElementById("sicilia").alt = alt;
	document.getElementById("sicilia").title = alt;
	
	// Sardegna
	alt = getMapAltHeader("Sardegna", 3, "6");
	alt += getMapAltCity("Alghero - Regione Galboneddu", 1, "86", true);
	alt += getMapAltCity("Cagliari - Elmas", 3, "489", true);
	alt += getMapAltCity("Nuoro", 4, "159", true);
	alt += getMapAltCity("Olbia", 4, "150", true);
	alt += getMapAltCity("Oristano", 3, "130", true);
	alt += getMapAltCity("Sassari", 4, "109", false);
	document.getElementById("sardegna").alt = alt;
	document.getElementById("sardegna").title = alt;
}

function getMapAltHeader(name, distance, dl) {
	var result = name;
	result += " - "
	result += dl;	
	result += " DL";
	for (var i = 0; i < distance; i++) {
		result += "\t";
	}
	result += "Rivendite";
	result += "\n\n";
	return result;
}

function getMapAltCity(name, distance, rivendite, crlf) {
	var result = name;
	for (var i = 0; i < distance; i++) {
		result += "\t";
	}
	result += rivendite;
	if (crlf) {
		result += "\n";
	}
	return result;
}

function doLoginAE() {
	var username = document.getElementById("area_editori.username");
	var password = document.getElementById("area_editori.password");
	var checked = true;
	var message = "ATTENZIONE! I seguenti campi devono essere valorizzati\n";
	var ieCheck = (username.getAttribute('class') == null);
	if (username.value == "") {
		checked = false;
		message += "- Username\n";
		var classAttribute = username.getAttribute(ieCheck ? "className" : "class");
		classAttribute += " required";
		username.setAttribute(ieCheck ? "className" : "class", classAttribute);
	}
	else {
		var classAttribute = username.getAttribute(ieCheck ? "className" : "class");
		var index = classAttribute.indexOf("required");
		if (index != -1) {
			classAttribute = classAttribute.substr(0, classAttribute.indexOf("required") - 1);
			username.setAttribute(ieCheck ? "className" : "class", classAttribute);
		}		
	}
	if (password.value == "") {
		checked = false;
		message += "- Password\n";
		var classAttribute = password.getAttribute(ieCheck ? "className" : "class");
		classAttribute += " required";
		password.setAttribute(ieCheck ? "className" : "class", classAttribute);
	}
	else {
		var classAttribute = password.getAttribute(ieCheck ? "className" : "class");
		var index = classAttribute.indexOf("required");
		if (index != -1) {
			classAttribute = classAttribute.substr(0, classAttribute.indexOf("required") - 1);
			password.setAttribute(ieCheck ? "className" : "class", classAttribute);
		}
	}
	if (checked) {
		var dxpData = "<dxp:dxp xmlns:dxp=\"http://www.dpe.it/dxp/1.0/spec.html\" id=\"data\">";
		dxpData += "<dxp:single-value id=\"username\">";
		dxpData += makeCompliance(username.value);
		dxpData += "</dxp:single-value>";
		dxpData += "<dxp:single-value id=\"password\">";
		dxpData += makeCompliance(password.value);
		dxpData += "</dxp:single-value>";
		dxpData += "</dxp:dxp>";
		var dxpState = "<dxp:dxp xmlns:dxp=\"http://www.dpe.it/dxp/1.0/spec.html\" id=\"state\">";
		dxpState += "<dxp:single-value id=\"username\">";
		dxpState += makeCompliance(username.value);
		dxpState += "</dxp:single-value>";
		dxpState += "</dxp:dxp>";
		var caller = document.getElementById("caller");
		for (var i = 0, n = caller.elements.length; i < n; i++) {
			if (caller.elements[i].id == "module") {
				caller.elements[i].value = "home";
			}
			else if (caller.elements[i].id == "dxp_data") {
				caller.elements[i].value = dxpData;
			}
			else if (caller.elements[i].id == "dxp_state") {
				caller.elements[i].value = dxpState;
			}
		}
		caller.submit();
	}
	else {
		alert(message);
	}
}

