var slidePause = 3500;
var currentSlideIndex = -1;
var numSlides = 0;
var markerPositions = [87, 87, 205, 323, 438];
var slideRunner;

jQuery(document).ready(function () {
	//Count the number of slides
	numSlides = $('.slide').length;

	//Initially hide the step marker since it won't be shown for the first slide
	$('#stepMarker').hide();

	$('#steps a').each(function () {
		$(this).css('cursor', 'default');
	});


});

function adscroller(newSlideIndex, slideSpeed) {
	if (newSlideIndex != null)
		currentSlideIndex = newSlideIndex - 1;

	else if (currentSlideIndex + 1 < numSlides)
		currentSlideIndex++;
	else
		currentSlideIndex = 0;

	//Scroll to the new slide
	$('#adMask').scrollTo($(".slide:eq(" + currentSlideIndex + ")"), slideSpeed);

	//Slide the step marker
	//If we're moving to the first slide we need to hide the marker and move it back to the start.
	if (currentSlideIndex == 0) {
		$('#stepMarker').fadeOut('fast', function () { $('#stepMarker').css('left', markerPositions[0]); });
	}
	else {
		$('#stepMarker').css('left', (markerPositions[currentSlideIndex]) + "px");
		$('#stepMarker').show();
	}
}

