// JavaScript Document


// TEXTE DES BULLES D'AIDE DES PICTOS

var txMail = "Envoyer un mail";
var txPrint = "Imprimer";
var txEcard = "Envoyer une E-card";
var txAccess = "Visiteurs à mobilité réduite";
var txOeil = "Visiteurs non-voyants et malvoyants";
var txMain = "Visiteurs sourds et malentendants";
var txTete = "Visiteurs handicapés mentaux";







/*/////////// PICTO FONCTIONS ////////////*/


function pict(t,g){

n = t.getElementsByTagName('img').item(0).getAttribute('src');
w = t.getElementsByTagName('img').item(0).width;
nF = n.substring(0,n.lastIndexOf('_'))

tx = t.getAttribute('tooltip');
idImg = t.id


 switch (idImg)
{
case(idImg="mail"):
tx = txMail
  break
case(idImg="access"):
tx = txAccess
  break
case(idImg="print"):
tx = txPrint
  break  
case(idImg="ecard"):
tx = txEcard
  break  
case(idImg="oeil"):
tx = txOeil
  break    
case(idImg="main"):
tx = txMain
  break   
case(idImg="tete"):
tx = txTete
  break   
case(idImg="access"):
tx = txAccess
  break   
  
}


var y = document.createTextNode(tx)
posL = t.offsetLeft;
if(navigator.userAgent.indexOf('MSIE')>=0){
posL += 0
}
if(navigator.userAgent.indexOf('Safari')>=0){
posL -= 202
}

if (g==1){

txD = t.parentNode.parentNode.parentNode.getElementsByTagName('div').item(2)

}
else {
txD = t.parentNode.parentNode.getElementsByTagName('div').item(0);
}

if ( n.indexOf('_0')>=0){
t.getElementsByTagName('img').item(0).setAttribute('src',nF+"_1.gif");
if(navigator.userAgent.indexOf('Gecko')>=0){ posL=posL-w-3 }


if(t.parentNode.parentNode.className!='fonctions'){
txD.style.marginLeft=posL+"px"; 
}

//txD.innerHTML = tx;
txD.innerHTML=''
txD.appendChild(y);

}
else{
t.getElementsByTagName('img').item(0).setAttribute('src',nF+"_0.gif");
txD.innerHTML = '&nbsp;';
}

}

/*/////////// MENU NIV1 DHTML ////////////*/

var mSel = 0

function mDHTML(n,t){

desel(n)
if(n>=4){ t.parentNode.style.backgroundColor = "#fff"  }

di = "sm"+n
document.getElementById(di).style.display = 'block'
mSel = n
}



function desel(n){

if(mSel!=0){

di1 = "sm"+mSel; 
document.getElementById(di1).style.display = 'none'
document.getElementById(mSel).style.backgroundColor = ""  
document.getElementById(mSel).style.color = "" 
if(mSel>=4&&mSel!=n){
document.getElementById(mSel).parentNode.style.backgroundColor = "transparent"  
 
}
}


}


function mDHTML2(n,t){

//if(mSel>=4){ document.getElementById(mSel).parentNode.style.backgroundColor = "transparent"  }
document.getElementById(mSel).style.backgroundColor = "#fff" 
document.getElementById(mSel).style.color = "#039" 
}



function dm2(t){
t.getElementsByTagName('a').item(0).style.color='#039'
t.getElementsByTagName('a').item(0).style.backgroundColor='#fff'

}

var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)


function M_out(e)
{
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX;
		posy = e.clientY;
		if (isIE)
		{
			posx += document.body.scrollLeft;
			posy += document.body.scrollTop;
		}
	}
	

	
//	window.status=posx+" "+posy+" out"


	if((posx<202)||posy<2||(posy>45))
	{
	desel(0)
	}


}




function pictures1(t,s,n){
t.getElementsByTagName('img').item(0).style.border = "1px solid #039";

var info='';

if (s != 1){

if(n!=-1){
nPict = n+"infoPictures";

		info = document.getElementById(nPict);

		infoTxt = t.getElementsByTagName('img').item(0).getAttribute('info');
}

		
		getPreviousSibling(t);
		
		
		if(num < 3 )
		{
		if(info!='')info.style.marginRight = "0";
		if(info!='')info.style.textAlign = "left";
			if (navigator.userAgent.indexOf("MSIE 5")>=0 && navigator.userAgent.indexOf("Win")>=0){	
			}
			else {
			if(info!='')info.style.marginLeft = t.offsetLeft+3+"px";
			}
		}
		else {
			if (navigator.userAgent.indexOf("MSIE 5")>=0 && navigator.userAgent.indexOf("Win")>=0){
			
			}
			else {
			posDroite = 545 - t.offsetLeft - t.offsetWidth + 3;
			if(info!='')info.style.marginRight = posDroite+"px";
			}
		if(info!='')info.style.textAlign = "right";
		if(info!='')info.style.marginLeft = "0";

		}
		
		if(info!='')info.innerHTML = infoTxt;
		if(info!='')info.style.visibility = "visible";
		
		num = 0
	}
}

function pictures2(t,n){
t.getElementsByTagName('img').item(0).style.border = "1px solid #dfdfdf";

if(n!=-1){
//window.status=n;
nPict = n+"infoPictures";

info = document.getElementById(nPict);
info.style.visibility = "hidden";
}
}

var num = 0

function getPreviousSibling(t){
prec = t.previousSibling;
if (prec != null && prec.nodeType == 3) { prec = prec.previousSibling ; };

if (prec == null) { return; }
else { num++; getPreviousSibling(prec);  }

}

function pictures3(t,n){

getPreviousSibling(t.parentNode);
les_imgs = document.getElementById((n+'pictures')).getElementsByTagName('table').item(0);
l_img = les_imgs.getElementsByTagName('td').item(num);
pictures1(l_img,1,n);
num = 0;

bulle = t.getElementsByTagName('div').item(0);
texte = t.getAttribute('tooltip');

bulle.innerHTML = texte;
bulle.style.display = "block"
}


function pictures4(t,n){
getPreviousSibling(t.parentNode);
les_imgs = document.getElementById((n+'pictures')).getElementsByTagName('table').item(0);
l_img = les_imgs.getElementsByTagName('td').item(num);
pictures2(l_img,n);
num = 0;

bulle = t.getElementsByTagName('div').item(0);
bulle.style.display = "none"
bulle.innerHTML = "&nbsp;"
}



/*/////////// CORRECTIONS DE STYLES ////////////*/

/* Netscape 7  */

if(navigator.userAgent.indexOf('Netscape')>=0){
document.write('<style type="text/css">#contenu #retourHaut { position: relative; left: 548px}.lienPage A { display: block}.lienPage A:firstLine { font-family: arial; font-size: 11px ; font-weight: bold ;  color: red ; text-decoration: none; text-indent: -10px; }.lienPage {width: 150px} .pictures TABLE TR.imagesPlus .bulleAide {  margin-left: 30px; } .pictures TABLE TR.imagesPlus .bulleAide { margin-left: 25px;} .carres { margin-bottom: 8px !important } #outilsRech { margin-bottom: 9px !important }#outils .rechInput { height: 20px !important; font-size: 10px} #outils form input { position: relative; top: -4px !important}</style>')}


/* IE 5 Mac */

if(navigator.userAgent.indexOf('MSIE')>=0&&navigator.userAgent.indexOf('Mac')>=0){document.write('<style type="text/css">#menuNiv1HTML .sm A { width: 50px } #infos #encart { float:none} #ecardP { margin-top: 0; vertical-align:top } #outils form input { position: relative; top: -3px !important} #accueil #infosAccueil DIV { float: none; padding-bottom: 15px } #outils { margin-top: -22px !important } .pictures {  float:none;  } #menuOutils #DIVoutils {   } #menuOutils #retourHaut {  float: left;  margin-left: 752px;  position:relative;  } #menuOutils #outils {} #accueil #contenu #DIVinfos { margin-left: -2px !important; }#infos .ancre { height: 42px } #infos .ancre H3 { padding-bottom: 5px } INPUT.envoyer { background: width: 80px; height: 20px; } INPUT.annuler { width: 80px; height: 20px; } #contenu #DIVinfos { background-position: 1px -3px; ;  } </style>');
}

/* IE 6 PC */

if(navigator.userAgent.indexOf('MSIE 6')>=0&&navigator.userAgent.indexOf('Win')>=0){document.write('<style type="text/css"> #accueil #infosAccueil { float:none !important } #contenu #menuGauche #rubriques: {    } #accueil #contenu #DIVinfos { margin-left: -2px; } </style>');}

/* IE 5 PC */

if(navigator.userAgent.indexOf('MSIE 5')>=0&&navigator.userAgent.indexOf('Win')>=0){document.write('<style type="text/css">#contenu #retourHaut { position: relative; left: 548px} #infos #menuAncres A.lienAncre { float: left !important  } #accueil #infosAccueil { float:none !important } #infos .fonctions .pictos { overflow:visible; width: auto; white-space: nowrap } #infos #menuAncres A.lienAncre { background-position: 0 6px;  } .pictures .infoPictures { text-align: left !important; margin-left: 15px  !important}#accueil #contenu #DIVinfos { margin-left: -2px; }</style>');}

/* Mozilla... */

if(navigator.userAgent.indexOf('Gecko')>=0&&navigator.userAgent.indexOf('Netscape')<0&&navigator.userAgent.indexOf('Safari')<0){document.write('<style type="text/css">.lienPage A { display: block}.lienPage A:firstLine { font-family: arial; font-size: 11px ; font-weight: bold ;  color: red ; text-decoration: none; text-indent: -10px; }.lienPage {width: 150px} .pictures TABLE TR.imagesPlus .bulleAide { margin-left: 25px;}</style>')}

/* Safari... */

if(navigator.userAgent.indexOf('Safari')>=0){document.write('<style type="text/css">#contenu #retourHaut { position: relative; left: 548px}.lienPage A { display: block}.lienPage A:firstLine { font-family: arial; font-size: 11px ; font-weight: bold ;  color: red ; text-decoration: none; text-indent: -10px; }.lienPage {width: 150px} #infos #encart .txtEncart { float:left} .pictures TABLE TR.imagesPlus .bulleAide {  position:relative !important; margin-left: 25px; ;width: 50px !important } .lienPage {  padding-left: 15px;  } .lienPage A {  text-indent: 0;  }  .lienPage A SPAN {   } #infos .inform .legPictos { white-space: nowrap  } #outilsRech { margin-top: 6px; vertical-align: top !important } .carres { margin-top: 7px; vertical-align: top !important } #infos .inform .pictos A { cursor: default } .pictures TABLE TR.imagesPlus A.photo { cursor: default; }  #outils form input { position: relative; top: -3px !important} .pictures {  float:none;  } #accueil #titreMusee {   } #infos .ancre H3 { padding-bottom: 4px }</style>')}



// patch mozilla family version 1.6 et +

if(navigator.userAgent.indexOf('Gecko')>=0&&navigator.userAgent.indexOf('Netscape')<0&&navigator.userAgent.indexOf('Safari')<0&&parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('rv:')+3,navigator.userAgent.indexOf('rv:')+6))>=1.6){document.write('<style type="text/css">#accueil A.ville { display: block; }</style>');}	
	



function initPage(){
// corrige la hauteur des pages courtes
/*
if(document.getElementById('DIVinfos')){
minHaut = document.getElementById('DIVinfos').offsetHeight
if(minHaut < 650) 
{
document.getElementById('DIVinfos').style.paddingBottom = (650 - minHaut) + "px"
}	
}
*/

// corrige la heuteur des menus gauche courts
if(document.getElementById('rubriques')){
minHaut2 = document.getElementById('rubriques').offsetHeight
if(minHaut2 < 150) 
{
document.getElementById('rubriques').style.paddingBottom = (150 - minHaut2) + "px"
}

// enlève les blanc s dans les titres du menu gauche vides

menuG = document.getElementById('rubriques').getElementsByTagName('table')
for (i=0;i<menuG.length;i++){

if(menuG[i].getElementsByTagName('td').item(0).firstChild.nodeName.toLowerCase()=="br"){menuG[i].style.backgroundColor='transparent'}


}
}



}





function zoom0(t){//t.nextSibling.style.display="none";
}
function zoom1(t){//t.nextSibling.style.display="inline";
}






	
window.onload = initPage;	




