var closeTimer, activeMenu, activeEle, activeImg;

function hover (ele, state) {
	ele.style.backgroundColor = state ? "#00305E" : "#FBD540";
	ele.style.color = state ? "#FFFFFF" : "#000000";
	
	if (state && closeTimer)
		clearTimeout (closeTimer);
	
	if (!state)
		timedClose();
}

function openMenu (id, ele) {
	if (activeEle) {
		activeEle.src = "img/menu/" + activeImg + "a.gif";
	}

	ele.src = "img/menu/" + id + "b.gif";
	activeEle = ele;
	activeImg = id;

	if (closeTimer)
		clearTimeout (closeTimer);

	if (activeMenu)
		activeMenu.style.visibility = "hidden";

	activeMenu = document.getElementById (id);
	activeMenu.style.visibility = "visible";
}

function timedClose () {
	if (closeTimer)
		clearTimeout (closeTimer);
	closeTimer = setTimeout ("_timedClose()", 750);
}

function _timedClose () {
	if (activeMenu) {
		activeMenu.style.visibility = "hidden";
		activeEle.src = "img/menu/" + activeImg + "a.gif";
		activeMenu = null;
	}
}

function menuLink (id, ele) {
	if (activeEle)
		activeEle.src = "img/menu/" + activeImg + "a.gif";

	ele.src = "img/menu/" + id + "b.gif";
	activeEle = ele;
	activeImg = id;

	if (closeTimer)
		clearTimeout (closeTimer);

	if (activeMenu) {
		activeMenu.style.visibility = "hidden";
		activeMenu = null;
	}
}

function ddnav (url, target, width, height) {
	if (target == "huidig")
		location.href = url;
	else if (target == "nieuw")
		window.open (url);
	else if (target == "popup")
		openPopup (url, "popup", width, height, 1);
	
	return false;
}

function openPopup (url, name, w, h, resizable) {
	var resizable = resizable || 0;
	var opt = "toolbar=0,location=0,scrollbars="+resizable+",directories=0,status=0,menubar=0,resizable="+resizable+","
				+"width="+w+",height="+h+",left="+parseInt((screen.width-w)/2)+",top="+parseInt((screen.height-h)/3);
	window.open(url, name, opt);
	return false;
}