function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var ancienLien = null;
var ancienNom = null;
var ancienActu = null;

function FadeActus(aAfficher) {
	if (ancienActu == null) ancienActu = 1;
	if (document.getElementById('imgmenu' + ancienActu) != null) document.getElementById('imgmenu' + ancienActu).src = 'images/vide.gif';
	if (document.getElementById('lienmenu' + ancienActu) != null) document.getElementById('lienmenu' + ancienActu).className = 'texte-titre-actu';
	
	$("#actu" + ancienActu + ":visible").fadeOut(function () {
		$("#actu" + aAfficher + "").fadeIn();
		if (document.getElementById('imgmenu' + aAfficher) != null) document.getElementById('imgmenu' + aAfficher).src = 'images/fleche-sousmenu.png';
		if (document.getElementById('lienmenu' + aAfficher) != null) document.getElementById('lienmenu' + aAfficher).className = 'texte-titre-actu-clic';
	});	
	
	ancienActu = aAfficher;
}

function FadeServices(aAfficher) {
	//alert('on cache '+$("#ongletactif").val()+' on affiche '+aAfficher);
	if ((aAfficher==2)||(aAfficher==3)) {
		$("#menuservice").fadeOut();
	}
	var actuel = $("#ongletactif").val();
	if (((actuel==2)||(actuel==3))&&((aAfficher!=2)&&(aAfficher!=3))){
		$("#menuservice").fadeIn();
	}
	$("#actu"+$("#ongletactif").val()).fadeOut(function (){
		$("#actu"+aAfficher).fadeIn();
		$("#ongletactif").attr("value",aAfficher);
	});
	/*if (ancienActu == null) ancienActu = 1;
	if (document.getElementById('imgmenu' + ancienActu) != null) document.getElementById('imgmenu' + ancienActu).src = 'images/vide.gif';
	if (document.getElementById('lienmenu' + ancienActu) != null) document.getElementById('lienmenu' + ancienActu).className = 'texte-services';
	
	$("#actu" + ancienActu + ":visible").fadeOut(function () {
		$("#actu" + aAfficher + "").fadeIn();
		if (document.getElementById('imgmenu' + aAfficher) != null) document.getElementById('imgmenu' + aAfficher).src = 'images/fleche-sousmenu.png';
		if (document.getElementById('lienmenu' + aAfficher) != null) document.getElementById('lienmenu' + aAfficher).className = 'texte-titre-actu-clic';
	});	
	
	ancienActu = aAfficher;*/
}
/*
$("#menuservice ul li img").click(function(){

});
*/
function FadeServices2(aAfficher) {
	var ch;
	$("#contenu_service div").hide();
	// initialisation boutons
	$("#menuservice ul li img").each(function(){
		ch=$(this).attr("src");
		$(this).attr("src",ch.replace('-on','-off'));
	});
	
	// initialisation menu boutons
	if ((aAfficher==2)||(aAfficher==3)) {
		$("#menuservice").fadeOut();
	}else{
		ch=$("#picto"+aAfficher+" img").attr("src");
		$("#menuservice").fadeIn();
		$("#picto"+aAfficher+" img").attr("src",ch.replace('-off','-on'));
	}
	$("#ongletactif").val(aAfficher);
	// affichage du contenu
	$("#actu"+aAfficher+", #actu"+aAfficher+" div").fadeIn();
}

function ContactCentrale(idCours, aAfficher) {
	$("#contact" + idCours + ":visible").fadeOut(function () {
		$("#contact" + aAfficher + "").fadeIn();
	});	
}


function MRJ01(menu) {
	
	//MM_swapImage();
	
	if (menu != "presentation") {
		$("#presentation:visible").hide();
	}
	
	if (menu != "organigramme") {
		$("#organigramme:visible").hide();
	}
	
	if (menu != "coordonnees") {
		$("#coordonnees:visible").hide();
	}
		
	if (menu != "engagements") {
		$("#engagements:visible").hide();
	}
			
	if (menu != "charte") {
		$("#charte:visible").hide();
	}
				
	if (menu != "contact") {
		$("#contact:visible").hide();
	}
	
	// ### Recherche des infos sur l'onglet cliqué
	switch (menu) {
		case "presentation" :
			numImage = "Image28";
			nomImage = "jardinage";
			break;
		case "organigramme" :
			numImage = "Image29";
			nomImage = "organi";
			break;
		case "coordonnees" :
			numImage = "Image30";
			nomImage = "coord";
			break;
		case "engagements" :
			numImage = "Image31";
			nomImage = "engagement";
			break;
		case "charte" :
			numImage = "Image32";
			nomImage = "charte";
			break;
		case "contact" :
			numImage = "Image27";
			nomImage = "contact";
			break;
	}
	
	// ### Remet l'évènement onmouseout à l'onglet cliqué précédemment
	if (ancienLien != null) {
		if (document.getElementById('lien' + ancienLien) != null) document.getElementById('lien' + ancienLien).onmouseout = document.getElementById('lien' + numImage).onmouseout;
		document.getElementById(ancienLien).src = '/images/titre-boite-' + ancienNom + '-off.png';
	}
	
	// ### Met l'onglet en cours et affiche la div
	$("#" + menu + ":hidden").show();
	document.getElementById('lien' + numImage).onmouseout = function() { return true; };
	document.getElementById(numImage).src = '/images/titre-boite-' + nomImage + '-on.png';
	
	// ### Mémorise l'onglet courant
	ancienLien = numImage;
	ancienNom = nomImage;
}



