function ouvrir_english() {
	var oldlocation = String(window.location);
	var newlocation = oldlocation.replace('/fr/','/en/');   
	if ((oldlocation == "http://www.mcq.org/index.html") || (oldlocation == "http://www.mcq.org/") || (oldlocation == "http://mcq.org/") || (oldlocation == "http://mcq.org/index.html") || (oldlocation == "http://mcq.org/index_fr.html") || (oldlocation == "http://www.mcq.org/index_fr.html")) {
		newlocation = "index_en.html";
	}
	if (oldlocation.search("/craf_fonds/craf_fonds.php") > 0) {
		newlocation = "../../../en/complexe/craf_archives.html";
	}
	if (oldlocation.search("/mcq/expositions.php") > 0) {
		newlocation = "../../en/mcq/expositions.php";
	}
	if (oldlocation.search("/maf/expositions.php") > 0) {
		newlocation = "../../en/maf/expositions.php";
	}
	if (oldlocation.search("/cipr/expositions.php") > 0) {
		newlocation = "../../en/cipr/expositions.php";
	}
	if (oldlocation.search("/presse/presse.php") > 0) {
		newlocation = "../../en/presse/presse.php";
	}
	if (oldlocation.search("/mcq/ateliers-mcq.php") > 0) {
		newlocation = "../../en/mcq/ateliers-mcq.php";
	}
	if (oldlocation.search("/maf/ateliers-maf.php") > 0) {
		newlocation = "../../en/maf/ateliers-maf.php";
	}
	if (oldlocation.search("/cipr/ateliers-cipr.php") > 0) {
		newlocation = "../../en/cipr/ateliers-cipr.php";
	}
	window.location = newlocation;
}

function ouvrir_parent(url_parent,bref_parent) {
	// voir Museactivites et Formulaire de reservation pour avoir un exemple d'utilisation
	
	fenOpener = window.opener;
	
if (fenOpener == null  || fenOpener.closed) {
		fenIndex = window.open(url_parent,"parent_top","WIDTH=780,HEIGHT=" + (screen.availHeight - 110) +",status,resizable,copyhistory,scrollbars,menubar");
		//self.close();
	} else {
		chcar = String(fenOpener.location);
		if (chcar.match(bref_parent) ) {	
			fenOpener.focus();
		} else {
			fenIndex = window.open(fenOpener.location,"parent_top","WIDTH=780,HEIGHT=" + (screen.availHeight - 110) +",status,resizable,copyhistory,scrollbars,menubar");
			fenIndex.focus();
		}		
	}
}

function NewWindowMCQ(mypage, myname, w, h, scroll, r, s,m,t) {
	winprops = 'height='+h+',width='+w+',,,scrollbars='+scroll+',resizable='+r+',status='+s+',menubar='+m+',toolbar='+t+',copyhistory'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >=0) { win.focus(); }
}

function NewWindowGP(mypage, myname, w, h, scroll, r, s,m,t) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+r+',status='+s+',menubar='+m+',toolbar='+t+',copyhistory'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >=0) { win.focus(); }
}

function ouvrir_gp_sw(url,largeur,hauteur) {

	// variables pour identifier la plateforme
	var bUser = navigator.userAgent.toLowerCase();
	var is_mac    = (bUser.indexOf("mac")!=-1);	
	NewWindowGP(url,'_blank',largeur+10,hauteur+10,'no','1','0','0','0');
}

function ouvrir_gp(section,nom_image,largeur,hauteur) {

	// variables pour identifier la plateforme
	var bUser = navigator.userAgent.toLowerCase();
	var is_mac    = (bUser.indexOf("mac")!=-1);	
	NewWindowGP('../../img/'+section+'/'+nom_image,'_blank',largeur+10,hauteur+10,'no','1','0','0','0');
}

function ouvrir_gp2(section,nom_image,largeur,hauteur) {

	// variables pour identifier la plateforme
	var bUser = navigator.userAgent.toLowerCase();
	var is_mac    = (bUser.indexOf("mac")!=-1);	
	NewWindowGP('../img/'+section+'/'+nom_image,'_blank',largeur+10,hauteur+10,'no','1','0','0','0');
}

function ouvrir_gp3(section,nom_image,largeur,hauteur) {

	// variables pour identifier la plateforme
	var bUser = navigator.userAgent.toLowerCase();
	var is_mac    = (bUser.indexOf("mac")!=-1);	
	NewWindowGP('../../../img/'+section+'/'+nom_image,'_blank',largeur+10,hauteur+10,'no','1','0','0','0');
}

function envoi_courriel(nom,objet) { 
	var adresse_courriel = nom + "@mcq.org";
	location = "mailto:" + adresse_courriel + "?subject=" + objet + "&cc=webmestre@mcq.org";
 }
 /*********************************************/

// Fonction pour ecrire dans la barre du bas du navigateur
function dm(msgStr){
		document.returnValue = false;
		if (document.images) {
			window.status = msgStr;
			document.returnValue = true;
	}
}

// Fonction pour les rollover
function di(quel_b,bouton){
	if (document.images) {
	  document.images[quel_b].src=eval(bouton+".src");
	}
}

function di2(quel_b,bouton){
	if (document.images) {
	  quel_b.src=eval(bouton+".src");
	}
}

/*********************************************/

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
              parseFloat(navigator.appVersion) >= 4 &&  parseFloat(navigator.appVersion) < 5) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var NS6 = (document.getElementById&&!document.all)

function getlongpage(div1){

	div1=getLayer2(div1);
	divlong=div1.offsetHeight + "px";
	return divlong

}

function resizepage(div1,divlong){
	
	div1=getLayer2(div1);
	bas=getLayer2("footer");
	entete=getLayer2("longentete");
	menu=getLayer2("menuhaut");
	if(isMinIE4) {
		if(navigator.appVersion.indexOf("Macintosh") != -1)pageheight=idbody.clientHeight-(bas.offsetHeight+entete.offsetHeight+84) + "px";
		else pageheight=idbody.clientHeight-(entete.offsetHeight+bas.offsetHeight-14) + "px";
	}
	else {
		pageheight=window.innerHeight-(bas.offsetHeight+entete.offsetHeight+70) + "px";
	}
	
	if(parseInt(pageheight)>=parseInt(divlong)){
		div1.style.height=pageheight;
	}
	else{
		div1.style.height=divlong;
	}
	
}

function getlong2(div1,div2){
	
	div1=getLayer2(div1);
	div2=getLayer2(div2);
	if(div1.offsetHeight>=div2.offsetHeight){
			div2.style.height=div1.offsetHeight+12 + "px";
	}
	else{
		div1.style.height=div2.offsetHeight-12 + "px";
	}
}

function getLayer2(name) {

  if (isMinNS4)
    return findLayer(name, document);
  if (isMinIE4)
    return eval('document.all.' + name);
	if (NS6)
		return document.getElementById(name);
  return null;
}

/************************************* Fonctions pour le menu ***************************************/
var namelayer="";

var layer2="";
var layer3="";
var menutimer=0;
var imgname="";
var imgpreload="";
var imgtimer=0;

function showmenu2(idlayer, name, preload){
	clearTimeout(menutimer);
	if (imgname!="" && getImage(name)!=imgname)di2(imgname,imgpreload);
	if (getImage(name)!=imgname){
		
		imgname="";
		imgpreload ="";}
	
	if (getLayer(idlayer)!=layer2 && layer2!="") hideLayer(layer2);
	di2(getImage(name),preload);
	showmenu(idlayer);
}

function showmenu(layer){
	layer2=getLayer(layer);
	if (getVisibility(layer2)=="visible" && menutimer > 0) clearTimeout(menutimer);
	showLayer(layer2);
}

function hidemenu2(idlayer, name, preloadimg){
	imgname = getImage(name);
	imgpreload = preloadimg;
	menutimer=setTimeout('hidemenu()',10);
}

function hidemenu(){
	hideLayer(layer2);
	di2(imgname,imgpreload);
	clearTimeout(menutimer);
}

function changeimg(img1, img2){
	imgchange1= getImage(img1);
	imgchange2=img2;
}

function changeimg2(){
		di2(imgchange1,imgchange2)
}
/************************************************************************************************/