var nPrevID = 0;

function fnSetMnuOn(nID) {
	try { clearTimeout(oTimer); }
	catch (ex) { }
	if (nPrevID != 0 && nPrevID != nID) {
		var subMnuObj = document.getElementById("subMnu" + nPrevID);
		subMnuObj.style.visibility = "hidden";
	}
	try {
		var obj = document.getElementById("topImgNav");
		var subMnuObj = document.getElementById("subMnu" + nID);
		subMnuObj.style.left = fnFindLeftPos(obj, nID);
		subMnuObj.style.visibility = "visible";
		nPrevID = nID;
	}
	catch(ex) {}
}
function fnSetMnuOff(nID) {
	oTimer = eval("setTimeout('fnSetMnuOffAfterPause("+ nID +")', 1000)");
}
function fnSetMnuOffAfterPause(nID) {
	try {
		var subMnuObj = document.getElementById("subMnu" + nID);
		subMnuObj.style.visibility = "hidden";
		nPrevID = 0;
	}
	catch (ex) {}
}
function fnFindLeftPos(obj, nID) {
	var curleft = 0;
	var objName = obj.id;
	if(obj.offsetParent) {
		curleft = obj.offsetLeft
		while(obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
		}
		curleft = curleft + 16;
		curleft = curleft + (nID * 100);
		return[curleft] + 'px';
	}
}		
function popUpFoto(URL) {
	var	W = 500;
	var H = 500;
	var L = (screen.width - W) / 2;
	var T = (screen.height - H) / 2;
	day = new Date();
	id = day.getTime();
	var sRef = "picture.asp?img=" + URL;
	eval("page" + id + " = window.open(sRef, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+W+',height='+H+',left ='+L+',top ='+T+'');");
}
function printFoto(id, pic) {
	var	W = 500;
	var H = 500;
	var L = (screen.width - W) / 2;
	var T = (screen.height - H) / 2;
	day = new Date();
	tid = day.getTime();
	var sRef = "print.asp?id=" + id + "&picid=" + pic;
	eval("window.open(sRef, '" + tid + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+W+',height='+H+',left ='+L+',top ='+T+'');");
}
function fnSearch() {
	var searchString = document.forms.frmSearch.txtSearch.value;
	if(searchString.length < 3) {
		alert('Vul minimaal 3 letters in a.u.b.');
	} else {
		document.forms.frmSearch.submit();
	}
}

function writeFlash(url,w,h) {
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+w+"\" height=\""+h+"\" id=\"Spurd\" align=\"middle\">");
	document.write("	<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	document.write("	<param name=\"movie\" value=\""+url+"\" />");
	document.write("	<param name=\"quality\" value=\"high\" />");
	document.write("	<param name=\"bgcolor\" value=\"#000000\" />");
	document.write("	<param name=\"wmode\" value=\"transparent\" />");
	document.write("	<embed src=\""+url+"\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#000000\" width=\""+w+"\" height=\""+h+"\" name=\"Spurd\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
	document.write("</object>");
}

function loginSubmit(objForm) {

	if (objForm.fldUsername.value.replace(/ /g, '') == '') {
		objForm.fldUsername.focus();
		alert('Voer een waarde in voor \'Gebruikersnaam\'.');
		return false;
	}
	if (objForm.fldPassword.value.replace(/ /g, '') == '') {
		objForm.fldPassword.focus();
		alert('Voer een waarde in voor \'Wachtwoord\'.');
		return false;
	}
	
	return true;
}

function editSubmit(objForm) {

	if (objForm.fldUsername.value.replace(/ /g, '') == '') {
		objForm.fldUsername.focus();
		alert('Voer een waarde in voor \'Gebruikersnaam\'.');
		return false;
	}
	if (objForm.fldPassword.value.replace(/ /g, '') == '') {
		objForm.fldPassword.focus();
		alert('Voer een waarde in voor \'Wachtwoord\'.');
		return false;
	}
	if (objForm.fldPasswordCheck.value.replace(/ /g, '') == '') {
		objForm.fldPasswordCheck.focus();
		alert('Voer een waarde in voor \'Nogmaals wachtwoord\'.');
		return false;
	}
	
	if (objForm.fldPassword.value.replace(/ /g, '') != objForm.fldPasswordCheck.value.replace(/ /g, '')) {
		objForm.fldPassword.focus();
		alert('Beide wachtwoordvelden moeten gelijk zijn.');
		return false;
	}
	
	return true;
}
