var aPhotoBook = new Array(); 
var slideNr = 0
var allowClose = true;
var closingTimeout = false

function swapHFO(newImg) {
	try {
		newImg = newImg == "" ? "img/white.gif" : "/afbeeldingen/page/" + newImg;
		document.getElementById("hfo").src = newImg;
	} catch(e) { }
}

function enlarge() {
	if (arguments.length == 1) {
		url = arguments[0].replace("/thumb/","/large/").replace("/small/","/large/").replace("/normal/","/large/").replace("/page/","/large/");
		window.open("enlarge.asp?img="+url,'taxizeevangenlarge','width=300,height=200,top=100,left=200');
	}
}

function preBook(i,r,img){
	aPhotoBook[i] = new Image();
	aPhotoBook[i].src = (r ? "afbeeldingen/menu/" : "") + img;
}

function startPhotoBook() {
	window.setInterval('slidePhotoBook(' + slideNr + ')', 5000);
}

function slidePhotoBook(i) {
	var b = document.getElementById("photoBook");
	b.style.background = "#D6EB8C url(\"" + aPhotoBook[slideNr].src + "\") no-repeat 50% 50%";
	slideNr++;
	if (slideNr == aPhotoBook.length) { 
		slideNr = 0;
	}
}

function mousePhotoBook(act) {
	var b = document.getElementById("photoBook");
	b.className = act ? "photoOver" : "photoOut";
}

function mnuSub(act, id) {
	try {
		var block = document.getElementById("ma" + id);
		var div = document.getElementById("mnuDiv" + id);
		if (act) {
			allowClose = false;
			if (closingTimeout) {
				clearTimeout(closingTimeout);
				closingTimeout = false;
			}
			div.style.display = "block";
			div.style.left = (getOffsetLeft(block) + 130) + "px";
			div.style.top = getOffsetTop(block) + "px";
		} else {
			allowClose = true;
			closingTimeout = setTimeout("mnuSubClose(" + id + ")", 200);
		}
	}
	catch(e) { }
}

function mnuSubClose(id) {
	if (allowClose)	document.getElementById("mnuDiv" + id).style.display = "none";
}

function getOffsetLeft(el)
{ 
	var eltemp = el;
	var ol = el.offsetLeft; 
	while((eltemp = eltemp.offsetParent) != null) 
	ol += eltemp.offsetLeft;
	return ol;
}

function getOffsetTop (el)
{ 
   var eltemp2 = el;
   var ot = el.offsetTop; 
   while((eltemp2 = eltemp2.offsetParent) != null) 
	ot += eltemp2.offsetTop;
	return ot;
}