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_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_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];}
}

function VersionNavigateur(Netscape, Explorer)
{
  if ((navigator.appVersion.substring(0,3) >= Netscape && navigator.appName == 'Netscape') ||      
      (navigator.appVersion.substring(0,3) >= Explorer && navigator.appName.substring(0,9) == 'Microsoft'))
    return true;
else return false;
}

function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function change(qui)
{

	limage= new String(document.images[qui].src);

	if((limage.lastIndexOf("_off.") != -1)&&(limage.lastIndexOf("_on.") == -1))
	{
		document.images[qui].src = "imgs/"+qui+"_over.jpg";
	}
	else if (limage.lastIndexOf("_on.") == -1)
	{
		document.images[qui].src = "imgs/"+qui+"_off.jpg";
	}

}

function change2(qui)
{

	limage= new String(document.images[qui].src);

	if((limage.lastIndexOf("_off.") != -1)&&(limage.lastIndexOf("_on.") == -1))
	{
		document.images[qui].src = "imgs/"+qui+"_over.gif";
	}
	else if (limage.lastIndexOf("_on.") == -1)
	{
		document.images[qui].src = "imgs/"+qui+"_off.gif";
	}

}

var Indice = "";

function CarreOver(NameOver,NumOver) 
{
	if (NameOver != Indice) document.images[NameOver].src='imgs/' + NumOver + '_off.gif'
}

function CarreOut(NameOut,NumOut) 
{
	if (NameOut != Indice)	document.images[NameOut].src='imgs/' + NumOut + '_on.gif'
}




function CarreClick(NameClick) 
{
	Indice = NameClick;
	
	document.images["img1"].src= (Indice == "img1") ? "imgs/rub1_1_on.gif": "imgs/rub1_1_off.gif";
	document.images["img2"].src= (Indice == "img2") ? "imgs/rub1_2_on.gif": "imgs/rub1_2_off.gif";
	document.images["img3"].src= (Indice == "img3") ? "imgs/rub1_3_on.gif": "imgs/rub1_3_off.gif";
	
	document.images["img4"].src= (Indice == "img4") ? "imgs/rub2_1_on.gif": "imgs/rub2_1_off.gif";
	document.images["img5"].src= (Indice == "img5") ? "imgs/rub2_2_on.gif": "imgs/rub2_2_off.gif";
	document.images["img6"].src= (Indice == "img6") ? "imgs/rub2_3_on.gif": "imgs/rub2_3_off.gif";
	
	document.images["img7"].src= (Indice == "img7") ? "imgs/rub3_1_on.gif": "imgs/rub3_1_off.gif";
	document.images["img8"].src= (Indice == "img8") ? "imgs/rub3_2_on.gif": "imgs/rub3_2_off.gif";

}


function CarreClick2(NameClick) 
{
	Indice = NameClick;
	
	document.images["img1"].src= (Indice == "img1") ? "imgs/date1_on.gif": "imgs/date1_off.gif";
	document.images["img2"].src= (Indice == "img2") ? "imgs/date2_on.gif": "imgs/date2_off.gif";
	document.images["img3"].src= (Indice == "img3") ? "imgs/date3_on.gif": "imgs/date3_off.gif";
	
	document.images["img4"].src= (Indice == "img4") ? "imgs/date4_on.gif": "imgs/date4_off.gif";
	document.images["img5"].src= (Indice == "img5") ? "imgs/date5_on.gif": "imgs/date5_off.gif";
	document.images["img6"].src= (Indice == "img6") ? "imgs/date6_on.gif": "imgs/date6_off.gif";
	
	document.images["img7"].src= (Indice == "img7") ? "imgs/date7_on.gif": "imgs/date7_off.gif";
	document.images["img8"].src= (Indice == "img8") ? "imgs/date8_on.gif": "imgs/date8_off.gif";

}
ns4 = (document.layers) ? true:false 
ie4 = (document.all) ? true:false 
ng5 = (document.getElementById) ? true:false 

function hideSec() { 
if (ng5) document.getElementById('sec1').style.visibility = "hidden" 
else if (ns4) document.sec1.visibility = "hide" 
else if (ie4) sec1.style.visibility ="hidden" 

if (ng5) document.getElementById('sec2').style.visibility = "hidden" 
else if (ns4) document.sec2.visibility = "hide" 
else if (ie4) sec2.style.visibility ="hidden" 

if (ng5) document.getElementById('sec3').style.visibility = "hidden" 
else if (ns4) document.sec3.visibility = "hide" 
else if (ie4) sec3.style.visibility ="hidden" 
}

function showSec(n) { 
hideSec(); 
if (ng5) document.getElementById('sec' + n).style.visibility = "visible"; 
else if (ns4) document.layers["sec" + n].visibility = "show"; 
else if (ie4) document.all["sec" + n].style.visibility = "visible"; 
}

var clipTop = 0;
var clipWidth = 255;
var clipBottom = 350;
var topper = 60;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function prepLyr()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('calque1');
	var y = new getObj('calque2');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
		
		lyrheight = y.style.clip.bottom;
		lyrheight += 20;
		y.style.clip.top = clipTop;
		y.style.clip.left = 0;
		y.style.clip.right = clipWidth;
		y.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
		
		lyrheight = y.obj.offsetHeight;
		y.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper;
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('calque1');
	f.style.visibility = val;
	var g = new getObj('calque2');
	g.style.visibility = val;
}

function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
    this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}





function calque(popupName){
	this.loop=false;
	this.nom = popupName;
	this.setText = setText;	
	this.setGauche = setGauche;	
	this.setHaut = setHaut;	
	this.moveVertical = moveVertical;

	if (document.layers)
		{
		this.style = 
		this.visibility = document.layers["divCont"].document.layers[popupName].visibility;
		this.largeur = document.layers["divCont"].document.layers[popupName].clip.width;
		this.hauteur = document.layers["divCont"].document.layers[popupName].clip.height;
		this.gauche = document.layers["divCont"].document.layers[popupName].left;
		this.haut = document.layers["divCont"].document.layers[popupName].top;
		}
	else
		{
		this.style = document.all[popupName].style;
		this.visibility = document.all[popupName].style.visibility;
		this.largeur = document.all[popupName].clientWidth;
		this.hauteur = document.all[popupName].clientHeight;
		this.gauche = document.all[popupName].style.pixelLeft;
		this.haut = document.all[popupName].style.pixelTop;
		}
}
var moncalque;


function setGauche(G){
	if (document.layers) {document.layers["divCont"].document.layers[this.nom].left = G;} 
	else {document.all[this.nom].style.pixelLeft = G;}
	this.gauche = G;
}

function setHaut(H){
	if (document.layers){document.layers["divCont"].document.layers[this.nom].top = parseInt(H);} 
	else {document.all[this.nom].style.pixelTop = parseInt(H);}
	this.haut = parseInt(H);
}

function setText(text) {
	if (document.layers)
		{
		document.layers["divCont"].document.layers['divText'].document.open();
		document.layers["divCont"].document.layers['divText'].document.write(text);
		document.layers["divCont"].document.layers['divText'].document.close();
		} 
	else {document.all[this.nom].innerHTML = text;}
}

function moveVertical(step){
	if(this.loop)
		{
		this.setHaut((this.haut)+parseInt(step));
		if (this.haut >= 1) {this.haut=0}
		if (this.hauteur <= 200) {this.haut = 0}
		if (this.haut <= -(this.hauteur-200)) {this.haut=-(this.hauteur-200)}
		scroll(step);
		}
}


function slide(step){
	moncalque.loop=true;
	setTimeout("moncalque.moveHorizontal("+step+")",0);
}
function noSlide(){
	moncalque.loop=false;
}
function scroll(step){
	moncalque.loop=true;
	if (moncalque.hauteur <= 200) {noScroll()}
	else {setTimeout("moncalque.moveVertical("+step+")",0)}
}
function noScroll(){
	moncalque.loop=false;
}
function init(nomLayer){
	moncalque = new calque(nomLayer);
}

// Javascript permettant de gérer l'affichage des calques
//Script optimisé pour IE (document.all) et Netscape (document.layers)

function changeCalques()
{
var option=window.document.boite.choix.selectedIndex;

	
	if ((option==0) && (document.all)) 	
	{
	document.all['button'].style.visibility = "visible";
	document.all['button2'].style.visibility = "hidden";
	document.all['calque1'].style.visibility = "visible";
	document.all['calque2'].style.visibility = "hidden";
	document.all['calque3'].style.visibility = "hidden";
	}
	
	else if ((option==1) && (document.all)) 	
	{
	document.all['button'].style.visibility = "hidden";
	document.all['button2'].style.visibility = "visible";
	document.all['calque1'].style.visibility = "hidden";
	document.all['calque2'].style.visibility = "visible";
	document.all['calque3'].style.visibility = "hidden";
	}

	else if ((option==2) && (document.all))
	{
	document.all['button'].style.visibility = "hidden";
	document.all['button2'].style.visibility = "hidden";
	document.all['calque1'].style.visibility = "hidden";
	document.all['calque2'].style.visibility = "hidden";
	document.all['calque3'].style.visibility = "visible";
	}
	

	if ((option==0) && (document.layers))
	{
	document.layers['calque1'].visibility = "show";
	document.layers['button'].visibility = "show";
	document.layers['button2'].visibility = "hide";
	document.layers['calque2'].visibility = "hide";
	document.layers['calque3'].visibility = "hide";
	}
	

	else if ((option==1) && (document.layers))
	{
	document.layers['calque1'].visibility = "hide";
	document.layers['button'].visibility = "hide";
	document.layers['button2'].visibility = "show";
	document.layers['calque2'].visibility = "show";
	document.layers['calque3'].visibility = "hide";
	}

	else if ((option==2) && (document.layers))
	{
	document.layers['calque1'].visibility = "hide";
	document.layers['button'].visibility = "hide";
	document.layers['button2'].visibility = "hide";
	document.layers['calque2'].visibility = "hide";
	document.layers['calque3'].visibility = "show";
	}
}
    