$(document).ready(function(){
	$('#book-now iframe').hide();
	$('a.book-now').toggle(function(){
		$('#book-now iframe').slideDown();
	},function(){
		$('#book-now iframe').slideUp();
	});
	
	if($('#stuff-happens').size() == 1) {
		$('#stuff-happens li:not(":first") ul').hide()
		
		$('#stuff-happens-buttons a').click(function() {
			$($(this).attr('href') +' ul').slideDown();
			$('#stuff-happens li:not("'+$(this).attr('href')+'") ul').slideUp();
			return false;
		})

		$('#stuff-happens h3').click(function() {
			$(this).parent().children('ul').slideDown();
			$('#stuff-happens li:not("#'+$(this).parent().attr('id')+'") ul').slideUp();
			return false;
		})
		
	}

	if($('#image-rotation img').size()>1) {
		$('#image-rotation img:not(":first")').hide();
		var count=0;
		var countImages = $('#image-rotation img').size();
	
		function nextImage() {
			$('#image-rotation img:eq('+count+')').fadeOut(1500); //Length of FadeOut transition
			if(count<countImages-1){
				count++;
			} else {
				count=0;
			}
		   $('#image-rotation img:eq('+count+')').fadeIn(1500); //Length of FadeIn transition
		}	
	
		if(countImages>1){
			setInterval(nextImage,4000); //The number here dictates the length of time between the animation
		}
	}
});
