// JavaScript Document

var currentNewsIndex = 0;
var newsList 	= new Array();
var berichtList = new Array();
var menuList 	= new Array();

function SetNewsChanger(news, bericht, menu, seperator)
{
	newsList 	= news.toString().split(seperator);
	berichtList = bericht.toString().split(seperator);
	menuList 	= menu.toString().split(seperator);

	setInterval("Fade()", 5000);
}

function Fade()
{
	if (newsList.length > 1)
	{
		$('#path').removeAttr('style');
		$('#path').fadeOut('slow', function() 
									{
										$('#path').removeAttr('style');
										currentNewsIndex++;
										if ((currentNewsIndex + 1) >= newsList.length)
											currentNewsIndex = 0
										$('#path').html(MakeLink(newsList[currentNewsIndex], berichtList[currentNewsIndex], menuList[currentNewsIndex]));
										$('#path').fadeIn('slow', function() {$('#path').removeAttr('style');});
		});
	}
}

function MakeLink(newsbericht, bericht, menu)
{
	return "<a href='nieuwsDetail.php?contentid="+bericht+"&menuid="+menu+"' class='newschanger'><strong>Laatste nieuws - </strong>"+newsbericht+"</a>";
}

function SetFirstNewsItem()
{
	if (newsList.length > 0)
	{
		$('#path').html(MakeLink(newsList[currentNewsIndex], berichtList[currentNewsIndex], menuList[currentNewsIndex]));
	}
}