//Fade-in image slideshow
//var slideshow_width='320px' //IMAGE WIDTH
//var slideshow_height='200px'
var slshow_border=10
//if (no_border) slshow_border=0 pour utiliser cette ligne il faudrait déclarer no_border partout ...
var slideshow_height2=slideshow_height+2*slshow_border
var slideshow_pause=3000 //PAUSE BETWEEN SLIDE (msec)
var slideshow_fadeduration=50
var slideshow_fadestep=5 // 1<x<100

//var fadeimages=new Array()
//fadeimages[0]="img/0027.jpg"
//fadeimages[1]="img/0029.jpg"

var preloadedimages=new Array()
for (slsh_nb=0;slsh_nb<fadeimages.length;slsh_nb++){
preloadedimages[slsh_nb]=new Image()
preloadedimages[slsh_nb].src=fadeimages[slsh_nb]
}

var slshie4=document.all
var slshdom=document.getElementById
document.write('<table cellSpacing=0 cellPadding=0><tr><td align="right"><div style="display: block;width:'+slshow_border+';height:'+slideshow_height2+';margin: 0 auto;')
if (slshow_border>0) document.write('background-image:url(common/cadre_image_gauche.gif);')
document.write('"></div></td><td width="240" align="center">')
document.write('<div style="FONT-SIZE: 5%;display: block;width:'+slideshow_width+';height: '+slshow_border+';margin: 0 auto;')
if (slshow_border>0) document.write('background-image:url(common/cadre_image_haut.gif);')
document.write('"></div>')

if (slshie4||slshdom)
document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')

document.write('<div style="FONT-SIZE: 5%;display: block;width:'+slideshow_width+';height: '+slshow_border+';margin: 0 auto;')
if (slshow_border>0) document.write('background-image:url(common/cadre_image_haut.gif);')
document.write('"></div>')
document.write('</td><td align="left"><div style="display: block;width:'+slshow_border+';height:'+slideshow_height2+';margin: 0 auto;')
if (slshow_border>0) document.write('background-image:url(common/cadre_image_gauche.gif);')
document.write('"></div></td></tr></table>')

var curpos=slideshow_fadestep
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1

function fadepic(){
if (curpos<100){
 curpos+=slideshow_fadestep
 if (tempobj.filters)
  tempobj.filters.alpha.opacity=curpos
 else if (tempobj.style.MozOpacity)
  tempobj.style.MozOpacity=curpos/100
 }
else{
 clearInterval(dropslide)
 nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
 tempobj=slshie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
 tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
 nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
 setTimeout("rotateimage()",slideshow_pause)
 }
}

function rotateimage(){
if (slshie4||slshdom){
resetit(curcanvas)
var crossobj=tempobj=slshie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",slideshow_fadeduration)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=slideshow_fadestep
var crossobj=slshie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}

function startit(){
var crossobj=slshie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
/*crossobj.innerHTML='<a href=evenement.jsp><img src="'+fadeimages[curimageindex]+'"></a>'*/
rotateimage()
}

if (slshie4||slshdom)
startit()
else
setInterval("rotateimage()",slideshow_pause)

