// JavaScript Document

function montreMenu(idMenu){
	if (menuEnCours == idMenu){
		cacheMenuSeul(idMenu);
	}
	else{
	cacheAllSousMenu();
	var madiv = "sousMenu_num"+idMenu;
	window.document.getElementById(madiv).className='sousMenuOn';
	window.document.getElementById('icone_num'+idMenu+'_on').className ='iconeMenuOn';
	window.document.getElementById('icone_num'+idMenu+'_off').className ='iconeMenuOff';
	menuEnCours = idMenu;
	}
}

function cacheAllSousMenu(){
	for (i=1; i<=nbrMenuTotal ;i++){
		var madiv = "sousMenu_num"+i;
		window.document.getElementById(madiv).className='sousMenuOff';
		window.document.getElementById('icone_num'+i+'_on').className ='iconeMenuOff';
		window.document.getElementById('icone_num'+i+'_off').className ='iconeMenuOn';
	}
}
function cacheMenuSeul(idMenu){
		var madiv = "sousMenu_num"+idMenu;
		window.document.getElementById(madiv).className='sousMenuOff';
		window.document.getElementById('icone_num'+idMenu+'_on').className ='iconeMenuOff';
		window.document.getElementById('icone_num'+idMenu+'_off').className ='iconeMenuOn';
		menuEnCours = 0;
}

/*  bloc critère de filtre */
function montrecacheCritere(){
	var divContenu = window.document.getElementById('contenuCritere');
	var divFooter = window.document.getElementById('footerCritere');
	var pictoFleche1 = window.document.getElementById('flecheCrit1');
	var pictoFleche2 = window.document.getElementById('flecheCrit2');
	//on test si on doit montrer ou cacher la div.
	if (divFooter.className=='footerDeplieCritereFiltre'){
		// si le bloc est déplié on le replie.
		divFooter.className = 'footerPlieCritereFiltre';
		divContenu.style.display = 'none';
		pictoFleche1.style.display = 'inline';
		pictoFleche2.style.display = 'none';
	}else{
		// si le bloc est plié on le déplie.
		divFooter.className = 'footerDeplieCritereFiltre';
		divContenu.style.display = 'block';
		pictoFleche1.style.display = 'none';
		pictoFleche2.style.display = 'inline';
	}
}
function montrecacheCriterePetit(){
	var divContenu = window.document.getElementById('contenuCritere');
	var divFooter = window.document.getElementById('footerCritere');
	var pictoFleche1 = window.document.getElementById('flecheCrit1');
	var pictoFleche2 = window.document.getElementById('flecheCrit2');
	//on test si on doit montrer ou cacher la div.
	if (divFooter.className=='footerDeplieCritereFiltrePetit'){
		// si le bloc est déplié on le replie.
		divFooter.className = 'footerPlieCritereFiltrePetit';
		divContenu.style.display = 'none';
		pictoFleche1.style.display = 'inline';
		pictoFleche2.style.display = 'none';
	}else{
		// si le bloc est plié on le déplie.
		divFooter.className = 'footerDeplieCritereFiltrePetit';
		divContenu.style.display = 'block';
		pictoFleche1.style.display = 'none';
		pictoFleche2.style.display = 'inline';
	}
}


/* page resultats participants */
var boxSelected = false;

function checkAll(nbLignes) {
	for (i=1; i<=nbLignes; i++) {
			if (window.document.forms.formResult['ligne['+i+']']){
				window.document.forms.formResult['ligne['+i+']'].checked = !boxSelected;
			}
		}
	boxSelected = !boxSelected;
}

function montreOnglet(numOnglet, texteLien){
	var tabName = ['div_resume','div_desc_technique','div_desc_commerciale'];
	var tabIntitule = ['Résumé','Descriptif technique','Descriptif commercial'];
	//on enlève le lien hypertext sur l'onglet
	var mononglet = "item"+numOnglet;
	
	
	window.document.getElementById(mononglet).innerHTML = "<p>"+texteLien+"</p>";
	
	
	
	//on cache toutes les div et on remet le style 'onglet vert pour tous les onglet'
	for (i=0; i<=2 ;i++){
		//div à afficher
		var madiv = tabName[i];
	
		window.document.getElementById(madiv).style.display ='none';
		var coinGauche = "coinGauche_"+(i+1);
		window.document.getElementById(coinGauche).className ='tabVertCoinGaucheOff';
		var hautcellule = "hautCellule_"+(i+1);
		window.document.getElementById(hautcellule).className ='tabVertHautOff';
		var coinDroit = "coinDroit_"+(i+1);
		window.document.getElementById(coinDroit).className ='tabVertCoinDroitOff';
		var bordGauche = "bordGauche_"+(i+1);
		window.document.getElementById(bordGauche).className ='tabVertFondCoinG_off';
		var fondCellule = "fondCellule_"+(i+1);
		window.document.getElementById(fondCellule).className ='tabVertFondCoinC_off';
		var bordDroit = "bordDroit_"+(i+1);
		window.document.getElementById(bordDroit).className ='tabVertFondCoinC_off';
		//on met en place des liens pour chaque onglet
		var linkOnglet = "item"+(i+1);
		window.document.getElementById(linkOnglet).innerHTML = "<p><a href=\"javascript:montreOnglet("+ (i+1)+",'"+ tabIntitule[i] +"')\" class=\"txtBlanc\">"+ tabIntitule[i] +"</a></p>";
		
	}
	//on change le style en actif de la div sur laquelle on a cliqué
	var coinGauche = "coinGauche_"+numOnglet;
	window.document.getElementById(coinGauche).className ='tabVertCoinGaucheOnPastel';
	var hautcellule = "hautCellule_"+numOnglet;
	window.document.getElementById(hautcellule).className ='tabVertHautOnPastel';
	var coinDroit = "coinDroit_"+numOnglet;
	window.document.getElementById(coinDroit).className ='tabVertCoinDroitOnPastel';
	var bordGauche = "bordGauche_"+numOnglet;
	window.document.getElementById(bordGauche).className ='tabVertFondCoinG_onPastel';
	var fondCellule = "fondCellule_"+numOnglet;
	window.document.getElementById(fondCellule).className ='tabVertFondCoinC_on';
	var bordDroit = "bordDroit_"+numOnglet;
	window.document.getElementById(bordDroit).className ='tabVertFondCoinD_onPastel';
	//on enlève le lien hypertext sur l'onglet
	var mononglet = "item"+numOnglet;
	window.document.getElementById(mononglet).innerHTML = "<p>"+texteLien+"</p>";
	//enfin, on affiche celle qui nous concerne
	var div_a_afficher = tabName[numOnglet-1];
	window.document.getElementById(div_a_afficher).style.display ='block';
	
	
}