
var slideshow = {
	current : 0,
	max : 0,
	el : {},
	slides : [],
	container : new Image(),
	init : function(el_id, slides) {
		if(document.getElementById){
			this.el = document.getElementById(el_id);
			this.el.alt = '';
			this.slides = slides;
			this.slides.unshift(this.el.src);
			this.current++;
			this.max = this.slides.length;
			this.int_id = setInterval('slideshow.next()', 3000);
		}
	},
	next : function() {
		if(this.current==0){
			this.el.src= this.slides[this.current];
			this.current++;
		} else if(this.current<this.max){
			this.el.src= '/accueil/image/'+this.slides[this.current];
			this.current++;
		} else {
			this.current = 0;
			this.next();
		}
		this.preloadNext();
	},
	preloadNext : function() {
		var src;
		if(this.current==0){
			src= this.slides[this.current];
		} else 	if(this.current<this.max){
			src= '/accueil/image/'+this.slides[this.current];
		}
		this.container.src = src;
	}
}	
window.onload = function() { slideshow.init('slide',slides); }
