//---------------------------------------------------------------------------------------
function MM_swapImgRestore() {
  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_preloadImages() {
  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 preloadimages() {
	imagesrc=new Array();for (i=0; i<preloadlist.length; i++){imagesrc[i]=new Image; imagesrc[i].src=preloadlist[i]}
}

function MM_findObj(n, d) {
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() {
  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];}
}
//---------------------------------------------------------------------------------------

if (loaded) { document.location.reload(); }

function checkBrowser() {
	this.name = navigator.appName.toLowerCase();
	this.ver=navigator.appVersion;
	this.uA = navigator.userAgent.toLowerCase();
	this.dom=document.getElementById?true:false;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?true:false;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?true:false;
	this.ie4=(document.all && !this.dom)?true:false;
	this.mac=this.uA.indexOf("mac")>-1?true:false;
	this.win=this.uA.indexOf("win")>-1?true:false;
	this.ie4mac=this.ie4 && this.mac;
	this.ie5mac=this.ie5 && this.mac;
	this.ns6=(this.uA.indexOf("netscape6")>0 || this.uA.indexOf("netscape/7")>0) ? true:false;
	this.moz = !this.ns6 && (this.uA.indexOf("mozilla/5")>-1) ? true:false;
	this.ns4=(this.name.indexOf("netscape")>-1 && !this.dom)?true:false;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) && !this.ie4mac;
	this.ie=(this.ie4 || this.ie5 || this.ns6 || this.moz || this.ie6);
	return this;
}

var is = new checkBrowser();

if (is.ns4) {
	doc="document"; sty=""; htm=".document"; Visible="show"; Hidden="hide"; xpos="e.pageX"; ypos="e.pageY";
	this.captureEvents(Event.RESIZE);
	this.onresize = reloadlapage;
}

if (is.ie) {
	doc="document.all"; sty=".style"; htm=""; Visible="visible"; Hidden="hidden"; xpos="event.x"; ypos="event.y"; 
	this.onresize = reloadlapage;
}

var loaded=true;

function reloadlapage() {
	document.location.reload(true);
}

function getTop(Layer) {
	if (is.ie) {return parseInt(Layer.style.top,10);}
	if (is.ns4)	{return parseInt(Layer.top,10);}
}

function getLeft(Layer) {
	if (is.ie) {return parseInt(Layer.style.left,10);}
	if (is.ns4) {return parseInt(Layer.left,10);}
}

function getHeight(layer) {
	if (is.ns4) {
		if (layer.document.height)
			return layer.document.height;
		else
			return layer.clip.bottom - layer.clip.top;
	}
	if (is.ie) {	
		if (layer.style.pixelHeight)	return layer.style.pixelHeight;
		if (layer.clientHeight)		  	return layer.clientHeight;
		if (layer.scrollHeight)			return layer.scrollHeight;
		if (layer.offsetHeight)      	return layer.offsetHeight;
		return 0;
	}
	return -1;
}

function getWidth(layer) {
	if (is.ns4) {
		if (layer.document.width)
			return layer.document.width;
		else
			return layer.clip.right - layer.clip.left;
	}
	if (is.ie) {
		if (layer.style.pixelWidth)
			return layer.style.pixelWidth;
		else
			return layer.clientWidth;
	}
	return -1;
}

function ReSize(Layer,w,h) {
	if (Layer)
	{
		if (is.ns4)	Layer.resizeTo(w,h);
		if (is.ie) {					
			Layer.style.pixelWidth?Layer.style.pixelWidth = w:Layer.style.width = w+"px";
			Layer.style.pixelHeight?Layer.style.pixelHeight = h:Layer.style.height = h+"px";
		}
	}
}

function affiche() {
	for (tr=0; tr<arguments.length; tr++) {
		calque_local=MM_findObj(arguments[tr], self.document);
		if (calque_local) {
			if (is.ie) calque_local.style.visibility="visible";
			if (is.ns4) calque_local.visibility="show";
		}
	}
}

function masque() {
	for (tr=0; tr<arguments.length; tr++) {
		calque_local=MM_findObj(arguments[tr], self.document);
		if (calque_local) {
			if (is.ie) calque_local.style.visibility="hidden";
			if (is.ns4) calque_local.visibility="hide";
		}
	}
}

function MoveTo(leLayer,x,y) {
	calque_local=MM_findObj(leLayer, document);
	if (calque_local) {
		if (is.ns4)	calque_local.moveTo(x, y);
		if (is.ie) {
			calque_local.style.pixelLeft?calque_local.style.pixelLeft=x:calque_local.style.left = x+"px";
			calque_local.style.pixelTop?calque_local.style.pixelTop=y:calque_local.style.top = y+"px";
			calque_local.style.visibility = "hidden";
			calque_local.style.visibility = "visible";
		}
	}
}

var animations=new Array()

function bougeDe(layerName,dx,dy,steps) {
	var cccalq;
	cccalq=MM_findObj("clq"+layerName, document) ;
	var noo=animations.length;
	animations[animations.length]=cccalq;
	if (is.ie) 		{cccalq.style.visibility="visible"; cccalq.absX=parseInt(cccalq.offsetLeft,10); cccalq.absY=parseInt(cccalq.offsetTop,10);}
	if (is.ns4) 	{cccalq.visibility="show"; cccalq.absX=parseInt(cccalq.left,10); cccalq.absY=parseInt(cccalq.top,10);}
	dx/=steps;
	dy/=steps;
	cccalq.dx=dx; cccalq.dy=dy; cccalq.step=steps;
	animLayers();
}

function bougeA(layerName,x,y,steps) {
	var cccalq;
	cccalq=MM_findObj("clq"+layerName, document);
	var noo=animations.length;
	animations[animations.length]=cccalq;
	if (is.ie) 		{cccalq.style.visibility="visible"; cccalq.absX=parseInt(cccalq.offsetLeft,10); cccalq.absY=parseInt(cccalq.offsetTop,10);}
	if (is.ns4) 	{cccalq.visibility="show"; cccalq.absX=parseInt(cccalq.left,10); cccalq.absY=parseInt(cccalq.top,10);}
	dx=(x-cccalq.absX)/steps;
	dy=(y-cccalq.absY)/steps;
	cccalq.dx=dx; cccalq.dy=dy; cccalq.step=steps;
	animLayers();
}

function animLayers() {
	var goon=false;
	for (var klm=0;klm<animations.length;klm++) {
		var oLayer=animations[klm];
		if (oLayer.step>0) {
			oLayer.absX+=oLayer.dx;
			oLayer.absY+=oLayer.dy;
			if (is.ie) {
				oLayer.style.left=Math.round(oLayer.absX);
				oLayer.style.top=Math.round(oLayer.absY);
			}
			if (is.ns4)	{
				oLayer.left=Math.round(oLayer.absX);
				oLayer.top=Math.round(oLayer.absY);
			}
			--oLayer.step; goon=true;
		}
	}
	if (goon) { setTimeout("animLayers()",20); }
}

function changeImage(layerName,imgName)	{
	var imga;
	imga=MM_findObj(layerName, document);
	imga.src=imgName;
}
	
var scrollLayers = new Array();
var currentScrollLayer=null;
	
function choppeScrollCalque(layerName) {
	var zeCalque;
	if (scrollLayers[layerName]) zeCalque = scrollLayers[layerName];
	else {
		zeCalque = MM_findObj(layerName);
		if (zeCalque) {
			zeCalque.scrollLayer = MM_findObj("sub"+layerName);
			zeCalque.scroll = false;
			zeCalque.scrollSpeed = 4;
			zeCalque.scrollSens = 0;
			zeCalque.scrollInterval = 3;		
			if (is.ie) {
				zeCalque.getH = function() {return getHeight ( zeCalque );};					
				zeCalque.getY = function() {return this.scrollLayer.style.pixelTop?this.scrollLayer.style.pixelTop:this.scrollLayer.offsetTop;};
				zeCalque.getX = function() {return this.scrollLayer.style.pixelLeft?this.scrollLayer.style.pixelLeft:this.scrollLayer.offsetLeft;};
				zeCalque.realHeight = (zeCalque.scrollLayer.scrollHeight && zeCalque.scrollLayer.scrollHeight>1)?zeCalque.scrollLayer.scrollHeight:getIEheight(zeCalque.scrollLayer);							
				zeCalque.scrollBy = function(dx,dy)	{
					this.scrollLayer.style.pixelLeft?this.scrollLayer.style.pixelLeft=(this.getX()+dx):this.scrollLayer.style.left=(this.getX()+dx)+"px";
					this.scrollLayer.style.pixelTop?this.scrollLayer.style.pixelTop=(this.getY()+dy):this.scrollLayer.style.top=(this.getY()+dy)+"px";
					this.scrollLayer.style.visibility = "hidden";
					this.scrollLayer.style.visibility = "inherit";
				}			
			}
			if (is.ns4) {				
				zeCalque.getY = function() { return parseInt ( this.scrollLayer.top,10 ); }
				zeCalque.realHeight = getHeight ( zeCalque.scrollLayer )	;		
				zeCalque.scrollBy = function(dx,dy) {	this.scrollLayer.moveBy(parseInt(dx,10),parseInt(dy,10)); }
				zeCalque.getH = function() { return parseInt ( getHeight ( this ),10 ); }
			}
		}
		scrollLayers[layerName] = zeCalque;
	}
	return zeCalque;
}
	
function scrollUp(layerName)
	{
	var zeCalque = choppeScrollCalque(layerName);
	if (zeCalque) {
		zeCalque.scroll = true;
		zeCalque.scrollSens = 1;
		currentScrollLayer = zeCalque;
		doZeScroll(currentScrollLayer);
	}
}
	
function scrollDown(layerName) {
	var zeCalque = choppeScrollCalque(layerName);
	if (zeCalque) {
		zeCalque.scroll = true;
		zeCalque.scrollSens = -1;
		currentScrollLayer = zeCalque;
		doZeScroll(zeCalque);
	}
}
	
function doZeScroll(zeCalque) {
	if (zeCalque.scroll && ( (zeCalque.scrollSens>0 && zeCalque.getY()<0 ) || ( zeCalque.scrollSens<0 && ( ( zeCalque.realHeight+zeCalque.getY() )>zeCalque.getH() ) ) ) ) {
		zeCalque.scrollBy(0,zeCalque.scrollSpeed*zeCalque.scrollSens);
		setTimeout("doZeScroll(currentScrollLayer)",zeCalque.scrollInterval);
	}
}
	
function scrollStop(layerName) {
	var zeCalque = choppeScrollCalque(layerName);
	if (zeCalque) {
		zeCalque.scroll = false;
	}
}

// -----------------  fonctions pour le deplacement du footer ------------------
  
var maxH=0;
  
function getPageHeight() {
	if (is.ie) {
		var divs = document.all?document.all.tags("DIV"):document.getElementsByTagName("DIV");
		for (var i=0; i<divs.length ; i++) {
			var localTop = divs[i].id.indexOf("footer")<0?getIEtop(divs[i]):0;
			var localHeight = divs[i].id.indexOf("footer")<0?getIEheight(divs[i]):0;
			if (localTop+localHeight>maxH) maxH = localTop+localHeight;
		}	
	}
	if (is.ns4) {
		getNScontentHeight(document)
	}
}
  
function getIEtop(calque) {
	y = 0;
	obj = calque;
	while (obj.offsetParent != null && obj.offsetParent !=document.body) {
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	y += obj.offsetTop;
	return y;
}
  
function getIEheight(calque) {
	var zeHeight = 0;
	var rS = "";
	if (parseInt( calque.scrollHeight,10 )>zeHeight ) zeHeight = parseInt( calque.scrollHeight,10 );
	if (parseInt( calque.clientHeight,10 )>zeHeight ) zeHeight = parseInt( calque.clientHeight,10 );
	if (parseInt( calque.offsetHeight,10 )>zeHeight ) zeHeight = parseInt( calque.offsetHeight,10 );
	lH = dom2getLayerHeight(calque); if (lH>zeHeight) zeHeight = lH;
	return zeHeight;
}
	
function dom2findDivAncestor(calque) {
	if (calque.parentNode) {
		if (calque.parentNode.nodeName.toLowerCase()=="div") return calque.parentNode;
		else return dom2findDivAncestor(calque.parentNode);
	}
	return calque;
}

function dom2getLayerHeight(calque) {
	var dom2lH=0;
	if (calque.childNodes) {
		if (false) {
			var lImg = calque.firstChild;
			lImg.par = calque;
			lImg.onload  = imgLoaded;
		}
		else {
			for (var i=0; i<calque.childNodes.length; i++) {
				if (calque.childNodes[i].nodeName.toLowerCase()=="img" && !calque.childNodes[i].complete) {
					var lImg = calque.childNodes[i];
					lImg.par = dom2findDivAncestor(calque);
					lImg.onload  = imgLoaded;
				}
				if (calque.childNodes[i].offsetHeight) {
					var llH=0;
					if (calque.childNodes[i].offsetTop) llH += calque.childNodes[i].offsetTop;
					else if (calque.childNodes[i].style.pixelTop) llH += calque.childNodes[i].style.pixelTop;
					llH += calque.childNodes[i].offsetHeight;	
					if (llH>dom2lH) dom2lH=llH;
				}
				var dllH = dom2getLayerHeight(calque.childNodes[i]);
				if (dllH>dom2lH) dom2lH=dllH;
			}
		}
	}
	else if(calque.all) {
		for (var i=0;i<calque.all.tags("IMG").length;i++) {
			var lImg = calque.all.tags("IMG")[0];
			lImg.par = calque;
			lImg.onload  = imgLoaded;
		}
	}
	return dom2lH;
}
	
function imgLoaded() {
	var lH=0;
	if (this.offsetTop) lH=this.offsetHeight+this.offsetTop;
	else if (this.par.offsetTop) lH=this.offsetHeight+this.par.offsetTop;
	else if (this.par.style && this.par.style.pixelTop)  lH=this.offsetHeight+this.par.style.pixelTop;
	else lH=this.offsetHeight;
	if (lH>maxH) { maxH=lH; if (placeFooter) placeFooter();}
}
	
function getNStop(calque) {
	y = 0;
	return calque.top;
}
	
function getNScontentHeight(calque,previousTop) {
	if (!previousTop) previousTop = 0;
	for (var i=0;i<calque.layers.length;i++) {
		localTop = previousTop + calque.layers[i].top;
		var zeHeight = getHeight(calque.layers[i]);
		if (zeHeight+localTop>maxH) maxH = zeHeight+localTop;
		getNScontentHeight(calque.layers[i].document , localTop);
	}
}

function placeFooter() {
	if(maxH==0) getPageHeight();
	MoveTo("footer",0,maxH);
	affiche("footer");
}