var t;
var tab = 1;
var j = 0;
backgroundArrayExists = (typeof(window['backgrounds'])=="object");
if (backgroundArrayExists) var p = backgrounds.length;

function initTabs() {
	var listitems = new Array;
	var el = new Array;
	listitems = [1,2,3,4];
	for (i=0; i<=listitems.length-1 ;i++)
	{
		el = document.getElementById('lijst-1-' + listitems[i]);
		el.onmouseover = function() {
			ul.className = this.id;
			clearTimeout(t);
		}
	}
	nextTab();
}

function nextTab() {
	ul.className = 'lijst-1-' + tab;
	(tab>=4) ? tab = 1 : tab++;
	t = setTimeout("nextTab()",3000);
}

function runBGSlideShow(){
	document.body.setAttribute("id","foto-" + backgrounds[j]);
	j = j + 1;
	if (j > (p-1)) j=0;
	t = setTimeout('runBGSlideShow()', 5000);
}

window.onload = function() {
	ul = document.getElementById('lijst-1');
	if (ul) initTabs();
	if (backgroundArrayExists) runBGSlideShow();
}
