<!--

function init() { 
	captureMouse();
	defineActiveMenu();
}

var Opera = window.opera ? true : false;

// ----------------------- CLIENT-CHECK
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))
	// IE 5 or 5.5
	this.ie555 = (agt.indexOf('msie 5.5') != -1);
	//Safari
	this.isSafari = (agt.indexOf('safari') != - 1);
	this.versionMinor = parseFloat(navigator.appVersion); 
	this.isSafari10 = ((this.isSafari) && (this.versionMinor < 87));
	//Mozilla
	this.moz = ((agt.indexOf('mozilla') != -1)&& (agt.indexOf('gecko') != -1) && (agt.indexOf('netscape') == -1));
	// 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();

// ----------------------- 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++;
		} 
	}
}

// ----------------------- MENU FUNCTIONS
var active_menu = -1;

var all_menus = new Array()
all_menus[0] = new Array('submenu_reizigers', 'reizigers', '#FF7300');
all_menus[1] = new Array('submenu_bedrijven', 'bedrijven', '#3DA855');
all_menus[2] = new Array('submenu_over_gvb', 'over_gvb', '#F54D42');

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 captureMouse()
// Purpose : triggers the function getMouseXY() on initialisation of the body
function captureMouse(){
	if (is.comp && (!(is.ie4comp))) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getMouseXY;
}

// Function defineActiveMenu()
// Purpose : translates the page-id into an integer (the corresponding array index for all_menus)
function defineActiveMenu(){
	var a = document.getElementsByTagName('BODY')[0].id;
	switch ( a ) {
		case "voor_reizigers":
			active_menu = 0;
			break;
		case "voor_bedrijven":
			active_menu = 1;
			break;
		case "voor_overgvb":
			active_menu = 2;
			break;
		case "voor_home":
			active_menu = 3;
			all_menus[3] = new Array('submenu_home', 'home', '#FFF');
		break;
	}
}


// Function menuOff
// Purpose : checks with intervals if mouse is on submenu. If not function hideMenu() is triggered
function menuOff(n) {
	if (is.comp) {
		var scrollTopPage;
		var t = document.getElementById('container').offsetTop + 150; //update berekening i.v.m. mogelijke fontvergroting
		var w = 0;
		if ( document.getElementById(all_menus[n][0]) )
		{
		 w = document.getElementById(all_menus[n][0]).offsetWidth; //update berekening i.v.m. mogelijke fontvergroting
		}
		var wMenu = document.getElementById('menu').offsetWidth; //update berekening i.v.m. mogelijke fontvergroting
		if (wMenu > w) { w = wMenu; }
		if( typeof( window.innerHeight ) == 'number' ) {
			//Non-IE
			scrollTopPage = window.pageYOffset;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
			//IE 6+ in 'standards compliant mode'
			scrollTopPage = document.documentElement.scrollTop;
		} else if( document.body && document.body.clientHeight ) {
			//IE 4 compatible
			scrollTopPage = document.body.scrollTop;
		}
		if (mouseY > t || scrollTopPage > t || mouseX > w ) {
			hideMenu(n);
		} else {
			setTimeout('menuOff("' + n + '")',1500);
		}
		return true;
	}
}

// Function showMenu
// Purpose : sets selected submenu to display block and activates hideAll
function showMenu(n) {
	hideAll();
	
	if ( document.getElementById(all_menus[n][0]) )
	{
	    if(!(all_menus[n][0] == all_menus[active_menu][0]))
	    { 
		    document.getElementById(all_menus[active_menu][1]).style.borderBottom = '0px solid #FFF'; 
		    document.getElementById(all_menus[n][1]).style.borderBottom = '0px solid #FFF ';
		}		
	    else
	    {
	        document.getElementById(all_menus[active_menu][1]).style.borderBottom = '0px solid #FFF';
	    }
	
	    document.getElementById(all_menus[n][0]).style.display = 'block';	
	    if(Opera)
	    {
	        document.getElementById(all_menus[n][0]).style.display = 'block !important';
	    }
	}
	    
	return true;
}

// Function hideMenu
// Purpose : sets selected submenu to display none
function hideMenu(n) {
	
	if ( document.getElementById(all_menus[n][0]) )
	{
	    if(!(all_menus[n][0] == all_menus[active_menu][0]))
	    {		
		    document.getElementById(all_menus[n][1]).style.borderBottom = '0px solid #FFF'; 
		    document.getElementById(all_menus[n][0]).style.display = 'none';	
		    if(Opera)
		    {
		        document.getElementById(all_menus[n][0]).style.display = 'none !important';
		    }
		    showMenu(active_menu);
	    }
	}
	
	return true;
}

// Function hideAll
// Purpose : sets all of the submenus to display none
function hideAll() {
	for(var i=0; i<all_menus.length; i++)
	{
		if ( document.getElementById(all_menus[i][0]) )
		{
		    document.getElementById(all_menus[i][1]).style.borderBottom = '0px solid #FFF'; 
		    document.getElementById(all_menus[i][0]).style.display = 'none';
		    if(Opera)
		    {
		        document.getElementById(all_menus[i][0]).style.display = 'none !important';
		    }
		}
	}
	return true;
}

//-->