
$(function(){
	$('#pause').click(function(){
		var a = $(this);
		
		if (a.hasClass('active')) {
			$('.rotate ul').cycle('resume').cycle('next');
			
			a.removeClass('active');
		}
		else {
			$('.rotate ul').cycle('pause');
			a.addClass('active');
		}
		
		return false;
	});

	$('.rotate ul').cycle({
		pager: '#pager-holder',
		pagerAnchorBuilder: function(i, e){
			return "<a href='#' class='pager' id='pager"+i+"'></a>";
		},
		pagerClick: function() {
			if (!$('#pause').hasClass('active')) {
				$('#pause').click();
			}
		},
		prev: '#prev',
		next: '#next',
		prevNextClick: function() {
			if (!$('#pause').hasClass('active')) {
				$('#pause').click();
			}
		}
	});
	
	$('#headerRotate').cycle({
		fx: 'fade',
		speed:  1500,
		timeout:  8000
	});
	
	//This elements with the .blockClickable class clickable, based on an a tag within the parent.
	$('.blockClickable').click(function(){
		window.location=$(this).find("a").attr("href");return false; //boom.
	});
	
	//Any list that has an embedded list will have a slide effect. May need to add a unique identifier
	
	$("#mainMenu li:has(ul)").hover(function() {
			$(this).children("ul").css("display", "none");
			$(this).children("ul").show();
		},
		function() {
			$(this).children("ul").slideUp("fast");
		}
	);
});


