// CREDITS:
// Horizontal Slide Scroller.0
// By Urs Dudli and Peter Gehrig
// Copyright (c) 2002 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com
// info@24fun.com
// 8/6/2002

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// http://www.24fun.com on the webpage
// where this script will be featured

// CONFIGURATION:
// Go to http://www.24fun.com
// and create your own slideshow
// with our new Slideshow Factory.

// DEBUT DE CONFIGURATION
// Entrez le nom de vos image
// Si elles ne sont pas dans le même dossier que ce script utilisez une url relative EX : ../images/mon_image.jpg
// Vous pouvez ajouter autant d'images que vous le désirez dans la mesur ou chaque nom est entre deux guillemet et séparé par une virgule comme ci-dessous
var slideurl=new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg")

// Entrez le commentaire qui sera affiché sous chaque image
// Les commentaires doivent-être dans le même ordre que les images et il doit y en avoir autant
// Si vous ne désirez pas commenter une image laissez les guillemets vides
var slidecomment=new Array("Départ","CO","VTT","Canoë","Course","CO de jour","CO de nuit")

// Entrez les urls de chaque image
// Les urls doivent-être dans le même ordre que les images et il doit y en avoir autant
var slidelink=new Array("photo.htm","photo.htm","photo.htm","photo.htm","photo.htm","photo.htm","photo.htm")

// Entrez la frame de destination du lien
// Les frames de destination doivent-être dans le même ordre que les images et il doit y en avoir autant
// Vous pouvez utiliser _blank pour une nouvelle fenetre, _self pour remplacer la page ou frame actuelle, _top pour remplacer la fenêtre actuelle ou le nom de votre frame de destination dans le cadre d'un site en frames
var slidetarget=new Array("Destination1","Destination2","Destination3","Destination4","Destination5',"Destination6',"Destination7')

// Largeur de votre slideshow (en pixels) qui correspondra à la largeur max de vos images
var scrollerwidth=980

// Hauteur de votre slideshow (en pixels) qui correspondra à la hauteur max de vos images + 30 points qui serviront à afficher vos commentaires sous chaque image
var scrollerheight=150

// Fonte, couleur et taille de vos commentaires
var slidefont="Arial"
var slidefontcolor="#000000"
var slidefontsize="3"

// FIN DE CONFIGURATION

// NE RIEN EDITER CI-DESSOUS
var allpicturewidth
var distancepictopic=0
var scrollerleft=0
var scrollertop=0
var pause=5
var step=2
var newstep=step
var clipleft,clipright,cliptop,clipbottom
var i_picture=0
var timer
var picturecontent=""
var ns4=document.layers?1:0
var ns6=document.getElementById&&!document.all?1:0 
var ie=document.all?1:0

var preloadedimages=new Array()
for (i=0;i<slideurl.length;i++){
	preloadedimages[i]=new Image()
	preloadedimages[i].src=slideurl[i]
}

function init() {
    if (ie) {
		allpicturewidth=document.all.picturediv.offsetWidth
		document.all.picturediv.style.posTop=scrollertop
        document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		cliptop=0
		clipbottom=scrollerheight
		document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
		document.all.picturediv.style.visibility="visible"
		scrollpicture()
		
    }
	if (ns6) {
		allpicturewidth=document.getElementById('emptypicturediv').offsetWidth
		document.getElementById('picturediv').style.top=scrollertop
        document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		cliptop=0
		clipbottom=scrollerheight
		document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
		document.getElementById('picturediv').style.visibility="visible"
		scrollpicture()  
    }
	if (ns4) {
		allpicturewidth=document.roof.document.picturediv.document.width
		document.roof.document.picturediv.top=scrollertop
		document.roof.document.picturediv.left=scrollerleft+scrollerwidth
		document.roof.document.picturediv.clip.left=0
		document.roof.document.picturediv.clip.right=0
		document.roof.document.picturediv.clip.top=0
		document.roof.document.picturediv.clip.bottom=scrollerheight
		document.roof.document.picturediv.visibility="visible"
        scrollpicture()
    }
}

function scrollpicture() {
    if (ie) {
		if (document.all.picturediv.style.posLeft>=scrollerleft-allpicturewidth) {
			document.all.picturediv.style.posLeft-=step
			clipright+=step
			if (clipright>scrollerwidth) {
				clipleft+=step
			}
			document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"		
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
	if (ns6) {
		if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) {
	document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step
			clipright+=step
			if (clipright>scrollerwidth) {
				clipleft+=step
			}
			document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"		
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
   if (ns4) {
		if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) {
			document.roof.document.picturediv.left-=step
			document.roof.document.picturediv.clip.right+=step
			if (document.roof.document.picturediv.clip.right>scrollerwidth) {
				document.roof.document.picturediv.clip.left+=step
			}
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
}

function onmsover() {
	step=0
}
function onmsout() {
	step=newstep
}

function resetposition() {
	if (ie) {
        document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        scrollpicture()
	}
	if (ns6) {
		allpicturewidth=document.getElementById('emptypicturediv').offsetWidth
        document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        scrollpicture()
	}
	if (ns4) {
		document.roof.document.picturediv.left=scrollerleft+scrollerwidth
		document.roof.document.picturediv.clip.left=0
		document.roof.document.picturediv.clip.right=0
        scrollpicture()
	}
}

picturecontent=""
picturecontent+="<table cellpadding=2 cellspacing=0>"
picturecontent+="<tr>"
for (i=0;i<=slideurl.length-1;i++) {
	picturecontent+="<td>"
	picturecontent+="<a href=\""+slidelink[i]+"\" target=\""+slidetarget[i]+"\" onMouseOver=\"javascript:onmsover()\" onMouseOut=\"javascript:onmsout()\">"
	picturecontent+="<img src=\""+slideurl[i]+"\" border=0></a>"
	picturecontent+="</td>"
}
picturecontent+="</tr>"
picturecontent+="<tr>"
for (i=0;i<=slideurl.length-1;i++) {
	picturecontent+="<td>"
	picturecontent+="<font face=\""+slidefont+"\" color=\""+slidefontcolor+"\" size="+slidefontsize+">"
	picturecontent+=slidecomment[i]
	picturecontent+="</font>"
	picturecontent+="</td>"
}
picturecontent+="</tr>"
picturecontent+="</tr></table>"

if (ie || ns6) {
	document.write('<div style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;overflow:hidden">')
	document.write('<div id="picturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')
	document.write('</div>')
	document.write('<div id="emptypicturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')
	window.onload=init
}

if (ns4) {
	document.write('<ilayer name="roof" width='+scrollerwidth+' height='+scrollerheight+'>')
	document.write('<layer name="picturediv" width='+scrollerwidth+' height='+scrollerheight+' visibility=hide>'+picturecontent+'</layer>')
	document.write('</ilayer>')
	window.onload=init
}