function laad() {
	RotateHeader();
}
		
function RotateHeader() {
	Header('img/wp%.jpg', 1, 5);
}
	
function Rand(Van, Naar) {
	var a;
	var b = true;
	while (a < Van || a > Naar || b){
		b = false;
		a = Math.floor(Math.random() * (Naar - Van + 1) + Van) ;
	}
	return a;
}

function Header(fn, Van, Naar, ObjId) {
	var afbNr = -1;
	if (afbNr < Van || afbNr > Naar) var afbNr = Rand(Van, Naar);
	document.body.style.backgroundImage = "url('" + fn.replace('%', afbNr) + "')";
}
function Box(id, titel, inhoud) {
	document.write
	( '<table id="' + id + '_open" cellpadding="0" cellspacing="0">'
	+	'<tr><td class="hok1">&nbsp;</td><td class="hok2"><div class="titel"><div>'
	+		'<div id="' + id + '_open_titel" class="tekst">&nbsp;</div>'
	+ 		'<div class="knop"><a href="" onclick="toonBox(\'' + id + '\', false, true); return false;"><img src="img/min.gif" border="0"/></a></div>'
	+	'</div></td><td class="hok3">&nbsp;</td></tr>'
	+ 	'<tr><td class="hok4">&nbsp;</td><td id="' + id + '_open_inhoud" class="hok5">&nbsp;</td><td class="hok6">&nbsp;</td></tr>'
	+ 	'<tr><td class="hok7">&nbsp;</td><td class="hok8">&nbsp;</td><td class="hok9">&nbsp;</td></tr>'
	+ '</table>'
	+ '<table id="' + id + '_dicht" cellpadding="0" cellspacing="0" style="display: none;">'
	+	'<tr><td class="hok1">&nbsp;</td><td class="hok2"><div class="titel"><div>'
	+		'<div id="' + id + '_dicht_titel" class="tekst">&nbsp;</div>'
	+ 		'<div class="knop"><a href="" onclick="toonBox(\'' + id + '\', true, true); return false;"><img src="img/plus.gif" border="0"/></a></div>'
	+	'</div></td><td class="hok3">&nbsp;</td></tr>'
	+ 	'<tr><td class="hok7">&nbsp;</td><td class="hok8">&nbsp;</td><td class="hok9">&nbsp;</td></tr>'
	+ '</table>');
	$(id + '_open_titel').innerHTML = titel;
	$(id + '_dicht_titel').innerHTML = titel;
	$(id + '_open_inhoud').innerHTML = inhoud;
	toonBox(id, getCookie('rw_verbergbox_' + id) != 1, false);
}
function toonBox(id, open, opslaan) {
	$(id + '_open').style.display = open ? 'block' : 'none';
	$(id + '_dicht').style.display = open ? 'none' : 'block';
	if (opslaan) setCookie('rw_verbergbox_' + id, 1, open ? 0 : 30);
}

function $(id) {
	return document.getElementById(id);
}

function setCookie(c_name,value,expiredays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
	if (document.cookie.length <= 0) return '';
	c_start = document.cookie.indexOf(c_name + "=");
	if (c_start == -1) return ''; 
	c_start = c_start + c_name.length+1; 
	c_end = document.cookie.indexOf(";",c_start);
	if (c_end == -1) c_end = document.cookie.length;
	return unescape(document.cookie.substring(c_start,c_end));
}

