var toolsHigh; // altezza menu tools massima
var areasHigh; // altezza menu areas massima
var toolsLength; // numero variabile voci menu tools
var areasLength; // numero variabile voci menu areas
var toolsHeight; // altezza variabile menu tools
var areasHeight; // altezza variabile menu tools
var tmp_tools_id = 0; // indica la posizione (temporanea) su una voce menu tools
var tmp_areas_id = 0; // indica la posizione (temporanea) su una voce menu areas
var tools_id = 0; // indica la posizione (fissa) su una voce menu tools
var areas_id = 0; // indica la posizione (fissa) su una voce menu areas
var areasId = "all"; // valore default se il menu areas non viene selezionato
var toolsId = "all"; // valore default se il menu tools non viene selezionato
var selectedAreas; // valore per la ricerca a database, selezionato con onclick
var selectedTools; // valore per la ricerca a database, selezionato con onclick
var tools_div = 0; // valore che indica il passaggio da un menu all'altro 0,1
var areas_div = 0; // valore che indica il passaggio da un menu all'altro 0,1
var tmp_areas_time = 0; // timeout per movimenti su menu areas
var tmp_tools_time = 0; // timeout per movimenti su menu tools
var tab_search = 0; // init per switchare da un tab all'altro di search.asp
var ricercaAnno = new Array;
var menuMoved = 0; // posizione del menu iniziale 0,1
var initFade;
var onPage = 0;
var riceTools = 0; // valore che indica se ho già selezionato dal menu Tools del motore
var riceAreas = 0; // valore che indica se ho già selezionato dal menu Areas del motore
var listResult = [];
var pageResult = [];
var yearResult = [];
var nPage = 10;
var tmpPage;
var selection;
var mainPic;
var picTop;
var formInit = 0;
var formTool = 0;
//--------------------------------------
var listResult1995 = [];
var listResult1996 = [];
var listResult1997 = [];
var listResult1998 = [];
var listResult1999 = [];
var listResult2000 = [];
var listResult2001 = [];
var listResult2002 = [];
var listResult2003 = [];
var listResult2004 = [];
var listResult2005 = [];
var listResult2006 = [];
var listResult2007 = [];
var listResult2008 = [];
var m;
var n;

/* 
########################################################################
 HOMEPAGE
########################################################################
*/

function loadRndImg(i){ // Load a random image for the homepage blocks

	var ajax = new sack();	

	function loadRndImg_completed(){
		processQueue(ajax.response);
		setTimeout("loadRndImg(" + i + ")", 5000);
	}
	
	if (menuMoved == 0) {	
		ajax.encVar("action", "RANDOMPIC");
		ajax.encVar("i", i);
		ajax.requestFile = "/common/ws-main.asp";
		ajax.method = "GET";
		ajax.onCompletion = loadRndImg_completed;
		ajax.runAJAX();
	}
}

/* 
########################################################################
 DA SISTEMARE
########################################################################
*/


function set_tmp_Areas(id){
	if ( tools_div == 1 && id != "off"){
	clearTimeout(tmp_tools_time);
	areasId = id.split("a")[1];
	} else if ( id != "off" && id != "over"){
		tmp_areas_id = id;
		tmp_areas_time = setTimeout("setAreas('"+ id +"')", 400);
	}
	if ( id == "off"){
		clearTimeout(tmp_areas_time);
		if (tools_div == 1){
		moveAreas('default');
		moveTools('default');
		} else {
		moveTools('default');
		}
	areasId = "all";
	toolsId = "all";
	areas_div = 0;
	tools_div = 0;
		if (areas_id != 0){
		document.getElementById(areas_id).className = 'menu_off';
		}
	}
	if ( id == "over"){
		if (tmp_areas_time != 0){
			clearTimeout(tmp_areas_time);
		}
	}	
}

function setAreas(id){
	if (tmp_areas_id == id){
		if (areas_id != 0){
		document.getElementById(areas_id).className = 'menu_off';
		}
	areas_id = id;
	areas_div = 1;
	document.getElementById(areas_id).className = 'menu_on';
	moveTools(id);
	}
}
function cancelAreasId() {
	if (tools_div == 1) {
	areas_div = 0;
	areasId = "all";
	}
}
function cancelToolsId() {
	if (areas_div == 1) {
	tools_div = 0;
	toolsId = "all";
	}
}
function set_tmp_Tools(id){
	if ( areas_div == 1 && id != "off"){
	clearTimeout(tmp_areas_time);
	toolsId = id.split("t")[1];
	} else if ( id != "off" && id != "over"){
		tmp_tools_id = id;
		tmp_tools_time = setTimeout("setTools('"+ id +"')", 400);
	}
	if ( id == "off"){
		clearTimeout(tmp_tools_time);
		if (areas_div == 1){
		moveAreas('default');
		moveTools('default');
		} else {
		moveAreas('default');
		}
	areasId = "all";
	toolsId = "all";
	tools_div = 0;
	areas_div = 0;
		if (tools_id != 0){
		document.getElementById(tools_id).className = 'menu_off';
		}
	}
	if ( id == "over"){
		if (tmp_tools_time != 0){
			clearTimeout(tmp_tools_time);
		}
	}
}

function setTools(id){
	if (tmp_tools_id == id){
		if (tools_id != 0){
		document.getElementById(tools_id).className = 'menu_off';
		}
	tools_id = id;
	tools_div = 1;
	document.getElementById(tools_id).className = 'menu_on';
	moveAreas(id);
	}
}

function moveTools(id) {
	if (id == "default"){
		toolsHigh = (tools.length+1)*17;
		new Rico.Effect.FadeTo( 'tools', .5, 200, 10 );
		new Rico.Effect.SizeAndPosition( 'tools', null, 13, null, toolsHigh, 200, 10 ); 
		new Rico.Effect.FadeTo( 'tools', 1, 200, 10 );
		document.getElementById('tools').innerHTML = '<div>strumenti</div>';
		for (i=0;i<tools.length;i++){
			document.getElementById('tools').innerHTML += '<div><a id="t'+ tools[i].id +'" class="menu_off" href="javascript:void(\'0\')" onmouseover="set_tmp_Tools(\'t'+ tools[i].id +'\')" onmouseout="cancelToolsId()" onclick="changeMenu(\'t'+ tools[i].id +'\')">' + tools[i].name.toUpperCase() + '</a></div>';
		}
	} else {
		clearTimeout(tmp_areas_time);
		clearTimeout(tmp_tools_time);
		areasId = id.split("a")[1];
		toolsLength = areas[areasLookup[areasId]].tools.length;
		toolsHeight = (toolsLength+1)*17;
		new Rico.Effect.FadeTo( 'tools', .5, 200, 10 );
		new Rico.Effect.SizeAndPosition( 'tools', null, ((toolsHigh-toolsHeight)/2)+13, null, toolsHeight, 200, 10 );
		new Rico.Effect.FadeTo( 'tools', 1, 200, 10 );
		document.getElementById('tools').innerHTML = '<div>strumenti</div>';
		for (i=0;i<toolsLength;i++){
		aaa = areas[areasLookup[areasId]].tools[i];
		document.getElementById('tools').innerHTML += '<div>'+
		'<a id="t'+ tools[toolsLookup[aaa]].id +'" class="menu_off" href="javascript:void(\'0\')" onmouseover="set_tmp_Tools(\'t'+ tools[toolsLookup[aaa]].id +'\')" onmouseout="cancelToolsId()" onclick="changeMenu(\'t'+ tools[toolsLookup[aaa]].id +'\')">' + tools[toolsLookup[aaa]].name.toUpperCase() + '</a></div>';
		}
	}
}

function moveAreas(id) {
	if (id == "default"){
		areasHigh = (areas.length+1)*17;
		new Rico.Effect.FadeTo( 'aree', .5, 200, 10 );
		new Rico.Effect.SizeAndPosition( 'aree', null, 13, null, areasHigh, 200, 10 );
		new Rico.Effect.FadeTo( 'aree', 1, 200, 10 );
		document.getElementById('aree').innerHTML = '<div>settori</div>';
		for (i=0;i<areas.length;i++){
		document.getElementById('aree').innerHTML += '<div>'+
		'<a id="a'+ areas[i].id +'" class="menu_off" href="javascript:void(\'0\')" onmouseover="set_tmp_Areas(\'a'+ areas[i].id +'\')" onmouseout="cancelAreasId()" onclick="changeMenu(\'a'+ areas[i].id +'\')">' + areas[i].name.toUpperCase() + '</a></div>';
		}
	} else {
		clearTimeout(tmp_areas_time);
		clearTimeout(tmp_tools_time);
		toolsId = id.split("t")[1];
		areasLength = tools[toolsLookup[toolsId]].areas.length;
		areasHeight = (areasLength+1)*17;
		new Rico.Effect.FadeTo( 'aree', .5, 200, 10 );
		new Rico.Effect.SizeAndPosition( 'aree', null, ((areasHigh-areasHeight)/2)+13, null, areasHeight, 200, 10 );
		new Rico.Effect.FadeTo( 'aree', 1, 200, 10 );
		document.getElementById('aree').innerHTML = '<div>settori</div>';
		for (i=0;i<areasLength;i++){
		ttt = tools[toolsLookup[toolsId]].areas[i];
		document.getElementById('aree').innerHTML += '<div>'+
		'<a id="a'+ areas[areasLookup[ttt]].id +'" class="menu_off" href="javascript:void(\'0\')" onmouseover="set_tmp_Areas(\'a'+ areas[areasLookup[ttt]].id +'\')" onmouseout="cancelAreasId()" onclick="changeMenu(\'a'+ areas[areasLookup[ttt]].id +'\')">' + areas[areasLookup[ttt]].name.toUpperCase() + '</a></div>';
		}
	}
}
function changeMenu(id){
	if (menuMoved == 0){
		if (id.substring(0,1) == "a") { areasId = id.split("a")[1];}
		if (id.substring(0,1) == "t") { toolsId = id.split("t")[1];}
		selectedAreas = areasId;
		selectedTools = toolsId;
		if ( areasId == "all") { document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ tools[toolsLookup[toolsId]].name +'</h2>'; }
		if ( toolsId == "all") { document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ areas[areasLookup[areasId]].name +'</h2>'; }
		if ( areasId != "all" && toolsId != "all") { 
			if (id.substring(0,1) == "a") {
			document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ areas[areasLookup[areasId]].name +' + '+ tools[toolsLookup[toolsId]].name +'</h2>'; 
			}
			if (id.substring(0,1) == "t") {
			document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ tools[toolsLookup[toolsId]].name +' + '+ areas[areasLookup[areasId]].name +'</h2>'; 
			}
		}
		new Rico.Effect.FadeTo( 'home1', 0, 500, 10 );
		new Rico.Effect.FadeTo( 'home2', 0, 500, 10, {complete: function(){moveMenu(''+id+'');}});
		//document.getElementById(id).className = 'menu_on';
	} else {
		if ( initFade != id) {
			if (id.substring(0,1) == "a") { areasId = id.split("a")[1];}
			if (id.substring(0,1) == "t") { toolsId = id.split("t")[1];}
			selectedAreas = areasId;
			selectedTools = toolsId;
			//document.getElementById(id).className = 'menu_on';
			document.getElementById('frame_content_'+ initFade).style.zIndex = '2';
			document.getElementById('frame_content_'+ id).style.zIndex = '3';
			if ( areasId == "all") { document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ tools[toolsLookup[toolsId]].name +'</h2>'; }
			if ( toolsId == "all") { document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ areas[areasLookup[areasId]].name +'</h2>'; }
			if ( areasId != "all" && toolsId != "all") { 
				if (id.substring(0,1) == "a") {
				document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ areas[areasLookup[areasId]].name +' + '+ tools[toolsLookup[toolsId]].name +'</h2>'; 
				}
				if (id.substring(0,1) == "t") {
				document.getElementById('frame_top_'+ id).innerHTML = '<h2>'+ tools[toolsLookup[toolsId]].name +' + '+ areas[areasLookup[areasId]].name +'</h2>'; 
				}
			}
			new Rico.Effect.Size( 'frame_content_'+ id +'', 446, null, 500, 10, {complete: function(){restoreSize(id);}} );
			}
		}
}

function restoreSize(id){
	if ( initFade != id) {
	new Rico.Effect.Size( 'frame_content_'+ initFade +'', 1, null, 10, 1);
	}
	initFade = id;
}

function moveMenu(id){
	new Rico.Effect.Position( 'movemenu', -228, null, 500, 10, {complete: function(){sizeFrame(''+id+'');}} );
	moveAreas('default');
	moveTools('default');
	menuMoved = 1;
}

function sizeFrame(id){
	document.getElementById('frame').style.display = 'block';
	document.getElementById('frame_content_'+ id).style.zIndex = '3';
	new Rico.Effect.Size( 'frame_content_'+ id +'', 446, null, 500, 10);
	initFade = id;
}

function initSearch(){
	if (!selectedAreas) {
	selectedAreas = "all";
	}
	if (!selectedTools) {
	selectedTools = "all";
	}
	location.href = "/it/search.asp?area="+ selectedAreas +"&tool="+ selectedTools +"";
}
function inputSearch(area,tool){
	var ajax = new sack();
	function whenLoading(){
	}
	function whenCompleted(){
	document.getElementById('tab_path').style.display = 'block';
	document.getElementById('tabpages').style.display = 'block';
	processQueue(ajax.response, "workAlternate()");
	var thisTab, thisPage;
	if (historyStorage.hasKey("actualTab")) {
		thisTab = historyStorage.get("actualTab")
	} else {
		thisTab = "tab"+yearResult[0];
	}
	
	if (historyStorage.hasKey("actualPage")) {
		thisPage = historyStorage.get("actualPage")
	} else {
		thisPage = 1;
	}
	
	selectTab(thisTab);
	listSearch(thisTab,thisPage)
	}
	ajax.encVar("area", area);
	ajax.encVar("tool", tool);
	ajax.encVar("action", "SEARCH");
	ajax.requestFile = "/common/ws-search.asp";
	ajax.method = "POST";
	ajax.onCompletion = whenCompleted;
	ajax.runAJAX();
}

function workAlternate(job) {
	var thisJob = job.replace("\r", "").split("|");
	switch(thisJob[0]) {
		case "YEARS":
			document.getElementById( 'tabBar').innerHTML += '<div class="tabContainerOff" id="tab'+ thisJob[1] +'" onclick="selectTab(\'tab'+ thisJob[1] +'\')">'+
			'<div class="tabText">'+ thisJob[1] +'</div></div>';
			document.getElementById( 'tabContent').innerHTML += '<div class="tabs" id="tab'+ thisJob[1] +'_search"></div>';
			yearResult[yearResult.length] = thisJob[1];
			break;
		case "RESULT":
			for (i=0;i<yearResult.length;i++){
				if ( thisJob[5] == yearResult[i] ){
				list = "listResult"+yearResult[i];
				eval(list)[eval(list).length] = new Array(thisJob[1], thisJob[2], thisJob[3], thisJob[4],thisJob[5],thisJob[6]);
				}
			}
			break;
		case "PATH":
			selectedAreas = thisJob[1];
			selectedTools = thisJob[2];
			//selectTab('tab' + yearResult[0]);
			ricercaMotore();
			break;
		case "IMAGE":
			var tmpImage = new Object;
			tmpImage.id = thisJob[1];
			tmpImage.filename = thisJob[2];
			tmpImage.tool = thisJob[3];
			imagesList[imagesList.length] = tmpImage;
			imagesLookup[thisJob[1]] = tmpImage;
			break;
		case "IMAGENEWS":
			var tmpImage = new Object;
			tmpImage.id = thisJob[1];
			tmpImage.filename = thisJob[2];
			imagesList[imagesList.length] = tmpImage;
			imagesLookup[thisJob[1]] = tmpImage;
			break;
		case "MAINPIC":
			mainPic = thisJob[1];
		}
}

function selectTab(id){
	historyStorage.put("actualTab", id);
	if (tab_search != 0) {
	document.getElementById(tab_search).className = 'tabContainerOff';
	document.getElementById(tab_search + "_search").style.display = 'none';
	}
	document.getElementById(id).className = 'tabContainer';
	document.getElementById(id + "_search").style.display = 'block';
	tab_search = id;
	listSearch(id,1);
	}

function listSearch(tab,page) {
	if (tab_search == "tabxxxx") {
	document.getElementById( 'errorMessage').style.display = 'block';
	document.getElementById( 'search').style.display = 'none';
	} else {
		historyStorage.put("actualPage", page);
		eval("selection = listResult" + tab.split("tab")[1]);
	
		tmpPage = parseInt((selection.length + nPage - 1)/nPage);
		document.getElementById(tab + "_search").innerHTML = '';
		document.getElementById( 'pagine').innerHTML = '';
		for (k=1;k<tmpPage+1;k++){
			if (k == page) {
				
				m = (k-1)*nPage;
				n = m+nPage;
				if (selection.length < n ) { n = selection.length;}
				document.getElementById( 'pagine').innerHTML += '<div class="squarepage" onclick="listSearch(\''+ tab + '\','+ k +')">'+ k +'</div>';
				for (j=m;j<n;j++){
					
					document.getElementById(tab + "_search").innerHTML += "<div class='workBoxFloat'>" +
					"<div class='workBox_href' onclick='location.href=\"/it/work.asp?id="+ selection[j][0] +"\"' onmouseover='this.className=\"workBox_href2\"' onmouseout='this.className=\"workBox_href\"'>" +
					"<div class='workBox_img'><a href='/it/work.asp?id="+ selection[j][0] +"'><img src='/common/ws-image.asp?t=SQUARE100&f="+ selection[j][5] +"' /></a></div>" +
					"<div class='workBox_txt'>" +
					"<div class='workBox_title'>" + selection[j][1].substring(0,60) + "</div>" +
					"<div class='workBox_subtitle'>Localit&agrave;: " + selection[j][2] + "</div>" +
					"<div class='workBox_subtitle'>Committente: " + selection[j][3].substring(0,70) + "</div>" +
					"<div class='workBox_subtitle'>Anno: " + selection[j][4] + "</div>" +
					"</div>" +
					"</div>" +
					"</div>";
				}
			} else {
			document.getElementById( 'pagine').innerHTML += '<div class="squarepage_off" onclick="listSearch(\''+ tab + '\','+ k +')">'+ k +'</div>';
			}
		}
		document.getElementById(tab + "_search").innerHTML += '<div class="clear"></div>';
		min = m+1;
		max = " - " +n;
		if (" - " +min == max) { max = ""};
	
			if ( selectedAreas == "all" && selectedTools != "all" ){
			document.getElementById( 'tab_path').innerHTML = 'ricerca su: '+ tools[toolsLookup[selectedTools]].name.toUpperCase() +
			' | risultati: '+ min + max +' di ' + eval(selection).length;
			}
			if ( selectedAreas != "all" && selectedTools == "all"){
			document.getElementById( 'tab_path').innerHTML = 'ricerca su: '+ areas[areasLookup[selectedAreas]].name.toUpperCase() + 
			' | risultati: '+ min + max +' di ' + eval(selection).length;
			}
			if ( selectedAreas == "all" && selectedTools == "all"){
			document.getElementById( 'tab_path').innerHTML = 'ricerca su: tutte le categorie | risultati: '+ min + max +' di ' + eval(selection).length;
			}
			if ( selectedAreas != "all" && selectedTools != "all") {
			document.getElementById( 'tab_path').innerHTML = 'ricerca su: '+ areas[areasLookup[selectedAreas]].name.toUpperCase() + 
			' and ' + tools[toolsLookup[selectedTools]].name.toUpperCase() + 
			' | risultati: '+ min + max +' di ' + eval(selection).length;
			}
	}
}

function ricercaMotore() {
	document.getElementById('ricerca1').innerHTML += '<select id="ricercaAreas" name="ricercaAreas" onchange="selectedAreas = this.value;ricercaTools_beta()"></select>';
	document.getElementById('ricerca2').innerHTML += '<select id="ricercaTools" name="ricercaTools" onchange="selectedTools = this.value;ricercaAreas_beta()"></select>';
	ricercaAreas();
	ricercaTools();
}
function ricercaAreas(){
	var thisSelect = document.getElementById("ricercaAreas");
	thisSelect.length = 0;
	thisSelect[thisSelect.length] = new Option("tutti i settori", "all");
	if (selectedAreas == "all") {
			thisSelect[thisSelect.length-1].selected = true;
			thisSelect[thisSelect.length-1].defaultSelected = true;
		}

	for (i=0; i<10; i++) {
		thisSelect[thisSelect.length] = new Option(areas[i].name, areas[i].id);
		if (selectedAreas == areas[i].id) {
			thisSelect[thisSelect.length-1].selected = true;
			thisSelect[thisSelect.length-1].defaultSelected = true;
		}
	}
}

function ricercaTools(){
	var thisSelect = document.getElementById("ricercaTools");
	thisSelect.length = 0;
	thisSelect[thisSelect.length] = new Option("tutti gli strumenti", "all");
	if (selectedTools == "all") {
			thisSelect[thisSelect.length-1].selected = true;
			thisSelect[thisSelect.length-1].defaultSelected = true;
		}

	for (i=0; i<10; i++) {
		thisSelect[thisSelect.length] = new Option(tools[i].name, tools[i].id);
		if (selectedTools == tools[i].id) {
			thisSelect[thisSelect.length-1].selected = true;
			thisSelect[thisSelect.length-1].defaultSelected = true;
		}
	}
}

function ricercaAreas_beta() {
	if ( riceAreas == 1){}
	else {
		if (selectedTools == "all"){
		ricercaAreas();
		riceAreas = 0;
		riceTools = 0;
		} else {
			riceTools = 1;
			var thisSelect = document.getElementById("ricercaAreas");
			thisSelect.length = 0;
			areasLength = tools[toolsLookup[selectedTools]].areas.length;
			thisSelect[thisSelect.length] = new Option("tutti i settori", "all");
			for (i=0; i<areasLength; i++) {
				aaa = tools[toolsLookup[selectedTools]].areas[i];
				thisSelect[thisSelect.length] = new Option(areas[areasLookup[aaa]].name, areas[areasLookup[aaa]].id);
			}
		}
	}
}

function ricercaTools_beta() {
	if ( riceTools == 1){}
	else {
		if (selectedAreas == "all"){
		ricercaTools();
		riceTools = 0;
		riceAreas = 0;
		} else {
			riceAreas = 1;
			var thisSelect = document.getElementById("ricercaTools");
			thisSelect.length = 0;
			toolsLength = areas[areasLookup[selectedAreas]].tools.length;
			thisSelect[thisSelect.length] = new Option("tutti gli strumenti", "all");
			for (i=0; i<toolsLength; i++) {
				ttt = areas[areasLookup[selectedAreas]].tools[i];
				thisSelect[thisSelect.length] = new Option(tools[toolsLookup[ttt]].name, tools[toolsLookup[ttt]].id);
			}
		}
	}
}

function zoomPic(image){
	if (document.getElementById("menubar")) {document.getElementById("menubar").style.visibility = "hidden";}
	document.getElementById("pellicolla").style.display = "block";

	if(!document.all && document.getElementById){
	document.getElementById("page_main").style.opacity = '0.2';
	document.getElementById("pellicolla").innerHTML = '';
		if (window.pageYOffset > 110){ picTop = (window.pageYOffset-90) + "px";
		} else {
		picTop = 20 + "px";
		}
	document.getElementById("pellicolla").innerHTML = '<img id="pellicola_img" src="/pics/zoom_'+ image +'" style="margin-top:'+ picTop +';border:1px solid #dadada" onclick="zoomPicOff()"/>';
	} else {
	document.getElementById("page_main").style.filter = "alpha(opacity:20)";
	document.getElementById("pellicolla").innerHTML = '';
		if (document.documentElement.scrollTop > 110){ picTop = (document.documentElement.scrollTop-90)+ "px";
		} else {
		picTop = 20 + "px";
		}
	document.getElementById("pellicolla").innerHTML = '<img id="pellicola_img" src="/pics/zoom_'+ image +'" style="margin-top:'+ picTop +';border:1px solid #dadada" onclick="zoomPicOff()"/>';
	}
}
function zoomPicOff(){
	if(!document.all && document.getElementById){
		document.getElementById("page_main").style.opacity = '1';
	} else {
	document.getElementById("page_main").style.filter = "alpha(opacity:100)";
	}
	document.getElementById("pellicolla").style.display = "none";
	if (document.getElementById("menubar")) {document.getElementById("menubar").style.visibility = "visible"; }
}

// **************** FORM PREVENTIVO

function initform(xxx) {
	if (xxx != ""){
	document.getElementById('button_tool').style.display = 'none';
		toolsLength = areas[areasLookup[xxx]].tools.length;
			for (i=0; i<toolsLength; i++) {
				ttt = areas[areasLookup[xxx]].tools[i];
				document.getElementById('radio'+tools[toolsLookup[ttt]].id).style.fontWeight = 'bold';
				document.getElementById('radio'+tools[toolsLookup[ttt]].id).style.color = '#009348';
			}
	}
}

function aziendaMap() {
	document.getElementById('page_column2of2_sx').innerHTML += '<div style="margin-bottom:10px">SETTORI</div>';
	for (i=0;i<areas.length;i++){
		document.getElementById('page_column2of2_sx').innerHTML += '<div>'+
		'<a href="'+ areas[i].landpage +'" class="detail">'+ areas[i].name + '</a></div>';
	}
	document.getElementById('page_column2of2_dx').innerHTML += '<div style="margin-bottom:10px">STRUMENTI</div>';
	for (i=0;i<tools.length;i++){
		document.getElementById('page_column2of2_dx').innerHTML += '<div>'+
		'<a href="'+ tools[i].landpage +'" class="detail">'+ tools[i].name + '</a></div>';
	}
}