// JavaScript Document
<!--

var Opera = window.opera ? true : false;

var activeSub = "";
var activeItem = "";
var nowId = "";

function getClient() {
    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase()
	var apv=navigator.appVersion.toLowerCase()
	this.major = parseInt(navigator.appVersion)
	// browserversion
    this.ns  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)))
   	this.gecko = (this.ns && (this.major >= 5))
    this.ie   = (agt.indexOf("msie") != -1)
    this.ie4  = (this.ie && (this.major == 3))
	this.ie45 = (agt.indexOf('msie 4.5') != -1);
    this.ie5  = (this.ie && (this.major == 4))
	// platform
	this.mac = (apv.indexOf("macintosh")>0);
	// compatible browsers
	this.ie4comp = ((this.ie4 && !this.mac) || this.ie45 || this.ie5)
	this.comp = (this.ie4comp || this.gecko);
	return (this)
}

var is = new getClient();

function swapImage(imgSrc, imgName) { 
	if (is.comp) {
		var img = document.getElementsByName(imgName);
		img[0].src = imgSrc;
	}
}

var mousex;
var mousey;

function getMouseXY(e) {
	if (is.ie4comp) { // grab the x-y pos.s if browser is IE
		mousex = event.clientX + document.body.scrollLeft;
		mousey = event.clientY + document.body.scrollTop;
	}
	else {  // grab the x-y pos.s if browser is not IE
		mousex = e.pageX;
		mousey = e.pageY;
	}
}

function roSubmit(id,pic){
	if(is.comp && !(is.mac && is.ie4comp)){
		var ref = document.getElementById(id);
		ref.style.background = "url('" + pic + "') no-repeat";
	}
}

// Speciaal voor MAC-users: Geef specifieke midden-kolom de volledige hoogte van zijn container:
function inherit(objidFirst,objidSecond,objidThird) {
   if (is.ie4comp && is.mac) {

        var frst = document.getElementById(objidFirst); //specifieke kolom (middendeel)
        var snd = document.getElementById(objidSecond); //positie laatste onderdeel
        var trd = document.getElementById(objidThird); //hoogte eerste onderdeel
			
		frst.style.height = (snd.offsetTop-trd.offsetHeight) + 'px';
        
        return true
        }
}

// --- NAVIGATIE ---
function openMenu(thisId, thisRef, subId){
	if (is.comp){
		nowId = thisId;
		var x = 0;
		var y = 0;
		while( thisRef.offsetParent != null ) {
			y +=thisRef.offsetTop;
			x += thisRef.offsetLeft;
			thisRef = thisRef.offsetParent;
	    }
		setTimeout('checkMousePos("'+ thisId + '","' + thisRef + '","' + subId + '","' + x + '","' + y + '");', 300);
		if (thisId != thisPageId){ eval("document.getElementById(thisId).style.color = '#fff'"); }
	}
}

function checkMousePos(thisId, thisRef, subId, varX, varY){
	if(is.comp){
		if(thisId == nowId){
			w = eval("document.getElementById(thisId).offsetWidth");
			h = eval("document.getElementById(thisId).offsetHeight");
			if(mousey > parseInt(varY) && mousey < (parseInt(varY) + h) && mousex > parseInt(varX) && mousex < (parseInt(varX) + w)){
				var s = varY + " - - " + h + " - - " + mousey;
				onlyOpen(thisId, thisRef, subId, varX, varY);
				setTimeout('closeMenu("'+ thisId + '","' + subId + '");', 1500);
			}
		}
	}
}

function onlyOpen(thisId, thisRef, subId, varX, varY){
	var w;
	var l;
	var h;
	if ((activeSub != subId) && (activeSub != "")){
		eval("document.getElementById(activeSub).style.left = '-1000px'");
		if (activeItem != thisPageId) { eval("document.getElementById(activeItem).style.color = '#fff'"); }
		eval("document.getElementById('linea').style.left = '-1000px'");
	}
	activeSub = subId;
	activeItem = thisId;
	/**/
	var x = 0;
	var y = 0;
	if(onlyOpen.arguments.length < 4){
		while( thisRef.offsetParent != null ) {
			y +=thisRef.offsetTop;
			x += thisRef.offsetLeft;
			thisRef = thisRef.offsetParent;
	    }
	} else {
		x = parseInt(varX);
		y = parseInt(varY);
	}
	w = eval("document.getElementById(thisId).offsetWidth");
	l = eval("document.getElementById(subId).offsetWidth");
	h = eval("document.getElementById(thisId).offsetHeight");
	var posx = x-(l-w) + 10;
	var posy = y + h;
	var poslinea = x + w + 9;
 		
	eval("document.getElementById(thisId).style.color = '#fc3'");
	eval("document.getElementById(subId).style.left = posx + 'px'"); 
	eval("document.getElementById(subId).style.top = posy + 'px'"); 
	eval("document.getElementById('linea').style.left = poslinea + 'px'"); 
	eval("document.getElementById('linea').style.top = y + 'px'"); 
}

function closeMenu(thisId, subId){
	if (is.comp){ 
		var leftThis = eval("document.getElementById(subId).offsetLeft");
		var widthThis = eval("document.getElementById(subId).offsetWidth") + leftThis;
		var heightLink = eval("document.getElementById(thisId).offsetHeight");
		var topThis = eval("document.getElementById(subId).offsetTop") - heightLink;
		var heightThis = eval("document.getElementById(subId).offsetHeight") + heightLink + topThis;
		if(is.comp){
			if(mousex>widthThis + 0 || mousex<leftThis - 0 || mousey>heightThis + 0 || mousey<topThis){
				if ((activeSub === subId)){
					hideLinea();
				}
				hideIt(thisId, subId);
			} else {
				setTimeout('closeMenu("'+ thisId + '","' + subId + '");', 1500);
			}
		}
	}
}

function hideIt(thisId, subId){
	if (thisId != thisPageId){ eval("document.getElementById(thisId).style.color = '#fff'"); }
	eval("document.getElementById(subId).style.left = '-1000px'");
}

function hideLinea(){
	eval("document.getElementById('linea').style.left = '-1000px'");
}

// --- IMAGE PRELOAD ---

function preloadImages() { 
	if (document.images) {
		var imgStr = preloadImages.arguments;
		if (!document.preloadArray) document.preloadArray = new Array();
		var n = document.preloadArray.length;
		for (var i=0; i<preloadImages.arguments.length; i++) {
			document.preloadArray[n] = new Image;
			document.preloadArray[n].src = imgStr[i];
			n++;
		} 
	}
}

// script voor homepages ---------- Kies tabblad in 3e kolom gele rij;
function showTab(n){
	if(is.comp){
		for(var i=0; i<threeTabs.length; i++){
			(i==n ) ? 
			eval("document.getElementById(threeTabs[i]).style.visibility = 'visible'") : 
			eval("document.getElementById(threeTabs[i]).style.visibility = 'hidden'");
		}
	}
}

function capMouse(){
	if (is.comp && (!(is.ie4comp))) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getMouseXY;
}
	
//-->