function gapizoom(url, width, height) {
    var options = "toolbar=no,location=no,directories=no,status=no"
                +"menubar=no,scrollbars=auto,resizable=yes,copyhistory=yes,"
		+"width="+width+",height="+height;
    maFenetre=window.open("","",options);
    maFenetre.document.open();
    corps = "<head>"
           +"<title>Le zoom sur votre choix !</title><META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
           +"</head>"
	   +"<body text=\"#000000\" bgcolor=\"#ffffff\" link=\"#000000\" vlink=\"#000000\" alink=\"#ff0000\">"
           +"<center>"
           +"<table border=0 cellpadding=0 cellspacing=0>"
           +"<tr><td align=center><img src=\""
	   +url
	   +"\" alt=\"\" border=0 hspace=0 vspace=0></td></tr>"
           +"<tr><td>&nbsp;</td></tr>"
           +"<tr align=center><td><a href='#' onClick='Javascript:window.close()'><font face=arial size=-2>Fermer la fenêtre</font></a></td></tr>"
           +"</table>"
           +"</td></tr></table>"
           +"</center>"
           +"</body>";
    maFenetre.document.write(corps);
    maFenetre.document.close();
  }


function MM_findObj(n, d) { //v3.0
  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&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 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 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_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; ia.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/* Détection du navigateur */
function detectIE()
{
		if ((navigator.appName=="Microsoft Internet Explorer"))
		{
				return(true);
		}
}

/* Repositionner les calques (menu horizontal)*/
function Position() {
		var i;
		var j;
		var spacing=parseInt(document.getElementById('gapitableau').cellSpacing);
		var largeur=parseInt(document.getElementById('gapitableau').offsetWidth);
		var hauteur=parseInt(document.getElementById('gapitableau').offsetHeight);
		
		var posX=parseInt(document.getElementById('gapitableaudiv').offsetLeft);
		var posY=parseInt(document.getElementById('gapitableaudiv').offsetTop+spacing);
		var largeurtd=parseInt(document.getElementById('gapimenutd1').offsetWidth);
		var colones=parseInt(largeur/largeurtd);
		
		if (detectIE())
		{
						for (i=posX+spacing ,j=1; i=largeur ,document.getElementById('gapimenu'+j) != null; i+=largeurtd+spacing ,j++)						{								document.getElementById('gapimenu'+j).style.posTop=posY;		
								document.getElementById('gapimenu'+j).style.posLeft=i;
								document.getElementById('gapimenu'+j).style.posWidth=largeurtd;
								document.getElementById('gapimenumarge'+j).style.posHeight=hauteur-spacing*2;
						}
		}
		else
		{
						for (i=posX+spacing ,j=1; i<largeur ,document.getElementById('gapimenu'+j) != null; i+=largeurtd+spacing ,j++)						{								document.getElementById('gapimenu'+j).style.top=posY;		
								document.getElementById('gapimenu'+j).style.left=i;
								document.getElementById('gapimenu'+j).style.width=largeurtd;
								document.getElementById('gapimenumarge'+j).style.height=hauteur-spacing*2;
						}
		}
}

/* Afficher un calque */
function ssmenuon(calque)
{
if (detectIE())
	{
	eval("document.all."+calque+".style.visibility = 'visible';");
	}
else
	{
	var menu = document.getElementById(calque);
	menu.style.visibility="visible";
	}

}

/* Masquer un calque */
function ssmenuoff(calque)
{
if (detectIE())
	{
	eval("document.all."+calque+".style.visibility = 'hidden';");
	}
else
	{
	var menu = document.getElementById(calque);
	menu.style.visibility="hidden";
	}
}

/* Recharger la page sous safari */
var hauteurold;
var hauteurnew;
var largeurold;
var largeurnew;

function init()
{
		if (detectIE()==null)
		{
				largeurold=parseInt(document.body.offsetWidth);
				hauteurold=parseInt(window.innerHeight);
		}
}


function recharge()
{
		if (detectIE()==null)
		{
				largeurnew=parseInt(document.body.offsetWidth);
				hauteurnew=parseInt(window.innerHeight);
				if(hauteurold != hauteurnew || largeurold != largeurnew)
				{		
						location.reload();
				}
		}
}

function format(valeur,decimal,separateur) {
// formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
 var deci=Math.round( Math.pow(10,decimal)*(valeur-Math.floor(valeur)) );
 var val=Math.abs(Math.floor(valeur));
 if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.abs(Math.round(valeur)); deci=0;}
 var val_format=val+"";
 var nb=val_format.length;
 for (var i=1;i<4;i++) {
  if (val>=Math.pow(10,(3*i))) {
   val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
  }
 }
 if (decimal>0) {
  if (deci>0) {
   deci=deci.toString();
  } else {
   deci="";
   for (var j=0;j<decimal;j++) deci+="0";
  }
  val_format=val_format+"."+deci.substring(0);  
 }
 if (parseFloat(valeur)<0) {val_format="-"+val_format;}
 return val_format;
}
 
function afficher() {
 var val=document.forms[0].elements["chiffre"].value;
 var deci=document.forms[0].elements["decimal"].value;
 document.forms[0].elements["resultat"].value=format(val,deci,document.forms[0].elements["liste"].options[document.forms[0].elements["liste"].selectedIndex].value);
}


/* --- diaporama --- */
var nombredimage=9;
var opaa=0;
var opab=100;
compteur=1
function defilmage(reg){
	if(compteur==nombredimage){
	compteur=0
	}
	if(reg==1){
	compteur++
	opaa=30;
	document.getElementById('divimageb').src="../images/navette-"+compteur+".jpg";
	reg=0;
	}
	imacibleb=document.getElementById('divimagea');
	imaciblea=document.getElementById('divimageb');
	if(imacibleb.src==imaciblea.src){
		return false;
	}
	opaa+=5;
	opab-=10;
	if(document.all && !window.opera){ 
		imaciblea.style.filter = 'alpha(opacity=' + opaa + ');' ;
		imacibleb.style.filter = 'alpha(opacity=' + opab + ');';
	}else{ 
		imaciblea.style.opacity = opaa/100;
		imacibleb.style.opacity = opab/100;
	}
	if(opaa>=100){
		opaa=30;
		opab=100;
		imacibleb.src=imaciblea.src
		marche=setTimeout("defilmage(1)",2000);
		return false;
	}
	marche=setTimeout("defilmage()",25);
}

/* --- bandeau pub droite --- */
function clip() {
	// width of the banner container
	var contWidth = 200;
	// height of the banner container
	var contHeight = 200;
	
	var id1 = document.getElementById('slideA');
	var id2 = document.getElementById('slideB');
	var height = id1.offsetHeight;
	
	id1.style.top = parseInt(id1.style.top)-1 + 'px';
	
	document.getElementById('slideCont').style.height = contHeight + "px";
	document.getElementById('slideCont').style.clip = 'rect(auto,'+ contWidth +'px,' + contHeight +'px,auto)';
	id2.style.display = '';
	if(parseFloat(id1.style.top) == -(height/2)) {
		id1.style.top = '0px';
	}
	setTimeout(clip,50)
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
			window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(function() {
	clip();
	setTimeout("defilmage(2)",2000); /* pour avoir le clignotement de carte perstige et le beandeau de droite */
});
