function rempla (j,k,l) {
	var x = j;
	for (i=1;i<5;i++) {
		x = x.replace(k,l);
	}
	return x;
}

/*function chgLang(l) {
	var actL = document.location.href;
	if (l == "fr") chgL = actL.replace("_eng","_fr")
	else chgL = actL.replace("_fr","_eng")	
	document.location.replace(chgL);
}*/
function chgLang(l) {
	var actL = document.location.href;
	if (l == "fr") chgL = rempla(actL,"_eng","_fr")
	else/* if (!actL.match("_eng"))*/ chgL = rempla(actL,"_fr","_eng")	
	document.location.assign(chgL);
}

function Aff_detail(a,b,c,d){
	e = "' scrollbars=yes, resizable=yes, width=" + c + ", height=" + d + "'" //! l'espace avant "scrollbars" est nécessaire !
	popup2 = window.open(a,b,e);
	popup2.focus();
};

function VersionNavigateur(VerNetscape) {
/*function VersionNavigateur(VerNetscape, VerExplorer) {
 if ((navigator.appVersion.substring(0,3) >= VerNetscape && navigator.appName == 'Netscape') || 
(navigator.appVersion.substring(0,3) >= VerExplorer && navigator.appName.substring(0,9) == 'Microsoft')) */
if (navigator.appVersion.substring(0,3) < VerNetscape && navigator.appName == 'Netscape' && navigator.userAgent == 'Mozilla/4.7 [fr] (Win98; I)')
return true;
else return false;}

function PopIt(path_name, numb, maxi){
	var IMAGE = ""
	if (numb <=9) IMAGE = "<img name='crumby' src='" + path_name + '0' + numb + ".jpg' width='100%' border='0'>";
	else IMAGE = "<img name='crumby' src='" + path_name + numb + ".jpg' width='100%' border='0'>";
	var s1 = "<html><head>"
	var FUNK = "<script language='JavaScript' type='text/javascript'>" + 
	"image_courante=" + numb + ";" + 
	"maxi=" + maxi + ";" + 
	"image_rep='" + path_name + "';" + 
	"function browse(name,num) {" + 
	"if (num < 0) {image_courante -= 1;" + 
	"if (image_courante <= 0) image_courante = -num;};" + 
	"if (num > 0) {image_courante += 1;" + 
	"if (image_courante > num) image_courante = 1;};" + 
	"if (image_courante <=9) name.src = image_rep + '0' + image_courante + '.jpg';" + 
	"else name.src = image_rep + image_courante + '.jpg';};" + 
	"<\/script>";

	var s2 = "</head><BODY BGCOLOR='#ffffff' onLoad='self.focus()'><TABLE BORDER='0px' style='text-align: center;'>"
	var s2bis = "</head><BODY BGCOLOR='#ffffff'><TABLE BORDER='0px' style='text-align: center;'>"
        var boutons = "<TR><TD>" + 
        "<FORM><INPUT TYPE='BUTTON' VALUE='Précédente'" + 
	"onClick='browse(document.crumby,-maxi)'>" +  
        "<INPUT TYPE='BUTTON' VALUE='Close'" + 
        "onClick='self.close()'>" + 
        "<INPUT TYPE='BUTTON' VALUE='Suivante'" + 
	"onClick='browse(document.crumby,maxi)'></FORM>" + 
	"</TD></TR>"
	var s3 = "<TR><TD ALIGN=left>" + IMAGE + "</TD></TR></TABLE></BODY></html>"
		
        popup = window.open("","visual","top=0,left=180,height=450,width=620,scrollbars=yes,resizable");
/* Le moteur Mozilla ne se comporte pas comme celui de IE avec le "focus". Cette partie est adapté
 à l'utilisation de Netscape 4.xx, IE 5.5 (et +) et Mozilla 5.0 (bug partiellement) il faudra
  l'adapter a d'autres navigateurs ou version.*/
		if (VersionNavigateur(5.0)) popup.document.write(s1+s2bis+s3);
		else popup.document.write(s1+FUNK+s2+boutons+s3);
		popup.document.close();
		popup.focus();
};

/* Cette fonction permet le surlignage d'une ligne dans un tableau au survol de la souris */
function onMouseTd (x) {
	var tableAccessoire = document.getElementsByTagName('table');
	for (i in tableAccessoire) {
		/*if () continue;*/ // prévoir aussi une sélection par ID
		if (tableAccessoire[i].className != x) continue;
		var tAtr = tableAccessoire[i].getElementsByTagName('tr');
		for (var ii=0;ii<tAtr.length;ii++) {
			tAtr[ii].onmouseover = function () {
				this.style.backgroundColor = "#e0e0e0";
			};
			tAtr[ii].onmouseout = function () {
				this.style.backgroundColor = "#ffffff";
			};
			tAtr[ii].onmousedown = function () {
				alert("Photos non disponibles");
			};
		}
	}
}

var maineuh = document.getElementById('maineuh');
var comhand = "?affich=";
function onLoadingMenu() {
	//if (!W3CDOM) {alert("Ce navigateur n'est pas W3C !!!"); return;}
	
/* Actions sur les objets du menu */
	var liens = maineuh.getElementsByTagName('a');
	for (var x=0;x<liens.length;x++) {
		var thisHref = eval("\"" + liens[x].href + "\"");
		var docHost = eval("\"" + document.location.hostname + "\"");
		// --> this.href fonctionne directement avec Firefox mais pas IE
		if (thisHref.match(/[#]||[javascript]||[mailto]/)) { // Si href contient "#" ou "javascript" ou "mailto" -> rien
		/*if (thisHref.match(/[http:\/\/]||[file:\/\/\/]||[ftp:\/\/]||[mailto:]/))*/
		}
		else if ((liens[x].hostname != document.location.hostname)||(liens[x].protocol != document.location.protocol)) liens[x].setAttribute("target", "_blank"); // Si href contient un nom de domaine ou un protocole différent de celui de la page -> ouverture dans une autre fenêtre. On peut ne rien faire également pour une raison de sécurité par exemple
		else {
			thisHref1 = thisHref.split(docHost+"/");
			thisHref2 = comhand + thisHref1[1];
			liens[x].setAttribute("href", thisHref2);
		};
	}
}