function divHeight(divName) {
	docObj = document.getElementById(divName);
	return parseInt(docObj.offsetHeight);
}

function popup(mypage, myname, w, h, scroll) {
	var url = mypage;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(url, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus(); 
	}
}

/* target is deprecated, gebruik onderstaande voor nieuw venster
bijv: <a href="document.html" rel="external">external link</a>
zie voor meer info http://www.sitepoint.com/article/1041*/
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}	
	}
}
window.onload = externalLinks;


sfHover = function() {
	aHover=new Array();
	aHover[0]='tree';
	aHover[1]='submenu';
	for (idn=0; idn < aHover.length; idn++) {
		idv=aHover[idn];
		if (document.getElementById(idv)) {
			var sfEls = document.getElementById(idv).getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);

function trigger(targetSubmenu) {
	var target = document.getElementById('switcher'+targetSubmenu);
	var targetSubmenu = document.getElementById("submenu"+targetSubmenu);
	
	if (target.getAttribute('alt')=='expand menu') {
		target.setAttribute('src','img/menureplace-expanded.png');
		target.setAttribute('alt','contract menu');
		targetSubmenu.style.display='block';
	} else {
		target.setAttribute('src','img/menureplace-collapsed.png');
		target.setAttribute('alt','expand menu');
		targetSubmenu.style.display='none';
	}
	
	boxesH=20;
	if (document.getElementById("boxes")) {
		boxesH+=document.getElementById("boxes").offsetHeight;
	}
	navH=document.getElementById("nav").offsetHeight+boxesH;
	treeH=document.getElementById("tree").offsetHeight;

	if (navigator.product == "Gecko" && navH > treeH) {
		//document.getElementById("nav").style.height=20+navH+'px';
		document.getElementById("content").style.height=20+navH+'px';	
	} else {
		document.getElementById("content").style.height=navH+'px';	
	}
	
	document.getElementById("content").style.backgroundPosition='bottom left';
}

function geturl(url) {
	document.location.href=url;
}
