<!--
var menutimeout_value = 500;  // milli-seconds
var menu_timeout_value = 0;
var curZIndex = 100000;

var mouseovertimeout;
var currentmenu = 0;

// prototype $() function to replace document.getElementById()
function $() {
	var elements = new Array();

	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
		element = document.getElementById(element);

		if (arguments.length == 1)
		return element;

		elements.push(element);
	}

	return elements;
}

var preload = new Array();
function preload_images() {
	for (i = 1; i <= 3; i++) {
		preload[i] = new Image();
		preload[i].src = $("nav" + i).src.replace("_off.", "_on.");
	}
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/title_gemeente.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/title_regio.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/title_kalender.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/nieuwsbrief_ja.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/nieuwsbrief_nee.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/icon_home_on.gif";
	i++;
	preload[i] = new Image();
	preload[i].src = "/library/192/images/icon_login_on.gif";
}
	
function mout(id) {
	if ($("submenu").style.visibility == "hidden") mout2(id);
	else mouseovertimeout = setTimeout("mout2(" + id + ")", menu_timeout_value);
}

function mout2(id) {
	if ($("nav" + id) && $("nav" + id).old_src != null) $("nav" + id).src = $("nav" + id).old_src;
	nosubmenus();
}

function mover(id, menu, obj) {
	if (mouseovertimeout) {
		clearTimeout(mouseovertimeout);
		if (currentmenu != "id") mout2(currentmenu);
	}

	if ($("nav" + id).old_src == null) {
		$("nav" + id).old_src = $("nav" + id).src;
	}

	$("nav" + id).src = $("nav" + id).old_src.replace("_off.", "_on.");

	submenus(id, menu, obj);

	currentmenu = id;
}

function submenus(id, n, obj) {
	nosubmenus();
	blur_dropdowns();

	curZIndex++;
	$("submenuIframe").style.zIndex = curZIndex;
	curZIndex++;
	$("submenu").style.zIndex = curZIndex;

	p = getpos(obj.id)
	$("submenuIframe").style.left = p[0];
	$("submenuIframe").style.top = p[1] + (submenu[n].length == 0 ? -1 : 0) + (navigator.appName.indexOf("Opera") != -1 ? -3 : 0) + obj.offsetHeight;
	$("submenu").style.left = p[0];
	$("submenu").style.top = p[1] + (submenu[n].length == 0 ? -1 : 0) + (navigator.appName.indexOf("Opera") != -1 ? -3 : 0) + obj.offsetHeight;

	submenu_width = 0;
	links = "";

	for (i = 0; i < submenu[n].length; i++) {
		links += "<div class=\"menuitems_off\" onClick=\"document.location.href='" + submenu[n][i][0] + "'\" onMouseover=\"this.className='menuitems_on'\" onMouseout=\"this.className='menuitems_off'\" id=\"menu_item_" + i + "\"><nobr>" + submenu[n][i][1]+"</nobr></div>";
	}

	if (links != "") {
		$("submenu").innerHTML = links;

		submenu_width = Math.max(160, $("submenu").offsetWidth);

		for (i = 0; i < submenu[n].length; i++) {
			$("menu_item_" + i).style.width = submenu_width + (navigator.appVersion.indexOf("MSIE") == -1 ? -24 : 0);
		}

		html = "<table cellpadding=0 cellspacing=0 border=0>";
		html += "<TR>";
		html += "<td width=" + submenu_width + " bgcolor=#e5e5e5>";
		html += $("submenu").innerHTML;
		html += "</td>";
		html += "</tr>";
		html += "<tr>";
		html += "<td bgcolor=#022c4e><img src=\"/library/192/images/dummy.gif\" width=" + submenu_width + " height=1></td>";
		html += "</tr>"; 
		html += "</table>";
		
		menu_timeout_value = menutimeout_value;
	} else {
		html = "<div style=\"background-color:" + ($("nav" + id).old_src.indexOf("_on.") > -1 ? "transparent" : "#c2c2c2") + "\"><img src=\"/library/192/images/dummy.gif\" width=\"160\" height=\"1\"></div>";
		
		menu_timeout_value = 0;
	}

	$("submenu").innerHTML = html;
	
	submenu_height = $("submenu").offsetHeight;
	$("submenuIframe").style.width = submenu_width;
	$("submenuIframe").style.height = submenu_height;
	
	$("submenuIframe").style.visibility = "visible";
	$("submenu").style.visibility = "visible";
}

function nosubmenus() {
	if ($("submenu") && $("submenu").style.visibility == "visible") {
		$("submenuIframe").style.visibility = "hidden";
		$("submenu").style.visibility = "hidden";
		$("submenuIframe").style.left = -1000;
		$("submenu").style.left = -1000;
	}
}

function blur_dropdowns() {
	els = document.getElementsByTagName("select");
	for (i = 0; i < els.length; i++) {
		els[i].blur();
	}
}

function trim(str) {
	return str.replace(/^\s+|\s+$/g, "");
}

Array.prototype.inArray = function(value) {
	for (i = 0; i < this.length; i++) {
			if (this[i] == value) return true;
	}
	return false;
};

function change_news(what) {
	$("nieuws_items_nationaal").style.display = "none";
	$("nieuws_items_gemeente").style.display = "none";
	$("nieuws_items_regio").style.display = "none";
	el = $("title_nieuwsberichten");
	if (what == "nationaal") {
		el.src = "/library/192/images/title_nieuws_nationaal.gif";
		$("nieuws_items_nationaal").style.display = "inline";
	} else if (what == "gemeente") {
		el.src = "/library/192/images/title_nieuws_gemeente.gif";
		$("nieuws_items_gemeente").style.display = "inline";
	} else if (what == "regio") {
		el.src = "/library/192/images/title_nieuws_regio.gif";
		$("nieuws_items_regio").style.display = "inline";
	}
}

function do_search(obj) {
	if (trim(obj.search_value.value) == "" || trim(obj.search_value.value) == 'zoek door de site') {
		obj.search_value.focus();
		alert("Gelieve een zoekterm in te tikken.");
		return;
	}
	
	searchlayerpos = getpos("searchbox");
	el = $("searchbox");
	el1 = $("zoekresultaatIframe");
	el2 = $("zoekresultaat");

	curZIndex++;
	el1.style.zIndex = curZIndex;
	curZIndex++;
	el2.style.zIndex = curZIndex;

	el1.style.left = searchlayerpos[0] + 9;
	el2.style.left = searchlayerpos[0] + 9;
	el1.style.top = searchlayerpos[1] + el.offsetHeight;
	el2.style.top = searchlayerpos[1] + el.offsetHeight;
	
	links = "";
	for (i = 1; i <= 16; i++) {
		links += "<div style=\"width:" + (280 + (navigator.appVersion.indexOf("MSIE") == -1 ? -42 : 0)) + "\" class=\"searchresults_off\" onClick=\"document.location.href='#'\" onMouseover=\"this.className='searchresults_on'\" onMouseout=\"this.className='searchresults_off'\">Resultaat " + i + "</div>";
	}
	html = '<table cellpadding=0 cellspacing="0" border="0" width="282" style="border: 1px solid #d5d5d5">';
	html += '<tr>';
	html += '<td>';	
	html += links;
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td bgcolor="#d5d5d5"><img src="/library/192/images/dummy.gif" width="1" height="1" border="0"></td>';
	html += '</tr>';
	html += '<tr height="22" bgcolor="#f2f2f2">';
	html += '<td align="right" class="allsearchresults" onClick="location.href=\'#\'">Bekijk alle zoekresultaten <img src="/library/192/images/zoek_arrow.gif" width="11" height="11" border="0" align="absmiddle"></td>';
	html += '</tr>';
	html += '</table>';
	
	el2.innerHTML = html;
	
	el1.style.height = el2.offsetHeight;
	el1.style.width = el2.offsetWidth;
	
	el1.style.visibility = 'visible';
	el2.style.visibility = 'visible';
}

function search_clear() {
	//nosubmenus();
	el1 = $("zoekresultaatIframe");
	el2 = $("zoekresultaat");
	if (el2.style.visibility == 'visible') {
		document.searchfrm.search_value.value = 'zoek door de site';
		el1.style.visibility = 'hidden';
		el2.style.visibility = 'hidden';
	}
}

function check_email(frm) {
		el = frm.email;
		if (trim(el.value) == "" || trim(el.value) == "e-mailadres") {
			alert("Gelieve een e-mailadres in te vullen.");
			el.focus();
			return;
		}
		ajax("/library/192/includes/emailcheck.php?email=" + escape(el.value), "GET", false, false, function(h, t) {
			if (t == "false") {
					alert("Gelieve een geldig e-mailadres in te vullen.");
					el.value = "";
					el.focus();
			} else {
				frm.submit();
			}
		});
}

function nieuwsbrief_janee(obj) {
	curstatus = (obj.src.indexOf("_ja.") != -1 ? "ja" : "nee");
	if (curstatus == "ja") {
		obj.src = obj.src.replace("_ja.", "_nee.");
		$("l" + obj.id).className = "nieuwsbrief_txt_nee";
	} else {
		obj.src = obj.src.replace("_nee.", "_ja.");
		$("l" + obj.id).className = "nieuwsbrief_txt_ja";
	}
}

var monthlabels = new Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december');
var daylabels = new Array('ma', 'di', 'wo', 'do', 'vr', 'za', 'zo');

var current_day;
var current_month;
var current_year;

function show_month(direction) {
	if (direction == 0) {
		current_day = today_day;
		current_month = today_month;
		current_year = today_year;
	}
		
	tmp_date = new Date(current_year, current_month + direction, 1);
	current_month = tmp_date.getMonth();
	current_year = tmp_date.getFullYear();
	
	$("monthyear_label").innerHTML = monthlabels[current_month] + " " + current_year;
	prevmonth = new Date(current_year, current_month - 1, 1);
	$("prevmonthyear_label").title = monthlabels[prevmonth.getMonth()] + " " + prevmonth.getFullYear();
	nextmonth = new Date(current_year, current_month + 1, 1);
	$("nextmonthyear_label").title = monthlabels[nextmonth.getMonth()] + " " + nextmonth.getFullYear();
	
	display_month(current_month, current_year);
} 

function display_month(month, year) {
	tmp_date1 = new Date(year, month, 1); // first day of month
	tmp_date2 = new Date(year, month + 1, 0); // last day of month
	tmp_date3 = new Date(year, month, 0); // last day of previous month
	
	first_dow = tmp_date1.getDay();
	if (first_dow == 0) first_dow = 7;
	last_dow = tmp_date2.getDay();
	if (last_dow == 0) last_dow = 7;
	num_of_days = tmp_date2.getDate();
	
	days = new Array();
	for (i = tmp_date3.getDate() - first_dow + 2; i <= tmp_date3.getDate(); i++) days.push(i); // remaining days of last month;
	if (days.length == 0) { // no remaining days of last month) {
		for (i = tmp_date3.getDate() - 6; i <= tmp_date3.getDate(); i++) days.push(i);
	}
	for (i = 1; i <= num_of_days; i++) days.push(i); // days of current month
	for (i = 1; i <= 7 - last_dow; i++) days.push(i); // complete the last week with the first days of the next month

	if (days.length < 42) {
		for (j = i; days.length < 42; j++) days.push(j); // add extra days for next month if less than 6 lines
	}
	
	html = '<table cellpadding="0" cellspacing="0" border="0" width="281">';
	html += '<tr class="rp_background_gray">';
	html += '<td class="agenda_spacer_start">&nbsp;</td>';
	for (i = 0; i < daylabels.length; i++) {
		html += '<td class="' + (i == 5 || i == 6 ? 'agenda_cell_weekend ' : '') + 'agenda_cell_blue">' + daylabels[i] + '</td>';
	}
	html += '<td class="agenda_spacer_end">&nbsp;</td>';
	html += '</tr>';
	html += '<tr><td colspan="9"><img src="/library/192/images/rp_grayline.gif" width="281" height="1" border="0"></td></tr>';
	html += '<tr><td colspan="6"><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td><td colspan="2" class="agenda_cell_weekend"><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td><td><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td></tr>';
	cnt = 0;
	cur_month = month - 1;
	cur_month_displaying = false;
	for (i = 0; i < days.length; i++) {
		if (days[i] == 1) {
			cur_month_displaying = !cur_month_displaying;
			cur_month++;
		}
		cur_date = new Date(year, cur_month, days[i]);
		dow = cur_date.getDay();
		if (cnt % 7 == 0 && cnt > 0) { 
			html += '<td class="agenda_spacer_end">&nbsp;</td>';
			html += '</tr>';
		}
		if (cnt % 7 == 0) {
			html += '<tr class="rp_background_transparent">';
			html += '<td class="agenda_spacer_start">&nbsp;</td>';
		}
		html += '<td class="';
		if (dow == 0 || dow == 6) html += 'agenda_cell_weekend ';
		html += 'agenda_cell_';
		if (!cur_month_displaying) html += 'gray';
		else if (year == today_year && month == today_month && days[i] == today_day) html += "selected";
		else html += "black";
		html += '">' + days[i] + '</td>';
		cnt++;
	}
	html += '<td class="agenda_spacer_end">&nbsp;</td>';
	html += '</tr>';
	html += '<tr><td colspan="6"><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td><td colspan="2" class="agenda_cell_weekend"><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td><td><img src="/library/192/images/dummy.gif" width="1" height="5" border="0"></td></tr>';
	html += '</table>';
	html += '<img src="/library/192/images/rp_whiteline.gif" width="281" height="1" border="0"><br>';
	
	$("kalender").innerHTML = html; 
}

function switch_view(what) {
	if (what == "agenda") {
		$("title_kalender").src = "/library/192/images/title_agenda.gif";
		$("kalender").style.display = 'none';
		$("overzicht_extra").style.display = 'inline';
	} else {
		$("title_kalender").src = "/library/192/images/title_kalender.gif";
		$("kalender").style.display = 'inline';
		$("overzicht_extra").style.display = 'none';
	}
}

function position_beeld_overlay() {
	el = $("beeld");
	el2 = $("beeldoverlay");
	el3 = $("beeldnavigatie");
	el_top = el.offsetHeight - el2.offsetHeight;
	el2.style.top = el_top + "px";
	el2.style.visibility = 'visible';
	el3.style.top = el_top + "px";
	el3.style.visibility = 'visible';
}

function show_login(max) {
	el = $("div_login");
	if (el.offsetHeight >= max) return;
	el.style.height = (el.offsetHeight + 2) + "px";
	setTimeout("show_login(" + max + ")", 10);
}

function hide_login(max) {
	el = $("div_login");
	if (el.offsetHeight <= max) {
		el.style.visibility = "hidden";
		return;
	}
	el.style.height = (el.offsetHeight - 2) + "px";
	setTimeout("hide_login(" + max + ")", 10);
}

function display_login() {
	el1 = $("div_login");
	el2 = $("icon_login");
	pos = getpos("div_kopstuk");
	x = pos[0] + $("div_kopstuk").offsetWidth - el1.offsetWidth + 1; 
	y = pos[1] - 1;
	el1.style.left = x + "px";
	el1.style.top = y + "px";
	if (el1.style.visibility == "hidden") {
		el1.style.height = "2px";
		el1.style.visibility = "visible";
		setTimeout("show_login(128)", 10);
		el2.src = el2.src.replace("_off", "_on");
	} else {
		setTimeout("hide_login(2)", 10);
		el2.src = el2.src.replace("_on", "_off");
	}
}

function update_pw_field(what) {
	fld = "";
	if (what == "focus") {
		if ($("pw_field").type == "text") {
			fld = '<input type="password" id="pw_field" name="password" class="login_txt" style="width:96px; height:17px; border:none; background-color:transparent;" onBlur="update_pw_field(\'blur\');">';
		}
	} else if (what == "blur") {
		if (trim($("pw_field").value) == "") {
			fld = '<input type="text" id="pw_field" name="password" value="password" class="login_txt" style="width:96px; height:17px; border:none; background-color:transparent;" onFocus="update_pw_field(\'focus\');">';
		}
	}
	if (fld != "") {
		$("div_pw_field").innerHTML = fld;
		if (what == "focus") window.setTimeout(function() { $("pw_field").focus(); }, 100);
	}
}

function check_login(frm) {
	with (frm) {
		if (trim(username.value) == "" || trim(username.value) == "gebruikersnaam" || trim(password.value) == "" || trim(password.value) == "password") {
			alert("Gelieve zowel gebruikersnaam als password in te vullen.");
			if (trim(username.value) == "" || trim(username.value) == "gebruikersnaam") {
				username.focus();
			} else {
				password.focus();
			}
			return;
		}
		submit();
	}
}

function getRealLeft(el){
	xPos = $(el).offsetLeft;
	tempEl = $(el).offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getRealTop(el){
	yPos = $(el).offsetTop;
	tempEl = $(el).offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}

function getpos(isID){
	trueX = getRealLeft(isID);
	trueY = getRealTop(isID);
	return Array(trueX, trueY);
}

addevent(window, "load", preload_images);

//addevent(window, "load", position_beeld_overlay);
//addevent(document, "mouseup", search_clear);
-->