// <![CDATA[
//var show_elements;
//var hide_elements;
//var tab_elements=new Array();
//var sez_elements=new Array();


function set_inactive(obj, nome) {
	
	var vociMenu=document.getElementById(nome).getElementsByTagName('a'); 
	//var vociMenu =JQuery("#menu_catalogo").getElementsByTagName('a'); 	
	//var classe_elemento;
	var indice_active;
	var tabs=new Array();
	var ind=0;

	for (i=0; i<vociMenu.length; i++) {
		classe_elemento=vociMenu[i].className;
		indice_active=vociMenu[i].className.indexOf('active');
		
		
		if((vociMenu[i]!=obj)&&(indice_active>-1)){
			vociMenu[i].className=classe_elemento.substring(0,indice_active-1);
		}
		
	}
}



function set_active(oggetto) {
	
	var classe=oggetto.className;
	var fl_attivo=classe.indexOf('active');
	
	if(fl_attivo==-1) {
		oggetto.className=classe+' active';
	}
}



/*** funzione che visualizza tutti i div con id nel primo array e nasconde tutti i divs con id nel secondo array ***/
function show_and_hide(show_els, nomeHide) {
	
	/*hide_els=new Array();
	hide_els=document.getElementsByName(nomeHide);
    alert (hide_els);
	for (var i=0;i<hide_els.length;i++) {
	    
		hide_els[i].style.display='none';
	
	}*/
	
	corrente = 1;
	vuoto = 0; 
	//document.getElementById(nomeHide+corrente);
	
	while ( vuoto < 10 ) {
		if ( document.getElementById(nomeHide+corrente) ) {
			document.getElementById(nomeHide+corrente).style.display = 'none';
			corrente = corrente + 1;
			vuoto = 0;
		}
		else {
			vuoto = vuoto + 1;
			corrente = corrente + 1;
		}
	}
	
	/*
	for (var i=0;i<hide_els.length;i++) {
		
		if(document.getElementById(hide_els[i])){
			document.getElementById(hide_els[i]).style.display='none';
		}
	}
	*/

	for(var i=0;i<show_els.length;i++) {

		if(document.getElementById(show_els[i])) {
			document.getElementById(show_els[i]).style.display='';
		}
	}

}
/************************/


/***** eventi clic nei tabs menu di 2° livello  ******/

function clic_sezione(obj,show_els) {

	//show_els=new Array('fondo_scheda','sez_composizioni');
	//hide_elements=new Array('fondo_dimensioni','fondo_finiture','fondo_marchiatura','fondo_autenticita','fondo_cert','fondo_download','sez_forniture','sez_stessa_linea','sez_correlati');
	show_and_hide(show_els, "scomparsa");
	set_active(obj);
	set_inactive(obj,"menu_catalogo");
}

function clic_sottosezione(obj,show_els) {

	//show_els=new Array('fondo_scheda','sez_composizioni');
	//hide_elements=new Array('fondo_dimensioni','fondo_finiture','fondo_marchiatura','fondo_autenticita','fondo_cert','fondo_download','sez_forniture','sez_stessa_linea','sez_correlati');
	show_and_hide(show_els, "scomparsab");
	set_active(obj);
	set_inactive(obj,"sottomenu_catalogo");
}

/****************/
// ]]>
