// JavaScript Document

var statoId = false;
var id = null;


function mostraMenu(id){
	
	var subHeader = document.getElementById('sub');
	
	subHeader.style.visibility = 'visible'
	
	if( id >= 0 && this.id <=6 ){
		this.id = id; 
	}		

		
	document.getElementById(this.id).style.color = '#FD7400';
	document.getElementById(this.id).style.background = 'url(Immagini/triangle.png) no-repeat center bottom';
	document.getElementById('menu_' + this.id).style.display = 'block';
	
}

function nascondiMenu(){
	
	var subHeader = document.getElementById('sub');
	
	document.getElementById(this.id).style.background = '';
	document.getElementById(this.id).style.color = '#434343';
	
	document.getElementById('menu_' + this.id).style.display = 'none';
	subHeader.style.visibility = 'hidden';
}


function cambiaMenu(stato){
	
	var barra = document.getElementById('top_menu_s');
	
	switch(stato){
		case 1:
			barra.style.background = "url(Immagini/horiz_bg_l_s.png) no-repeat left top";
			break;
		case 0:
			barra.style.background = "url(Immagini/horiz_bg_l.png) no-repeat left top";
			break;
	}	
}


function tendinaOn(ID,target){
	
	if(target == 1){
		ID_bottone = ID;
		ID_tendina = "t_"+ID;
		ID_subtitle = "d_"+ID;
	}
	else{
		ID_bottone = ID.substr(ID.indexOf("_")+1); 
		ID_subtitle = "d_"+ID_bottone;
		ID_tendina = ID;
	}	
	
	var bottone = document.getElementById(ID_bottone);
	var tendina = document.getElementById(ID_tendina);
	var subtitle = document.getElementById(ID_subtitle);
	var centro = document.getElementById('centro');
	var container = document.getElementById('container');
	var index = document.getElementById("contenitore_tendina");
	
	index.style.zIndex = 300
	centro.style.zIndex = 1;

	bottone.className = "active";
	
	tendina.style.display = "block";		
	
	subtitle.style.display = "block";
}

function tendinaOff(ID,target){
	
	if(target == 1){
		ID_bottone = ID;
		ID_tendina = "t_"+ID;
		ID_subtitle = "d_"+ID;
	}
	else{
		ID_bottone = ID.substr(ID.indexOf("_")+1); 
		ID_tendina = ID;
		ID_subtitle = "d_"+ID_bottone;
	}	
	
	var bottone = document.getElementById(ID_bottone);
	var tendina = document.getElementById(ID_tendina);
	var subtitle = document.getElementById(ID_subtitle);
	var centro = document.getElementById('centro');
	var container = document.getElementById('container');	
	var index = document.getElementById("contenitore_tendina");
	
	index.style.zIndex = 100;
	centro.style.zIndex = 200;
	
	bottone.className = "";
	
	tendina.style.display = "none";		
	
	tendina.style.display = "none";		
	
	subtitle.style.display = "none";
}
	
