// impostazione elemento e gruppo attivo di menu in relazione alla pagina visitata
pagina_menu=document.location.toString().toLowerCase()
if (pagina_menu.lastIndexOf("/")>0)
{
	pagina_menu=pagina_menu.substring(pagina_menu.lastIndexOf("/")+1, pagina_menu.length)
}
pagina_menu=pagina_menu.substring(0, pagina_menu.indexOf("."))
if (pagina_menu=="") pagina_menu="index"
switch (pagina_menu) 
{
	case "chi_siamo":
		gruppo_elemento_attivo="1_1";
		break;
	case "dove_siamo":
		gruppo_elemento_attivo="1_2";
		break;   
	case "contattaci":
		gruppo_elemento_attivo="1_3";
		break;      
	case "prod_rischi":
		gruppo_elemento_attivo="2_1";
		break;
	case "prod_vita":
		gruppo_elemento_attivo="2_2";
		break;
	case "convenzioni":
		gruppo_elemento_attivo="3_1";
		break;      
	case "convenzioni_mail":
		gruppo_elemento_attivo="3_1";
		break; 
	case "cosafare1":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare2":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare3":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare4":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare5":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare6":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare7":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare8":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare9":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare10":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare11":
		gruppo_elemento_attivo="3_2";
		break; 
	case "cosafare12":
		gruppo_elemento_attivo="3_2";
		break;
	case "centrisanitari":
		gruppo_elemento_attivo="3_4";
		break;
	case "numeri_utili":
		gruppo_elemento_attivo="3_5";
		break; 
	case "glossario":
		gruppo_elemento_attivo="3_6";
		break; 
	case "preventivi":
		gruppo_elemento_attivo="4_1";
		break;   
	case "preventivi_auto1":
		gruppo_elemento_attivo="4_1";   
		break;
	case "preventivi_auto2":
		gruppo_elemento_attivo="4_1";   
		break;
	case "preventivi_auto3":
		gruppo_elemento_attivo="4_1";   
		break;
	case "preventivi_auto4":
		gruppo_elemento_attivo="4_1";   
		break;
	case "preventivi_auto5":
		gruppo_elemento_attivo="4_1";   
		break;
	case "preventivi_auto6":
		gruppo_elemento_attivo="4_1";   
		break;    
	
	case "preventivi2":
		gruppo_elemento_attivo="4_2";
		break;   
	case "preventivi_moto1":
		gruppo_elemento_attivo="4_2";   
		break;
	case "preventivi_moto2":
		gruppo_elemento_attivo="4_2";   
		break;
	case "preventivi_moto3":
		gruppo_elemento_attivo="4_2";   
		break;
	case "preventivi_moto4":
		gruppo_elemento_attivo="4_2";   
		break;
	case "preventivi_moto5":
		gruppo_elemento_attivo="4_2";   
		break;
	case "preventivi_moto6":
		gruppo_elemento_attivo="4_2";   
		break;    	
	
	case "preventivi3":
		gruppo_elemento_attivo="4_3";
		break; 
	case "preventivi_casa":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casa1":
		gruppo_elemento_attivo="4_3";
		break;	
	case "preventivi_casa2":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casa3":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casa4":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casa5":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casa6":
		gruppo_elemento_attivo="4_3";
		break;	
	case "preventivi_casa7":
		gruppo_elemento_attivo="4_3";
		break;		
	case "preventivi_casafire1":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casafire2":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casafire3":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casafire4":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casafire5":
		gruppo_elemento_attivo="4_3";
		break;
	case "preventivi_casafire6":
		gruppo_elemento_attivo="4_3";
		break;		
		
	case "preventivi4":
		gruppo_elemento_attivo="4_4";
		break;   
	case "preventivi_persona":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni1":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni2":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni3":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni4":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_infortuni5":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard1":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard2":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard3":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard4":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_sanicard5":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita":
		gruppo_elemento_attivo="4_4";   
		break;	
	case "preventivi_persona_vita_dedicata":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicata1":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicata2":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicata3":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicata4":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicata5":
		gruppo_elemento_attivo="4_4";   
		break;

	case "preventivi_persona_vita_dedicatamutui":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicatamutui1":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicatamutui2":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicatamutui3":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicatamutui4":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_vita_dedicatamutui5":
		gruppo_elemento_attivo="4_4";   
		break;

	case "preventivi_persona_prodpersonalizzati":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_prodpersonalizzati1":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_prodpersonalizzati2":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_prodpersonalizzati3":
		gruppo_elemento_attivo="4_4";   
		break;
	case "preventivi_persona_prodpersonalizzati4":
		gruppo_elemento_attivo="4_4";   
		break;
		
	default:
		gruppo_elemento_attivo="0_0";
} 

// preload images:
/*menu1_0 = new Image();		menu1_0.src = "images/01_area_cliente_a.gif";
menu1_01 = new Image();		menu1_01.src = "images/01_registrati_g.gif";*/
menu1_1 = new Image();		menu1_1.src = "images/01_chi_siamo_w.gif";
menu1_2 = new Image();		menu1_2.src = "images/01_dove_siamo_w.gif";
menu1_3 = new Image();		menu1_3.src = "images/01_contattaci_w.gif";
menu2_1 = new Image();		menu2_1.src = "images/02_protezione_rischi_w.gif";
menu2_2 = new Image();		menu2_2.src = "images/02_vita_w.gif";
menu3_1 = new Image();		menu3_1.src = "images/03_convenzioni_w.gif";
menu3_2 = new Image();		menu3_2.src = "images/03_cosa_fare_w.gif";
menu3_3 = new Image();		menu3_3.src = "images/03_carrozzerie_w.gif";
menu3_4 = new Image();		menu3_4.src = "images/03_sistemi_sanitari_w.gif";
menu3_5 = new Image();		menu3_5.src = "images/03_numeri_utili_w.gif";
menu3_6 = new Image();		menu3_6.src = "images/03_glossario_w.gif";
menu4_1 = new Image();		menu4_1.src = "images/04_auto_w.gif";
menu4_2 = new Image();		menu4_2.src = "images/04_moto_w.gif";
menu4_3 = new Image();		menu4_3.src = "images/04_casa_w.gif";
menu4_4 = new Image();		menu4_4.src = "images/04_persona_w.gif";

/*menu1_0_s = new Image();	menu1_0_s.src = "images/01_area_cliente_g.gif";
menu1_01_s = new Image();	menu1_01_s.src = "images/01_registrati_g.gif";*/
menu1_1_s = new Image();	menu1_1_s.src = "images/01_chi_siamo_a.gif";
menu1_2_s = new Image();	menu1_2_s.src = "images/01_dove_siamo_a.gif";
menu1_3_s = new Image();	menu1_3_s.src = "images/01_contattaci_a.gif";
menu2_1_s = new Image();	menu2_1_s.src = "images/02_protezione_rischi_a.gif";
menu2_2_s = new Image();	menu2_2_s.src = "images/02_vita_a.gif";
menu3_1_s = new Image();	menu3_1_s.src = "images/03_convenzioni_a.gif";
menu3_2_s = new Image();	menu3_2_s.src = "images/03_cosa_fare_a.gif";
menu3_3_s = new Image();	menu3_3_s.src = "images/03_carrozzerie_a.gif";
menu3_4_s = new Image();	menu3_4_s.src = "images/03_sistemi_sanitari_a.gif";
menu3_5_s = new Image();	menu3_5_s.src = "images/03_numeri_utili_a.gif";
menu3_6_s = new Image();	menu3_6_s.src = "images/03_glossario_a.gif";
menu4_1_s = new Image();	menu4_1_s.src = "images/04_auto_a.gif";
menu4_2_s = new Image();	menu4_2_s.src = "images/04_moto_a.gif";
menu4_3_s = new Image();	menu4_3_s.src = "images/04_casa_a.gif";
menu4_4_s = new Image();	menu4_4_s.src = "images/04_persona_a.gif";

/*menu1_0_g = new Image();	menu1_0_g.src = "images/01_area_cliente_a.gif";
menu1_01_g = new Image();	menu1_01_g.src = "images/01_registrati_g.gif";*/
menu1_1_g = new Image();	menu1_1_g.src = "images/01_chi_siamo_g.gif";
menu1_2_g = new Image();	menu1_2_g.src = "images/01_dove_siamo_g.gif";
menu1_3_g = new Image();	menu1_3_g.src = "images/01_contattaci_g.gif";
menu2_1_g = new Image();	menu2_1_g.src = "images/02_protezione_rischi_g.gif";
menu2_2_g = new Image();	menu2_2_g.src = "images/02_vita_g.gif";
menu3_1_g = new Image();	menu3_1_g.src = "images/03_convenzioni_g.gif";
menu3_2_g = new Image();	menu3_2_g.src = "images/03_cosa_fare_g.gif";
menu3_3_g = new Image();	menu3_3_g.src = "images/03_carrozzerie_g.gif";
menu3_4_g = new Image();	menu3_4_g.src = "images/03_sistemi_sanitari_g.gif";
menu3_5_g = new Image();	menu3_5_g.src = "images/03_numeri_utili_g.gif";
menu3_6_g = new Image();	menu3_6_g.src = "images/03_glossario_g.gif";
menu4_1_g = new Image();	menu4_1_g.src = "images/04_auto_g.gif";
menu4_2_g = new Image();	menu4_2_g.src = "images/04_moto_g.gif";
menu4_3_g = new Image();	menu4_3_g.src = "images/04_casa_g.gif";
menu4_4_g = new Image();	menu4_4_g.src = "images/04_persona_g.gif";


function ImgFunc(idImg, imgObjName, type)
{	
	if (type=='s')
	{
		document.getElementById(idImg).src=eval(imgObjName + "_s.src")		
	}
	else
	{
		if (idImg.indexOf(gruppo_elemento_attivo)>0)
		{
			document.getElementById(idImg).src=eval(imgObjName + "_s.src")
		}
		else
		{
			gruppo_attivo=gruppo_elemento_attivo.substring(0, gruppo_elemento_attivo.indexOf("_"))			
			if (idImg.indexOf(gruppo_attivo+"_")>0)
			{
				document.getElementById(idImg).src=eval(imgObjName + ".src")
			}
			else
			{
				document.getElementById(idImg).src=eval(imgObjName + "_g.src")				
			}
		}
	}
	
}

//valorizzazione iniziale del menu 
function imposta_immagini()
{
	/*ImgFunc('menu1_01', 'menu1_01', '')
	ImgFunc('menu1_0', 'menu1_0', '')*/
	ImgFunc('menu1_1', 'menu1_1', '')
	ImgFunc('menu1_2', 'menu1_2', '')
	ImgFunc('menu1_3', 'menu1_3', '')
	ImgFunc('menu2_1', 'menu2_1', '')
	ImgFunc('menu2_2', 'menu2_2', '')
	ImgFunc('menu3_1', 'menu3_1', '')
	ImgFunc('menu3_2', 'menu3_2', '')
	ImgFunc('menu3_3', 'menu3_3', '')
	ImgFunc('menu3_4', 'menu3_4', '')
	ImgFunc('menu3_5', 'menu3_5', '')
	ImgFunc('menu3_6', 'menu3_6', '')
	ImgFunc('menu4_1', 'menu4_1', '')
	ImgFunc('menu4_2', 'menu4_2', '')
	ImgFunc('menu4_3', 'menu4_3', '')
	ImgFunc('menu4_4', 'menu4_4', '')
}

barra1=new Array("", "Barretta_meta.gif", "Barretta_trequarti.gif", "barretta_piena.gif")
barra2=new Array("", "Barretta_meta.gif", "Barretta_trequarti.gif", "barretta_piena.gif")
barra3=new Array("", "Barretta_meta.gif", "Barretta_trequarti.gif", "barretta_piena.gif")

mappa1=new Array("", "mappa1.gif", "mappa1_2.gif", "mappa1_3.gif") 
mappa2=new Array("", "mappa2.gif", "mappa2_2.gif", "mappa2_3.gif") 
mappa3=new Array("", "mappa3.gif", "mappa3_2.gif", "mappa3_3.gif") 

function zoomin()
{
	mappacorrente=document.getElementById("mappa").src	
	mappacorrente=mappacorrente.substring(mappacorrente.lastIndexOf("/")+1, mappacorrente.length)	
	mappafound=false
	for (ixmap=1; ixmap<mappa1.length; ixmap++)
	{		
		if (mappa1[ixmap]==mappacorrente)
		{			
			if (ixmap<(mappa1.length-1))
			{ixmapnew=ixmap+1}
			else
			{ixmapnew=ixmap}
			
			document.getElementById("mappa").src="images/"+mappa1[ixmapnew]
			document.getElementById("barra1").src="images/"+barra1[ixmapnew]
			mappafound=true;
		}
	}
	if (!mappafound)
	{
		for (ixmap=1; ixmap<mappa2.length; ixmap++)
		{
			if (mappa2[ixmap]==mappacorrente)
			{
				if (ixmap<(mappa2.length-1))
				{ixmapnew=ixmap+1}
				else
				{ixmapnew=ixmap}
				
				document.getElementById("mappa").src="images/"+mappa2[ixmapnew]
				document.getElementById("barra2").src="images/"+barra2[ixmapnew]
				mappafound=true;
			}
		}
	}
	if (!mappafound)
	{
		for (ixmap=1; ixmap<mappa3.length; ixmap++)
		{
			if (mappa3[ixmap]==mappacorrente)
			{
				if (ixmap<(mappa3.length-1))
				{ixmapnew=ixmap+1}
				else
				{ixmapnew=ixmap}

				document.getElementById("mappa").src="images/"+mappa3[ixmapnew]
				document.getElementById("barra3").src="images/"+barra3[ixmapnew]
				mappafound=true;
			}
		}
	}
}
function zoomout()
{
	mappacorrente=document.getElementById("mappa").src	
	mappacorrente=mappacorrente.substring(mappacorrente.lastIndexOf("/")+1, mappacorrente.length)	
	mappafound=false
	for (ixmap=1; ixmap<mappa1.length; ixmap++)
	{
		if (mappa1[ixmap]==mappacorrente)
		{
			if (ixmap>1)
			{ixmapnew=ixmap-1}
			else
			{ixmapnew=ixmap}

			document.getElementById("mappa").src="images/"+mappa1[ixmapnew]
			document.getElementById("barra1").src="images/"+barra1[ixmapnew]
			mappafound=true;
		}
	}
	if (!mappafound)
	{
		for (ixmap=1; ixmap<mappa2.length; ixmap++)
		{
			if (mappa2[ixmap]==mappacorrente)
			{
				if (ixmap>1)
				{ixmapnew=ixmap-1}
				else
				{ixmapnew=ixmap}

				document.getElementById("mappa").src="images/"+mappa2[ixmapnew]
				document.getElementById("barra2").src="images/"+barra2[ixmapnew]
				mappafound=true;
			}
		}
	}
	if (!mappafound)
	{
		for (ixmap=1; ixmap<mappa3.length; ixmap++)
		{
			if (mappa3[ixmap]==mappacorrente)
			{
				if (ixmap>1)
				{ixmapnew=ixmap-1}
				else
				{ixmapnew=ixmap}

				document.getElementById("mappa").src="images/"+mappa3[ixmapnew]
				document.getElementById("barra3").src="images/"+barra3[ixmapnew]
				mappafound=true;
			}
		}
	}
}
function changemap(tipo)
{
	switch (tipo) 
	{
	   case "mappa1":		  
		  document.getElementById("mappa").src="images/"+mappa1[1]
		  document.getElementById("barra1").src="images/"+barra1[1]		  
		  document.getElementById("barra2").src="images/"+barra2[1]		  
		  document.getElementById("barra3").src="images/"+barra3[1]		  
		  break;
	   case "mappa2":
		  document.getElementById("mappa").src="images/"+mappa2[1]
		  document.getElementById("barra1").src="images/"+barra1[1]		  
		  document.getElementById("barra2").src="images/"+barra2[1]		  
		  document.getElementById("barra3").src="images/"+barra3[1]	
		  break;   
	   case "mappa3":
		  document.getElementById("mappa").src="images/"+mappa3[1]
		  document.getElementById("barra1").src="images/"+barra1[1]		  
		  document.getElementById("barra2").src="images/"+barra2[1]		  
		  document.getElementById("barra3").src="images/"+barra3[1]	
		  break;
	   default:
		  document.getElementById("mappa").src="images/"+mappa1[1]
		  document.getElementById("barra1").src="images/"+barra1[1]		  
		  document.getElementById("barra2").src="images/"+barra2[1]		  
		  document.getElementById("barra3").src="images/"+barra3[1]	
	} 	
	
}
function showbanner(arr_pos){

	bannerwidth=436
	bannerheight=436
	
	leftx=((window.screen.availWidth/2)-eval(bannerwidth/2)); 
	topy=((window.screen.availHeight/2)-eval(bannerheight/2));	
	winL=window.open("showbanner.php?id="+arr_pos ,"immagine","toolbar=no,menubar=no, width="+bannerwidth+", height="+bannerheight+", top="+topy+", left="+leftx);
}
