// Initiate menu array
var menuArray = new Array();
menuArray[1] = 'a';
menuArray[2] = 'b';
menuArray[3] = 'c';
menuArray[4] = 'd';
menuArray[5] = 'e';
menuArray[6] = 'f';
menuArray[7] = 'g';


leftmenulength = 0;			// Length of flyout string at start 
flyoutlength = 0;				// Length of flyout string at start 
	

/* Settings for microsite header */

var complete_string = ""; 		// String used for debugging purposes


var currSection = ""; 			// The section which is currently active (clicked)
var menuDown = "";				// The section which is currently highlighted (mouseover)
var dropDown = 0;
var hideMenu = 0;
var buttonOff = 0;
var section = '';


/*
****************************
***** General settings *****
****************************
*/
var browser = new BrowserDetect();
var useIframe = (browser.isIE5up &&  (!browser.isIE5x || browser.isIE55)); // Boolean to set use of iframe behind layers, only IE 5.5 or higher

var menu_hide_delay = 600; 		// Delay of hiding all drop-down menus on a mouseout of the top-menu
var dropdown_show_delay = 200;	// Delay of showing the drop-down menu on a mouseover

var max_item_levels = 7;		// Max number of levels in the left menu, excluding flyouts
var max_menu_levels = 7;		// Max number of levels in the left menu, including flyouts	
var topmenu_dd_spacer = 6;		// Vertical space between the topmenu buttons and the corresponding dropdowns

var intTableCount = 0;
var tabTables = new Array();	// Tabbed table array

var arrLoad = new Array();		// Onload array
document.onmouseover = hideAllMenus;


	/*
	**********************************
	******* Top menu functions *******
	**********************************
	*/
	
	// Fired on mouseover of a section
	function sectionOn(sect, event){
		event.cancelBubble = true;

		hideOtherMenus(sect);
		if(menuDown != sect){
			clearTimeout(dropDown)
			clearTimeout(buttonOff);
			sectionButtonOn(sect);
			menuDown = sect;
			section = sect;
		}
	}

	// Fired on mouseout of a section
	function sectionOff(sect){				
		if(sect != section){
			sectionButtonOff(sect)
		}
	}

	// This function sets the style of section 'sect' to active
	function sectionButtonOn(sect){
		var td = document.getElementById(sect + "button")
		// Set style of this TD to 'active'		
//		alert(sect+"on");
		applyStyle(td, sect+"on");		
	}

	
	// This function sets the style of section 'sect' to inactive 
	function sectionButtonOff(sect){
		var td = document.getElementById(sect + "button")
		if(sect != currSection){
//			alert (sect + "button");
			if (td!=null) {
			if (td.getAttribute("className") != "navbutton") {
				applyStyle(td, "navbutton");
			}
			}
		}
	}	

	
	
	// This function hides all menu's with a delay of 'menu_hide_delay' (see general settings)
	function hideAllMenus() {
//		clearTimeout(dropDown);
//		hideMenu = setTimeout('hideIt()', menu_hide_delay);	
		for(counter=1;counter<menuArray.length;counter++) {
			sectionButtonOff(menuArray[counter]); };

		menuDown = "";
	}


	// 	This function hides all menu's except the menu of the section 'skipSect'
	function hideOtherMenus(skipSect) {
		for(counter=1;counter<menuArray.length;counter++) {
			if(menuArray[counter] != skipSect){
				sectionButtonOff(menuArray[counter]);
				
				// Hide drop-down menu 
//				hideDD(menuArray[counter]);
			}		
		}
	}

	// 	This function hides all menu's except the one that's currently active
	function hideIt(){
		for(counter=1;counter<menuArray.length;counter++) {
			if(menuArray[counter] != menuDown){
				sectionButtonOff(menuArray[counter]);
						
				/* Hide menu */
				hideDD(menuArray[counter]);
			}
		}
	}





	
	// This function returns the X position of 'objElement'
	function getLeftPos(objElement) {
		var offsetLeft = findPosX(objElement);
		return offsetLeft - 2;
	}

	
	// This function returns the Y position of 'objElement'
	// Note: instead of returning the top of the object, the bottom is returned!
	function getTopPosBottom(objElement) {
		var offsetTop = 0;
		var adjust = 0;
		
		// Onderstaand kan netter
		if(objElement.offsetHeight!=33){
			// 33 is height of top menu (return bottom of object). Return top of object for rest.
			if(objElement.offsetHeight==34){
				// Two lines in flyout
				adjust = objElement.offsetHeight - 18;
			}
			else{
				adjust = objElement.offsetHeight - 20;
			}		
		}
		return findPosY(objElement) + objElement.offsetHeight - adjust;
	}

	// This function applies the style-class 'className' to the element 'elementId'
	
	function applyStyle(elementId, className) {
		if(browser.isIE){
			elementId.setAttribute("className", className);
		} else {
			elementId.setAttribute("class", className);
		}
	}

		// This function performs an extensive browser detection and stores 
	// all data in an object for later use.		
	function BrowserDetect() {
   		var ua = navigator.userAgent.toLowerCase(); 

   		// browser engine name
   		this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
		this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   		// browser name
		this.isOpera       = (ua.indexOf('opera') != -1);
   		this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   		this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   		this.isFirebird    = (ua.indexOf('firebird/') != -1);
   		this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   		// spoofing and compatible browsers
   		this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   		this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
		// rendering engine versions
   		this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   		this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   
   		// browser version
		this.versionMinor = parseFloat(navigator.appVersion); 
   
   	   	// correct version number
   		if (this.isGecko && !this.isMozilla) {
      		this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   		}
   		else if (this.isMozilla) {
      		this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   		}
	   	else if (this.isIE && this.versionMinor >= 4) {
      		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   		}
   
   		this.versionMajor = parseInt(this.versionMinor); 
   
   		// dom support
   		this.isDOM1 = (document.getElementById);
  		this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   		// css compatibility mode
   		this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   		// platform
   		this.isWin    = (ua.indexOf('win') != -1);
   		this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   		this.isMac    = (ua.indexOf('mac') != -1);
   
   		// specific browser shortcuts
   		this.isNS6x = (this.isNS && this.versionMajor == 6);
   		this.isNS6up = (this.isNS && this.versionMajor >= 6);
   		this.isNS7x = (this.isNS && this.versionMajor == 7);
   		this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   		this.isIE5x = (this.isIE && this.versionMajor == 5);
   		this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   		this.isIE5up = (this.isIE && this.versionMajor >= 5);
   		this.isIE6x = (this.isIE && this.versionMajor == 6);
   		this.isIE6up = (this.isIE && this.versionMajor >= 6);
	}

