
//alert(browser+'   '+browserNum);
var arrayMenu=Array();
arrayMenu[0]="gruppo";
arrayMenu[1]="insegne";
arrayMenu[2]="territorio";
arrayMenu[3]="lavoro";
arrayMenu[4]="press";
arrayMenu[5]="news";
arrayMenu[6]="contatti";
arrayMenu[7]="mappa";
arrayMenu[8]="home";


//////

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function inizializza(p,sotto,terzoliv){
	
	if(sotto!=null){
	attivaBotSotto(sotto)
	};
	

	if(terzoliv){
	attivaterzo(terzoliv);

	};
	
	showSotto(p);
	
}
////
function showSotto(l){
	//alert('showotto **');
	
	var livello=arrayMenu[l];
	var menuSopra=findObj(livello+'Parent');
	
	if(livello=='gruppo'){
		menuSopra.className="inAlto_acceso";
	}else{
		menuSopra.className="p_acceso";	
	}
	
	//
	var sotto=findObj(livello);
	
	sotto.style.display=(sotto.style.display=='block') ? "none" : "block";
	
	hideAll(l);
	
}
function accendiMi(l){
	var livello=arrayMenu[l];
	var nome=livello+'Parent';
	var toBeHighLighted=findObj(nome);
	toBeHighLighted.className="p_acceso";
	hideAll(livello);

}

function hideAll(sel){
	
	for (i=0;i<arrayMenu.length;i++){
		if(i!=sel){
			
			var toTurnOff=findObj(arrayMenu[i]+'Parent');
			
			
			if(sel==0){
				toTurnOff.className="inAlto";
			}else{
				//toTurnOff.className="principale";
			};
			
			//togliere i bot principale che non hanno sottomenu	
			
			if(i<5){
			var sotto=findObj(arrayMenu[i]);
			sotto.style.display="none";		
			}
			
		}
	}
}
function attivaBotSotto(sotto,terzo){
	
	var sottoH=findObj('p'+sotto);
	if(sottoH){
	sottoH.className="attivo_h";
	};
	//
	if(terzo!=null){
		attivaterzo(terzo);
	}
}
function attivaterzo(terzo){
	var terzoliv=findObj('p'+terzo);
	if(terzoliv){
	terzoliv.className="terzoliv_h";
	}
}
