$(document).ready(function() {
	$(".slideshow-content").cycle({
		fx: 'fade',
		speed: 500,
		//next: 'a.slideshow-controls-next',
		//prev: 'a.slideshow-controls-prev',
		prevNextClick: slideshowBefore
	});		
	
	$(".slideshow-content").cycle('pause');
	
	// Link the pagination dots
	$("a.slideshow-controls-pag").click(function() {
		var slideno = parseInt($(this).attr('class').split('pag-').slice(-1));
		$('.slideshow-content').cycle(slideno);
		
		// Change the class of the dots once they are clicked on
		$("a.slideshow-controls-pag").removeClass('slideshow-controls-pag-selected');
		$(this).addClass('slideshow-controls-pag-selected');
		
		return false; 
	}); 
	
	// Change the class of the dots once the arrows are clicked
	function slideshowBefore(isNext, zeroBasedSlideIndex, slideElement){
		$("a.slideshow-controls-pag").removeClass('slideshow-controls-pag-selected');
		$("a.slideshow-controls-pag-"+zeroBasedSlideIndex).addClass('slideshow-controls-pag-selected');
	};
	
	// Link the large rollover arrows
	$("a.slideshow-prev").click(function() {
		$(".slideshow-content").cycle('prev');
		return false; 
	});
	$("a.slideshow-next").click(function() {
		$(".slideshow-content").cycle('next');
		return false; 
	}); 
			
});
