/*
Designed by <theFactor.e>
http://www.tfe.nl

CVS Header Information:  
    $Source: f:/tfecvs/cvs/Drents_Museum/website/htdocs/js/default.js,v $
    $Revision: 1.3 $
    $Date: 2005/05/04 14:18:30 $
    $Name:  $
    $Author: kleinebeer#marcel $
*/
<!-- algemeen -->
function close_window() {
    window.close();
}
function print_window() {
    window.print();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
	
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

<!-- dropdownmenu -->
function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.mac = (navigator.userAgent.indexOf("Mac") != -1); 
	this.opera = (navigator.userAgent.indexOf("Opera") != -1); 
	this.min = (this.ns||this.ie)
}
var browser = new BrowserCheck();

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var openMenu = null;
var activeMenu = null;
function TFE_openMenu(menu, dropdownId, offsetX, offsetY){
	// stop menu close timer
	TFE_hideTimerIntercepted();
	
	// if an open menu exists, hide it (also strips style classes)
	if(openMenu != null){
		TFE_hideDiv(openMenu);
	}
	openMenu = dropdownId;
	
	// if an menu with the active class exists, remove the class
	if(activeMenu != null){
		activeMenu.className="";
	}
	activeMenu = menu;
	
	// find the dropdown to open
	object = MM_findObj(dropdownId);

	// if nu dropdown was found, return
	if(object == null){
		return;
	}
	
	// set active class for this menu
	menu.className="active";

	offsetY += TFE_getOffsetY(menu);
	offsetX += TFE_getOffsetX(menu);
	
	object.style.top = offsetY + menu.offsetHeight + "px";
	object.style.left = offsetX + "px";
	
	// make dropdown visible
	object.style.visibility='visible';
	
	// position IFrame
	TFE_positionIFrame(object);
}

var timer = null;
function TFE_hideTimerStart(elemid){
	// stop menu close timer
	TFE_hideTimerIntercepted();
	// start a new timer
	var f = "TFE_hideDiv('" + elemid + "')";
	timer = setTimeout(f,500);
}
function TFE_hideTimerIntercepted(){
	// if a timer exists, stop it
	if(timer != null){
		clearTimeout(timer);
	}
}
function TFE_hideDiv(elemid){
	// close the menu
	if((elem = MM_findObj(elemid)) != null){
		elem.style.visibility="hidden";
		activeMenu.className="";
		TFE_hideIFrame();
	}
}

function TFE_positionIFrame(elem){
	if(browser.ie){
		IfrRef = document.getElementById("DivShim");
		if(IfrRef == null){
			IfrRef = TFE_createIFrame();
		}
		if(IfrRef != null){
			IfrRef.style.width = elem.offsetWidth;
			IfrRef.style.height = elem.offsetHeight;
			IfrRef.style.top = elem.style.top;
			IfrRef.style.left = elem.style.left;
			IfrRef.style.zIndex = elem.style.zIndex;
			IfrRef.style.display = "block";
		}
	}
}
function TFE_hideIFrame(){
	if(browser.ie){
		IfrRef = document.getElementById("DivShim");
		if(IfrRef != null){
			IfrRef.style.display = "none";
		}
	}
}
function TFE_createIFrame(){
	body = document.getElementsByTagName("body");
	IfrRef = document.createElement("iframe");
	IfrRef.id = "DivShim";
	IfrRef.src="javascript:false;";
	IfrRef.scrolling="no";
	IfrRef.frameborder="0";
	IfrRef.style.position="absolute";
	IfrRef.style.top="0";
	IfrRef.style.left="0"; 
	IfrRef.style.display="none";
	body[0].appendChild(IfrRef);
	return IfrRef;
}

function TFE_getOffsetX(node){
	var offsetX = node.offsetLeft;
	
	var parentOffsetNode = node.offsetParent;
	while(parentOffsetNode != null){
		offsetX += parentOffsetNode.offsetLeft;
		parentOffsetNode = parentOffsetNode.offsetParent;
	}	
	
	return offsetX;
}

function TFE_getOffsetY(node){
	var offsetY = node.offsetTop;
	
	var parentOffsetNode = node.offsetParent;
	while(parentOffsetNode != null){
		offsetY += parentOffsetNode.offsetTop;
		parentOffsetNode = parentOffsetNode.offsetParent;
	}
	
	return offsetY;
}
function showImageLayer(){
	document.getElementById('imageLayer').style.display = 'block';
}
function hideImageLayer(){
	document.getElementById('imageLayer').style.display = 'none';
}