//***************************************************
// FONCTION POUR TOUT TROUVER EN UN CLIC
//***************************************************

  gl_voir_f = new Array(0, 0, 0, 0, 0, 0);

  function voir_on(num)
  {
	 // document.getElementById("divDroiteHautCenterTexte").style.display = "none";
	 if (gl_voir_f[num] == 1)
	 {
		voir_reset_flags();
	 }
	 else
	 {
		gl_voir_f[num] = 2; // en attente.
		setTimeout("voir(" + num + ")", 100);
	 }
  }

  function voir_reset_flags()
  {
	 for (cpt = 0; cpt < 6; ++cpt)
		if (gl_voir_f[cpt] != 1)
		   gl_voir_f[cpt] = 0;
  }

  function voir_out(num)
  {
	 voir_reset_flags();
  }

  function voir(num)
  {
	 if (gl_voir_f[num] == 2)
	 {
		gl_voir_f = new Array(0, 0, 0, 0, 0, 0);
		gl_voir_f[num] = 1;
		var cpt;
		for (cpt = 0; cpt < 6; ++cpt) {
		   if (cpt != num && document.getElementById("info_bt_" + cpt) != null)
		   {
			  document.getElementById("info_bt_" + cpt).style.background = "#00A8B3";
			  document.getElementById("info" + cpt).style.display = "none";
		   }
		}
		if (document.getElementById("info_bt_" + num) != null)
		{
		   document.getElementById("info_bt_" + num).style.background = "#007580";
		   document.getElementById("info" + num).style.display = "block";
		}
	 }
  }
//***************************************************


function aujourdhui() {
	monDiv11 = document.getElementById("divPeriode");
	if (document.forms[0].agendaCheckbox.checked){
		monDiv11.style.display = "none";
		
	} else {
		monDiv11.style.display = "block";
		
	}
}


/* Menu d'affihage et d'impression */
function textePlus(fontSizeDivContenu){
	var fontSizeDivContenuNew = fontSizeDivContenu + 10;
	document.getElementById('divContenu').style.fontSize= fontSizeDivContenuNew + '%';
	return fontSizeDivContenuNew;
}
function texteMoins(fontSizeDivContenu){
	var fontSizeDivContenuNew = fontSizeDivContenu - 10;
	if(fontSizeDivContenuNew < 10){
		fontSizeDivContenuNew = 10;
	}
	document.getElementById('divContenu').style.fontSize= fontSizeDivContenuNew + '%';
	return fontSizeDivContenuNew;
}

/* Liste dynamiques*/
var idList = new Array();
idList[0] = "listMairie";
idList[1] = "listPublications";
idList[2] = "listSortir";
idList[3] = "listMultimedia";
idList[4] = "listActualites";
idList[5] = "listActionMunicipale";
function affichageList(nombre){
	for(var i=0; i<6; i++ ){
		if(i==nombre){
			document.getElementById(idList[i]).style.display='block';
		}else{
			document.getElementById(idList[i]).style.display='none';
		}
	}
	
}

function showFormReagir(myString){
	
	var showForm = "";
	
	splitString = myString.split("?");
	
	url = splitString[0];
	
	if (splitString[1]!=null) {
	param = splitString[1];
	splitParam = param.split("&");
}
else
	
{
splitParam=null;	
}
	

	
	if (splitParam!=null) {
			
		if (splitParam.length>1){
				
			splitUnParam = splitParam[1].split("=");
				
			if (splitUnParam!=null) {
					
				if (splitUnParam.length>1)	{
						
					if (splitUnParam[0]=="showForm") {
							
						showForm = splitUnParam[1];
						
					}				
					
				}
				
			}
			
		}
		
	}
		
	return showForm;
}

/* changeSelect */
function loadPage(){
	if (document.getElementById('questions'))
	{
		document.getElementById('questions').style.width = 100 + '%';
	}
	if (document.getElementById('profils'))
	{
		document.getElementById('profils').style.width = 100 + '%';
	}
	/*document.getElementById('questions').style.width = 100 + '%';
	document.getElementById('profils').style.width = 100 + '%';*/
	if (document.getElementById('Reagir')!=null) {	
		myString = new String(document.URL);
		var showForm = "";
		
		showForm = showFormReagir(myString);
		
		if (document.getElementById('Reagir').style.display!="block"){
			
			if (showForm==""){
				document.getElementById('Reagir').style.display = "none";
			}
			else{
				
				document.getElementById('Reagir').style.display = "block";
			
			}
		
		}
	
	}

	if (document.getElementById('recommanderPage').style.display!="block"){
		document.getElementById('recommanderPage').style.display = "none";
	}
	else {
		if (document.getElementById('Reagir')!=null){
			hideId('Reagir');
		}
	}
	
//	hideId('divStructure');
//	hideId('divSanFil');

/* Galerie des photos pour les miniSite */
	if (document.getElementById('galeriePhotos')) {
		if (document.getElementById('galeriePhotos').style.display ="block"){ 
			hideClasse("Galerie");
			showId("ph1");
			hideId("firstLi");
			var allPageTagsA = document.getElementById('lien1').getElementsByTagName("a");
			allPageTagsA[0].style.color="#ff7300";
		}
	}
}

function affReaction() {
	if (document.getElementById('Reagir')!=null){
		document.getElementById('Reagir').style.display = "block";
		if (document.getElementById('recommanderPage').style.display=="block"){
			document.getElementById('recommanderPage').style.display = "none";	
		}
	}
}

function affRecommanderPage() {	
	if (document.getElementById('recommanderPage')!=null){	
		document.getElementById('recommanderPage').style.display = "block";
		if (document.getElementById('Reagir').style.display!="none"){
			document.getElementById('Reagir').style.display = "none";
		}

	}
}


 /* changeSelect */
function loadPageDet(){
	document.getElementById('questions').style.width = 100 + '%';
	document.getElementById('profils').style.width = 100 + '%';
}

/** fonction pour cacher une élément par class **/

function hideClasse(theClass) {
var allPageTags = new Array();
var allPageTags=document.getElementsByTagName("*"); 
	for (i=0; i<allPageTags.length; i++) {  
		if (allPageTags[i].className==theClass) {  
		allPageTags[i].style.display='none'; 
		}
	}
}

/** fonction pour afficher une élément par class **/

function showClasse(theClass) {
var allPageTags = new Array();
var allPageTags=document.getElementsByTagName("*"); 
	for (i=0; i<allPageTags.length; i++) {
		if (allPageTags[i].className==theClass){ 
		allPageTags[i].style.display='block'; 
		}
	}
}

/** fonction pour cacher une élément par id **/

function hideId(id) {
document.getElementById(id).style.display='none';
}

/** fonction pour afficher une élément par id **/

function showId(id) {
	document.getElementById(id).style.display='block';

	myString = new String(document.URL);
	var showForm = "";

	showForm = showFormReagir(myString);
	if (document.getElementById('Reagir')) {
		//alert("showForm="+showForm);
		if (document.getElementById('Reagir').style.display!="block"){
			if (showForm==""){
				document.getElementById('Reagir').style.display = "none";
			}
			else{		
				document.getElementById('Reagir').style.display = "block";		
			}	
		}
	}
}

/** fonction pour afficher le lien "afficher" et réduire le lien "réduire" de la page téléchargement **/
	
	function onloadTelechargement() {
		showClasse('lienDetailPlus1');
		hideClasse('detail1');

		showClasse('lienDetailPlus2');
		hideClasse('detail2');

		showClasse('lienDetailPlus3');
		hideClasse('detail3');

		showClasse('lienDetailPlus4');
		hideClasse('detail4');

		showClasse('lienDetailPlus5');
		hideClasse('detail5');

		showClasse('lienDetailPlus6');
		hideClasse('detail6');

		showClasse('lienDetailPlus7');
		hideClasse('detail7');

		showClasse('lienDetailPlus8');
		hideClasse('detail8');

		showClasse('lienDetailPlus9');
		hideClasse('detail9');

		showClasse('lienDetailPlus10');
		hideClasse('detail10');

		showClasse('lienDetailPlus11');
		hideClasse('detail11');

		showClasse('lienDetailPlus12');
		hideClasse('detail12');

		showClasse('lienDetailPlus13');
		hideClasse('detail13');

		showClasse('lienDetailPlus14');
		hideClasse('detail14');

		showClasse('lienDetailPlus15');
		hideClasse('detail15');

		showClasse('lienDetailPlus16');
		hideClasse('detail16');

		showClasse('lienDetailPlus17');
		hideClasse('detail17');

		showClasse('lienDetailPlus18');
		hideClasse('detail18');

		showClasse('lienDetailPlus19');
		hideClasse('detail19');

		showClasse('lienDetailPlus20');
		hideClasse('detail20');
	}
	
	/******************************************************************/
	function creerListe(form,txt1,txt2,sousTheme,val){
     for (j=0;j<txt1.length;j++) {
			if (txt2[j]==val)
			{
				form.sousTheme.options[j] = new Option(txt1[j], txt2[j], true , true);
			}
			else
				form.sousTheme.options[j] = new Option(txt1[j], txt2[j], false , false);
		}
  }
/******************************************************************/

function traitementListeDeroulante(id){
	
	window.location.href = "index.php?id="+id;

}


function traitementListeDeroulanteQuartier(id){
	window.location.href = "index.php?id="+id;
}
