document.addEvent('domready', function(){
	
	// cache the navigation elements
	var navs = $('slideshow').getElements('a');
	
	// create a basic slideshow
	var slideShow = new SlideShow('slideshow', {
		selector: 'img', // only create slides out of the images
		autoplay: true,
		delay: 6500,
		duration: 1500,
		transition: 'fade',
		onShow: function(data){
			// update navigation elements' class depending upon the current slide
			navs[data.previous.index].removeClass('current');
			navs[data.next.index].addClass('current');
		}
	});

	navs.each(function(item, index){
		// click a nav item ...
		item.addEvent('click', function(event){
			event.stop();
			var timer;
			clearTimeout(timer);
			var transition = (slideShow.index < index) ? 'fade' : 'fade';
			slideShow.show(index, {transition: transition});
		});
	});

});
