// photo rotator
$(function(){
	
	/* cycle photos with 5 second delay and 1 sec transition; previous/next links */
	$("#rotator").cycle({
		timeout: 4000,
		speed: 1000,
		prev: '#cycle-prev',
		next: '#cycle-next'
	});
	
	/* highlight play button by default */
	$('#cycle-play').addClass('active');

	/* activate pause button, un-highlight other buttons */
	$('#cycle-pause').click(function() {
		$('#rotator').cycle('pause');
		$(this).addClass('active');
		$('#cycle-play').removeClass('active');
		$('#cycle-prev').removeClass('active');
		$('#cycle-next').removeClass('active');
	});

	/* activate play button, un-highlight other buttons */
	$('#cycle-play').click(function() {
		$('#rotator').cycle('resume');
		$(this).addClass('active');
		$('#cycle-pause').removeClass('active');
		$('#cycle-prev').removeClass('active');
		$('#cycle-next').removeClass('active');
	});
	
	/* activate previous button, un-highlight other buttons */
	$('#cycle-prev').click(function() {
		$('#cycle-pause').addClass('active');
		$('#cycle-play').removeClass('active');
	});
	
	/* activate next button, un-highlight other buttons */
	$('#cycle-next').click(function() {
		$('#cycle-pause').addClass('active');
		$('#cycle-play').removeClass('active');
	});

});
