//current slide index counter
function onBefore(curr, next, opts) {
    var index = $(this).parent().children().index(this);
	$('span.current_num').text(index + 1);
}

//equal heights function - matches heights of a group of elements to the largest 
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() { 

	/****************************************
		sidenav content rotater
	****************************************/	
	$('#content-rotator-inner').cycle({ 
	    fx: 'scrollHorz', 
	    speed: 1500,
		easing: 'easeOutQuad',
	    timeout: 7000,
		delay: -2000, 
	    next: '#next-slide', 
	    prev: '#prev-slide',
		pause: 1,
		before: onBefore
	});
	
	/************************************************
		set equalHeights on content rotater, and it children
	*************************************************/	
	equalHeight($('#content-rotator-inner, #content-rotator-inner .rotator_item'));
	
});
