// EAN
var cursor_on = "pointer";
var tab_bg_on = "orange";
var tab_color_on = "#333";

var cursor_off = "default";
var tab_bg_off = "#A88462";
var tab_color_off = "#fff";

var hidden_value = document.getElementById("ul_entree");
var visible_subSelection;







function changeStyle(elt , indicator){
	if( indicator == "tab_on"){
		elt.style.cursor = cursor_on ;	
		elt.style.backgroundColor = tab_bg_on;	
		elt.style.color = tab_color_on;
	}
	else if( indicator == "tab_off"){
		elt.style.cursor = cursor_off ;	
		elt.style.backgroundColor = tab_bg_off;	
		elt.style.color = tab_color_off;		
	}
	
}


//activate a sub selector based on the tab that has been
//clicked on. end at this time, the function which validate 
//	(-- check_radioButton(); --)
//every radio buttons in the related submenu starts its job
function subSelection_activator(elt, bool){
	
	if(elt != null){
		
		var sub_selection_id = "ul_"+ (elt.id).substring(3);
		var sub_selection = document.getElementById(sub_selection_id);
		
		if(bool){
			sub_selection.className = "subSelection";
			//now the submenu is open, we make sure the sure
			//select the amout of radio button he is expected 
			//to select
			check_radioButton(sub_selection);
		}
		else if(!bool){
			sub_selection.className = "submenu";
		}
	}//---- end if
	
}



//return the subselection attached to the tab
function tab_subSelection(tab){
	
	var sub_selection_id = "ul_"+ (tab.id).substring(3);
	var elt = document.getElementById(sub_selection_id);	
	
	return  elt;
}





function findTabs(){

	var tab_collection = document.getElementsByTagName("h3");
	var tab_collection_length = tab_collection.length;
	
	
	defaultSetting(tab_collection,tab_collection_length);
	
	
	
	
	for(var i = 0 ; i < tab_collection_length ; i++){///------
		tab_collection[i].onmouseover = function(){
			changeStyle(this , "tab_on");
			
			
		}
		
		
		tab_collection[i].onmouseout = function(){
			changeStyle(this , "tab_off");
		}	
		
		
		tab_collection[i].onclick = function(){
			///------------ find the related section
			subSelection_activator(visible_subSelection,false);
			subSelection_activator(this,true);
			visible_subSelection = this;
		}
	}//--------- end for
	
	
	
}



function defaultSetting(tab, tab_l){
	
	
		
		var default_subsection = tab_subSelection(tab[0]);
		subSelection_activator(default_subsection,true);
		visible_subSelection = default_subsection;
		
	
	
	
}


