gpLL = {
	prevSpotlight: 'Last Spotlight',
	nextSpotlight: 'Next Spotlight',
	prevSpotlightTeaser: 'Last Spotlight:',
	nextSpotlightTeaser: 'Next Spotlight:'
}

if (gpSysLanguageUid == 1) {
	gpLL = {
		prevSpotlight: 'Vorheriges Spotlight',
		nextSpotlight: 'Nächstes Spotlight',
		prevSpotlightTeaser: 'Vorheriges Spotlight:',
		nextSpotlightTeaser: 'Nächstes Spotlight:'
	}
}

$(document).ready(function(){

	showSpotlight('.spotlights-latest-item:first');

});

function showSpotlight(selector) {

	var activeSpotlight = $(selector);	
	var prevSpotlight = activeSpotlight.prev('.spotlights-latest-item');
	var nextSpotlight = activeSpotlight.next('.spotlights-latest-item');
	var prevTitle = activeSpotlight.prev().find(':header').text();
	var nextTitle = activeSpotlight.next().find(':header').text();
	
	var prevButton = '';
	var nextButton = '';
	var buttonSeperator = '';
	var teaser = '';

	if (prevSpotlight.length > 0) {
		prevButton = '<span class="spotlights-latest-previousLink" onclick="showSpotlight(\'#' + prevSpotlight.attr('id') + '\');">&lt; ' + gpLL.prevSpotlight + '</span>';	
	}
	if (nextSpotlight.length > 0) {
		nextButton = '<span class="spotlights-latest-nextLink" onclick="showSpotlight(\'#' + nextSpotlight.attr('id') + '\');">' + gpLL.nextSpotlight + ' &gt;</span>';
	}

	if (nextTitle != '') {
			teaser = '<span  class="spotlights-latest-teaserLink" onclick="showSpotlight(\'#' + nextSpotlight.attr('id') + '\');">' + gpLL.nextSpotlightTeaser + ' ' + nextTitle + '</span>';
	} else if(prevTitle != '') {
		teaser = '<span class="spotlights-latest-teaserLink" onclick="showSpotlight(\'#' + prevSpotlight.attr('id') + '\');">' + gpLL.prevSpotlightTeaser + ' ' + prevTitle + '</span>';
	}
	
	$(selector + ' .spotlights-teaser').html(teaser);
	if (prevButton != '' && nextButton != '') {
		buttonSeperator = ' - ';
	}
	$(selector + ' .spotlights-nav').html(prevButton + buttonSeperator + nextButton);
	
	$('.spotlights-latest-item').hide();
	activeSpotlight.show();
	
}