$(function()
{
	$('#rotationSlideshow').cycle({
	  fx				: 'scrollHorz'
	, delay				: 2000
	, speed				: 500
	, timeout			: 10000
	, prev				: '#prevRotation'
	, next				: '#nextRotation'
	, pager				: '#rotation-navigation-numbers'
	, pagerAnchorBuilder: function(idx, slide)
		{
		return '#rotation-navigation-numbers span:nth-child('+(idx+1)+')';
		}
	, after				: fixPager
	});
});

function fixPager(arColors)
{
$('#rotation-navigation-numbers span').addClass('noRotationBg');

	$('#rotationSlideshow > div').each(function(i)
	{
		if ($(this).is(':visible'))
		{
		var currRotationItem = $('#rotation-navigation-numbers').find('span:eq('+(i+1)+')');
			
			if ($(this).next().length == 0)
			{
			$('#rotation-navigation-numbers span:last-child').removeClass('noRotationBg');
			}
			else
			{
			currRotationItem.prev().removeClass('noRotationBg');
			}
		}
	});
}

window.onload = function()
{
	$('#rotationTeaserContainer').mouseenter(function()
	{
	$('#rotationSlideshow').cycle('pause');
	});
	
	$('#rotationTeaserContainer').mouseleave(function()
	{
	$('#rotationSlideshow').cycle('resume');
	});
}
