function menu_pos_1_on() {
	document.getElementById('menu-pos-1').style.background = "url(beelden/menu-pos-01.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-1').style.cursor = "pointer";
	document.getElementById('menu-pos-1-link').style.color = "#ffffff";
}

function menu_pos_1_off() {
	document.getElementById('menu-pos-1').style.background = "url(beelden/menu-pos-01.png) no-repeat 0 0";
	document.getElementById('menu-pos-1').style.cursor = "hand";
	document.getElementById('menu-pos-1-link').style.color = "#483721";
}

function menu_pos_2_on() {
	document.getElementById('menu-pos-2').style.background = "url(beelden/menu-pos-02.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-2').style.cursor = "pointer";
	document.getElementById('menu-pos-2-link').style.color = "#ffffff";
}

function menu_pos_2_off() {
	document.getElementById('menu-pos-2').style.background = "url(beelden/menu-pos-02.png) no-repeat 0 0";
	document.getElementById('menu-pos-2').style.cursor = "hand";
	document.getElementById('menu-pos-2-link').style.color = "#483721";
}

function menu_pos_3_on() {
	document.getElementById('menu-pos-3').style.background = "url(beelden/menu-pos-03.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-3').style.cursor = "pointer";
	document.getElementById('menu-pos-3-link').style.color = "#ffffff";
}

function menu_pos_3_off() {
	document.getElementById('menu-pos-3').style.background = "url(beelden/menu-pos-03.png) no-repeat 0 0";
	document.getElementById('menu-pos-3').style.cursor = "hand";
	document.getElementById('menu-pos-3-link').style.color = "#483721";
}

function menu_pos_4_on() {
	document.getElementById('menu-pos-4').style.background = "url(beelden/menu-pos-04.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-4').style.cursor = "pointer";
	document.getElementById('menu-pos-4-link').style.color = "#ffffff";
}

function menu_pos_4_off() {
	document.getElementById('menu-pos-4').style.background = "url(beelden/menu-pos-04.png) no-repeat 0 0";
	document.getElementById('menu-pos-4').style.cursor = "hand";
	document.getElementById('menu-pos-4-link').style.color = "#483721";
}

function menu_pos_5_on() {
	document.getElementById('menu-pos-5').style.background = "url(beelden/menu-pos-05.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-5').style.cursor = "pointer";
	document.getElementById('menu-pos-5-link').style.color = "#ffffff";
}

function menu_pos_5_off() {
	document.getElementById('menu-pos-5').style.background = "url(beelden/menu-pos-05.png) no-repeat 0 0";
	document.getElementById('menu-pos-5').style.cursor = "hand";
	document.getElementById('menu-pos-5-link').style.color = "#483721";
}

function menu_pos_6_on() {
	document.getElementById('menu-pos-6').style.background = "url(beelden/menu-pos-06.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-6').style.cursor = "pointer";
	document.getElementById('menu-pos-6-link').style.color = "#ffffff";
}

function menu_pos_6_off() {
	document.getElementById('menu-pos-6').style.background = "url(beelden/menu-pos-06.png) no-repeat 0 0";
	document.getElementById('menu-pos-6').style.cursor = "hand";
	document.getElementById('menu-pos-6-link').style.color = "#483721";
}

function menu_pos_7_on() {
	document.getElementById('menu-pos-7').style.background = "url(beelden/menu-pos-07.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-7').style.cursor = "pointer";
	document.getElementById('menu-pos-7-link').style.color = "#ffffff";
}

function menu_pos_7_off() {
	document.getElementById('menu-pos-7').style.background = "url(beelden/menu-pos-07.png) no-repeat 0 0";
	document.getElementById('menu-pos-7').style.cursor = "hand";
	document.getElementById('menu-pos-7-link').style.color = "#483721";
}

function menu_pos_8_on() {
	document.getElementById('menu-pos-8').style.background = "url(beelden/menu-pos-08.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-8').style.cursor = "pointer";
	document.getElementById('menu-pos-8-link').style.color = "#ffffff";
}

function menu_pos_8_off() {
	document.getElementById('menu-pos-8').style.background = "url(beelden/menu-pos-08.png) no-repeat 0 0";
	document.getElementById('menu-pos-8').style.cursor = "hand";
	document.getElementById('menu-pos-8-link').style.color = "#483721";
}

function menu_pos_9_on() {
	document.getElementById('menu-pos-9').style.background = "url(beelden/menu-pos-09.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-9').style.cursor = "pointer";
	document.getElementById('menu-pos-9-link').style.color = "#ffffff";
}

function menu_pos_9_off() {
	document.getElementById('menu-pos-9').style.background = "url(beelden/menu-pos-09.png) no-repeat 0 0";
	document.getElementById('menu-pos-9').style.cursor = "hand";
	document.getElementById('menu-pos-9-link').style.color = "#483721";
}

function menu_pos_10_on() {
	document.getElementById('menu-pos-10').style.background = "url(beelden/menu-pos-10.png) no-repeat 0 -26px";
	document.getElementById('menu-pos-10').style.cursor = "pointer";
	document.getElementById('menu-pos-10-link').style.color = "#ffffff";
}

function menu_pos_10_off() {
	document.getElementById('menu-pos-10').style.background = "url(beelden/menu-pos-10.png) no-repeat 0 0";
	document.getElementById('menu-pos-10').style.cursor = "hand";
	document.getElementById('menu-pos-10-link').style.color = "#483721";
}

var pic = new Array();
var picschaduw = new Array();

pic[0] = 'beelden/header1.png';
pic[1] = 'beelden/header2.png';
pic[2] = 'beelden/header3.png';

picschaduw[0] = 'beelden/header1-schaduw.png';
picschaduw[1] = 'beelden/header2-schaduw.png';
picschaduw[2] = 'beelden/header3-schaduw.png';

// totaal aantal foto's
var totaal = 3;
// random start
var start = randomnumber = Math.floor(Math.random()*totaal);

// alle foto's preloaden
var preLoad = new Array();
for (i = 0; i < totaal; i++) {
	preLoad[i] = new Image();
	preLoad[i].src = pic[i];
}

var preLoad2 = new Array();
for (i = 0; i < totaal; i++) {
	preLoad[i] = new Image();
	preLoad[i].src = picschaduw[i];
}

// aangeven dat dit de eerste keer is dat de loop begint
var eerste_keer = 1;

function wissel(x) {
	t =  start-1;
	
	if (t == -1) {
		t = 2; // totaal -1
	}
	document.getElementById('header-over').style.background = "url("+pic[t]+") no-repeat";
	document.getElementById('header-over').style.opacity = 1.0;
	document.getElementById('header-over').style.filter = 'alpha(opacity=100)';

	document.getElementById('header').style.background = "url("+picschaduw[start]+") no-repeat";

	if (eerste_keer == 1) {
		setTimeout("fade('header-over', 100, 0, 1000)", 1000);
		eerste_keer = 0;
	}
	else {
		fade('header-over', 100, 0, 1000);
	}

	start = start + 1;

	if (start > totaal-1) {
		start = 0;
	}

	setTimeout("wissel(start)", 3000);
}

function fade(eID, startOpacity, stopOpacity, duration) {
	var speed = Math.round(duration / 100);
	var timer = 0;
	if (startOpacity < stopOpacity){
		for (var i=startOpacity; i<=stopOpacity; i++) {
			setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
			timer++;
		} return;
	}
	for (var i=startOpacity; i>=stopOpacity; i--) {
		setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
		timer++;
	}
}

function setOpacity(eID, opacityLevel) {
	var eStyle = document.getElementById(eID).style;
	eStyle.opacity = opacityLevel / 100;
	eStyle.filter = 'alpha(opacity='+opacityLevel+')';
}

function handleError()
{
	return true;
}

window.onerror = handleError;
