var navSlideShow;
document.addEvent('domready', function(){

	// cache the navigation elements
	var navs = $('slideshow').getElements('a');

	// create a basic slideshow
	navSlideShow = new SlideShow('slideshow', {
		selector: 'img', // only create slides out of the images
		autoplay: true,
		delay: 5000,
		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();
			// pushLeft or pushRight, depending upon where
			// the slideshow already is, and where it's going
			var transition = (navSlideShow.index < index) ? 'pushLeft' : 'pushRight';
			// call show method, index of the navigation element matches the slide index
			// on-the-fly transition option
			navSlideShow.show(index, {transition: transition});
		});
	});

	marketingSlideShow = new SlideShow('marketing_slides', {
		selector: 'a', // only create slides out of the anchors
		autoplay: true,
		delay: 5000,
		transition: 'fade',
	});
});
