$(document).ready(function(){
	klicktippsDeeplinks();
});

function klicktippsDeeplinks() {
	setTimeout('klicktippsSwapDeeplinks()', 5000);
}

function klicktippsSwapDeeplinks() {

	// td.tx-nidagklicktippsliste-pi1-liste-comment-middle
	var counter = 0;
	$('.tx-nidagklicktippsliste-pi1-liste-comment-middle').each(function(itemIdx,item) {

		// div.klicktippsliste-deeplink
		var currentDeeplinkId = '';
		var nextDeeplinkId = $(this).children('.klicktippsliste-deeplink:first').attr('id');
		var foundNextDeeplink = false;
		$(this).children('.klicktippsliste-deeplink').each(function(dlIdx, dl) {
			if (!foundNextDeeplink) {
				if (currentDeeplinkId != '') {
					nextDeeplinkId = $(this).attr('id');
					foundNextDeeplink = true;
				}
				if ($(this).css('display') == 'block') {
					currentDeeplinkId = $(this).attr('id');
				}
			}
		});
		if (nextDeeplinkId) {
			setTimeout('klicktippsSwapDeeplink(\'' + currentDeeplinkId + '\',\'' + nextDeeplinkId + '\')', counter*1000);
		}
		counter++;
	});
	klicktippsDeeplinks();
}

function klicktippsSwapDeeplink(curId, nextId) {
	if (curId != '') {
		$('#' + curId).css('display', 'none');
	}
	$('#' + nextId).css('display', 'block');
} 