timer="";
timer2="";
function changecouleursmp (id) {
	document.getElementById("smp"+id).style.background="#B9C9E0";
}

function changecouleur2smp (id) {
	document.getElementById("smp"+id).style.background="#869EC5";
}

function affiche_masque (a,b) {
	for (i=1;i<4;i++) {
		for (j=1;document.getElementById('photo'+i+'_'+j);j++) {
		document.getElementById('photo'+i+'_'+j).style.display='none';
		}
	}
	if (a!=0) document.getElementById('photo'+a+'_'+b).style.display="block";
}

function affiche (id) {
	document.getElementById("actualites").style.display="none";
	for (i=1;document.getElementById("i"+i);i=i+1) document.getElementById("i"+i).style.display="none";
	document.getElementById(id).style.display="block";
}
function affichedoc () {
	document.getElementById("affiche_doc").style.display="block";
	document.getElementById("tri_doc").src="./images/triangle_msp_bas.jpg";
}

function masquerdoc () {
	document.getElementById("affiche_doc").style.display="none";
	document.getElementById("tri_doc").src="./images/triangle_msp.jpg";
}

function montre_metier(id) {
	for(i=1;document.getElementById("msp"+i);i++) {
		document.getElementById("msp"+i).style.display='none';
		document.getElementById("tri"+i).src='./images/triangle_msp.jpg';
	}
	document.getElementById("msp"+id).style.display='block';
	document.getElementById("tri"+id).src='./images/triangle_msp_bas.jpg';
}

function show (i) {
	document.getElementById("carte").src='./images/cercles/'+i;
}

function masque_photo (menu) {
	document.getElementById("menu_photo"+menu).style.display="none";
	document.getElementById("fleche"+menu).src="./images/fleche_droite.gif";
}

function showmenu_photo(menu) {
	clearTimeout(timer2);
	for (i=1;document.getElementById("menu_photo"+i);i++) {
		document.getElementById("menu_photo"+i).style.display="none";
		document.getElementById("fleche"+i).src="./images/fleche_droite.gif";
	}
	document.getElementById("menu_photo"+menu).style.display="block";
	document.getElementById("fleche"+menu).src="./images/fleche_bas.gif";
}

function time2 (id) {
	timer2=setTimeout("masque_photo("+id+")",500)
	affiche_masque(0,1);
}

function popup(document,title,height,width) {
window.open (document,title, config='height='+height+', width='+width+', toolbar=no, menubar=no, scrollbars=auto, resizable=yes, location=no, directories=no, status=no')
}

function popup1(document,title,height,width) {
window.open (document,title, config='height='+height+', width='+width+', toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no')
}

function popup2(document,title,height,width) {
window.open (document,title, config='height='+height+', width='+width+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no')
}

function popup3(document,title,height,width) {
window.open (document,title, config='height='+height+', width='+width+', toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
}
function nouvellefenetre (document) {
window.open(document,config='toolbar=no, menubar=no, scrollbars=auto, resizable=yes, location=no, directories=no, status=no')
}


function montre_image(image,title,height,width) {
	var d = document.getElementById("affiche_image");
	if (image.length>4) d.src=image;
}

function time (id) {
	timer=setTimeout("masque("+id+")",500)
}

function montre(id) {
	clearTimeout(timer);
	var d = document.getElementById("smenu"+id);
	for (var i = 1;document.getElementById('m'+i);i++) {
		document.getElementById('smenu'+i).style.display='none';
		document.getElementById('m'+i).style.color="#003580";
	}
	if (d) {
		d.style.display='block';
		document.getElementById('m'+id).style.color="#5A7192";
	}
	if (id==0) {
		document.getElementById("centre").width=575;
		color="";
		for (menu=1;menu<5;menu++) {
			if (menu==1) color="#CBCBCD";
			else if (menu==2) color="#FABB8E";
			else if (menu==3) color="#E1C4DD";
			else if (menu==4) color="#B9C9E0";
			if (navigator.appName=="Microsoft Internet Explorer") {
				document.getElementById("smenu"+menu).style.top='15px';			
			}
			for (smenu=1;document.getElementById("smenu"+menu+"_"+smenu);smenu++) {
				document.getElementById("smenu"+menu+"_"+smenu).style.background=color;
				document.getElementById('m'+menu+'_'+smenu).style.background=color;
			}
		}
	}
}

function masque (i) {
	document.getElementById('smenu'+i).style.display='none';
	document.getElementById('m'+i).style.color="#003580";
	clearTimeout(timer);
}

function masquermenu() {
	montre(0);
}

function changefond (menu,smenu) {
	if (menu==1) color="#B1B1B4";
	else if (menu==2) color="#F89955";
	else if (menu==3) color="#D2A6CC";
	else if (menu==4) color="#869EC5";
	document.getElementById('smenu'+menu+'_'+smenu).style.background=color;
	document.getElementById('m'+menu+'_'+smenu).style.background=color;
	clearTimeout(timer);
}

function origine (menu,smenu) {
	if (menu==1) color="#CBCBCD";
	else if (menu==2) color="#FABB8E";
	else if (menu==3) color="#E1C4DD";
	else if (menu==4) color="#B9C9E0";
	document.getElementById('smenu'+menu+'_'+smenu).style.background=color;
	document.getElementById('m'+menu+'_'+smenu).style.background=color;
	timer=setTimeout("masque("+menu+")",500)
}

function envoierecherche () {
	value=document.getElementById("recherche").value;
	if (value.length!=0) document.location.href="recherche.php?value="+value;
}

function VerifMail (email) {
	var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}[.][a-zA-Z0-9]{2,4}$/ ;
	var reg2 = /[.@]{2,}/ ;
	if ((reg.exec(email) == null) || (reg2.exec(email)!=null)) return -1;
	else return 0;
}


function resize () {
	document.refresh();
}

function directiondroite() {
	document.getElementById('defile').direction="right";
}

function directiongauche() {
	document.getElementById('defile').direction="left";
}

function visibilite(thingId) {
for (var i=1;document.getElementById('a'+i);i++) if ('a'+i!=thingId) document.getElementById('a'+i).style.display = "none" ;
if (document.getElementById(thingId).style.display == "none") document.getElementById(thingId).style.display = "" ;
else document.getElementById(thingId).style.display = "none" ;
}

function largeur () {
	width=window.screen.width;
	document.getElementById('conteneur').style.left=((width-980)/2-11)+"px";
}
function largeur2() {
		width=window.screen.width;
		return ((width-980)/2-3)+"px";
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function envoiemail () {
	adresse=document.getElementById('mail').value;
	var reg= new RegExp("^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+","g");
	if (reg.test(adresse)) document.location.href="mail.php?mail="+adresse+"&page="+document.location.href
	else alert("Veuillez verifier la saisie de l'e-mail");
}

function affichediv (nb) {
	for (nbdiv=1;document.getElementById('contenuderoulant'+nbdiv);nbdiv++) {
		if (nbdiv==nb) ;
		else {
			document.getElementById('contenuderoulant'+nbdiv).style.display='none';
			document.getElementById('fleche'+nbdiv).src='./images/fleche_droite.gif';
		}
	}
	if (document.getElementById('contenuderoulant'+nb).style.display=="block") {
		document.getElementById('contenuderoulant'+nb).style.display='none';
		document.getElementById('fleche'+nb).src='./images/fleche_droite.gif';
	}
	else {
		document.getElementById('contenuderoulant'+nb).style.display="block";
		document.getElementById('fleche'+nb).src='./images/fleche_bas.gif';
	}
}

function survol_map (nom) {
	document.getElementById("map").src=nom;
}

function sortie () {
	document.getElementById("map").src="default.jpg";
}

