eyecatcherSlideshowCaller = function() {
	//call the actual slideshow with a random interval between 0 and 1 second
	eyecatcherSlideshow.delay(Math.floor(Math.random() * 1000));
}

eyecatcherSlideshow = function(){
	//decide wich random image to use
	if (typeof(randomImage) !== 'undefined') {
		randomImage = randomImage + 1;
		if(randomImage > 15) {
			randomImage = 1;
		}
	} else {
		randomImage = 1;
	}

	//hide the other image and remove the class
	$$(".slideshow_active").removeClass('slideshow_active').fade('hide');
	
	//fade in the new image and add the class
	$$(".slideshow_image_" + randomImage).fade('in');
	$$(".slideshow_image_" + randomImage).addClass('slideshow_active');
}

initSlideShow = function() {
	//loop through all the images and hide them
	$$('.slideshow span').each(function(el) {
		el.fade('hide');
	});
	eyecatcherSlideshow();
}

window.addEvent('domready', function(){
	//initialize the images
	initSlideShow();
	
	//start the slideshow with a 3.5 second interval
	var slideShow = eyecatcherSlideshow.periodical(3500);
});
