// -------------------------------- configuration constants --------------------------------
	var borderCol = "#073080"
	var textHiCol = "#FFFFFF"
	var textLoCol = "#023282"
	var backLoCol = "#DAE3F2"
	var backHiCol = "#D3070A"
	/*
	var borderCol = "#073080"
	var textHiCol = "#D3070A"
	var textLoCol = "#FFFFFF"
	var backLoCol = "#D3070A"
	var backHiCol = "#B6C5DC"
	*/
	
	var markEnable = 1; //1 activates the text and background marking completely (much faster)
	
	var menuAutoPos = 0; //1 activates the menu position approximation (slower)
	var menuMinWidth = 147; // minimal menu width
	var menuMaxWidth = 147 // maximal menu width "100%" for free-sizing menus
	var menuHeight = 26;
	var menuPosX = -24;
	var menuPosY = -157;
	var subMenuShift = 0;
	var menuCloseDelay = 1024;
	var noDelay = 0;
	var menuShowDelay = 256;
	var rootFolder = "/"
	var iconWidth = 1
	

//------------------- Ternary functions (functions that *manage* the secondary functions) ---------------------------------
	var mouseisovermenu = 0;
	var closerequestset = 0;
	var opentimeout = 0;
	var curblock = 0;
	var noclose = 0;

	function closemenus(exception){
		if (content && noclose==0){
			if (content.inits==1){content.hideall();}
    	}
		if (menu && noclose==0){
			if (menu.inits==1){menu.redrawMenu(exception);}
		}
	noclose=0
	}
	
	function openmenu(setblock){
	var retry = 0;
	curblock = setblock;
	mouseisovermenu = 1; //it's not to disappear again immediately
		if (menu){   //hide highlighted buttons, then shows the proper button
			if (menu.inits==1){menu.redrawMenu(curblock);}else{retry=1;}
    	}else{
		retry=1;
		}
		if (content){  //hide open no second level menus, then open the proper first level menu
			if (content.inits==1){content.showExclusive(setblock);}else{retry=1;}
    	}else{
		retry=1;
		}
		if(retry == 1 && opentimeout == 0){ //if there's a problem reaching the content frame. try again in a second
			opentimeout = 1;
			setTimeout('opentimeout=0;openmenu(curblock)',1024)
		}
	}

	function menushouldclose(){
		if(closerequestset==0){
			setTimeout('menuwillclose()',menuCloseDelay)
			closerequestset=1;
		}
		mouseisovermenu=0;
	}
	
	function menuwillclose(){
		if (mouseisovermenu==0){
			branchTrance = TraceBranch(curID)
			cID = branchTrance[1]
			closemenus(cID)
		}
		closerequestset=0;
	}
	
	
	
	//------------------ menu layers creation -------------------------
	
	function writeMenus(){
	if(menuAutoPos==1){aproximateMenuPos(0,0,menuMinWidth,menuHeight)}
	writeString = "\n"

		for (i=0 ;i<DBarray.length;i++){ //---------------- writing all menu blocks
			if(hasChild(i)==1){
				menuOrder = FilterContent(1,i,8)
				menuIndex = OrderContent(FilterContent(1,i,0),menuOrder)
				menuYpos = OrderContent(FilterContent(1,i,6),menuOrder)
				menuXpos = OrderContent(FilterContent(1,i,7),menuOrder)
				menuURLs = OrderContent(FilterContent(1,i,3),menuOrder)
				menuTargets = OrderContent(FilterContent(1,i,4),menuOrder)
				menuIcons = OrderContent(FilterContent(1,i,5),menuOrder)
				menuName = OrderContent(FilterContent(1,i,10),menuOrder)
				menuItems = OrderContent(FilterContent(1,i,2),menuOrder)
				var menuItemsLength = menuItems.length; // the length of the array according to javascript
		
				if 		(n==1)	{writeString = writeString+ "<layer name=\"blockDiv"+i+"\" pagex=\""+menuXpos[0]+"\" pagey=\""+menuYpos[0]+"\" z-index=\"4\" visibility=\"hide\">\n";}
				else if	(ie==1 || m==1){writeString = writeString+ "<DIV ID=\"blockDiv"+i+"\" STYLE=\"position:absolute; left:"+menuXpos[0]+"px; top:"+menuYpos[0]+"px; z-index:4; visibility:hidden;\" class=\"semitransparant\">\n";}
		
						writeString = writeString+ "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td bgcolor=\""+borderCol+"\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
	
						for(tellerB=0; tellerB < menuItemsLength; tellerB++){ // --------------- writing all items in a block
							subItem = menuIndex[tellerB]
							
							//---- (re)defining the building-blocks
							var lineTableStart = "<tr><td><table width=\""+menuMaxWidth+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\""+backLoCol+"\" id=\"tb"+menuIndex[tellerB]+"\" style=\"cursor:hand;\"><tr valign=\"middle\">\n"
							var lineTableStartNS = "<tr><td><table width=\""+menuMaxWidth+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\""+backLoCol+"\" id=\"tb"+menuIndex[tellerB]+"\"><tr valign=\"middle\">\n"
							var lineTableEnd  = "</tr></table></td></tr>\n"
							var lineMouseover = "onMouseOver=\"parent.mouseisovermenu=1;showExclusive("+menuIndex[tellerB]+");markExclusive("+menuIndex[tellerB]+");\" 	onMouseOut=\"unmarkExclusive("+menuIndex[tellerB]+");parent.menushouldclose()\""
							if(menuTargets[tellerB]=="_blank"){
								var lineLCellStart = "<td width=\""+menuMaxWidth+"\" onClick=\"w=window.open('"+menuURLs[tellerB]+"?ID="+menuIndex[tellerB]+"','pop"+tellerB+"','');w.focus()\" "+lineMouseover+"><nobr>\n"
								var lineRCellStart = "<td width=\""+iconWidth+"\" align=\"right\" onClick=\"w=window.open('"+menuURLs[tellerB]+"?ID="+menuIndex[tellerB]+"','pop"+tellerB+"','');w.focus()\" "+lineMouseover+"><nobr>\n"
								var lineLinkstart = "<a href=\"javascript:w=window.open('"+menuURLs[tellerB]+"?ID="+menuIndex[tellerB]+"','pop"+tellerB+"','');w.focus()\" "+lineMouseover+" class=\"menub\">\n"
							}else if(menuURLs[tellerB]=="javascript:{}"){
								var lineLCellStart = "<td onclick=\"parent.noclose=1\" "+lineMouseover+">\n"
								var lineRCellStart = "<td width=\""+iconWidth+"\" align=\"right\" onclick=\"parent.noclose=1\" "+lineMouseover+">\n"
								var lineLinkstart = "<a href=\""+menuURLs[tellerB]+"\" onclick=\"parent.noclose=1\" "+lineMouseover+" class=\"menub\">\n"
							}else{
								var lineLCellStart = "<td onClick=\"parent."+menuTargets[tellerB]+".location.href='"+menuURLs[tellerB]+"'\" "+lineMouseover+">\n"
								var lineRCellStart = "<td width=\""+iconWidth+"\" align=\"right\" onClick=\"parent."+menuTargets[tellerB]+".location.href='"+menuURLs[tellerB]+"'\" "+lineMouseover+">\n"
								var lineLinkstart = "<a href=\""+menuURLs[tellerB]+"\" target=\""+menuTargets[tellerB]+"\" "+lineMouseover+" class=\"menub\">\n"
							}
							var lineCellEnd   = "</td>\n"
							var lineIcon      = "<img src=\""+rootFolder+"images/m_"+menuIcons[tellerB]+".gif\" alt=\"\" align=\"left\" hspace=\"0\" vspace=\"0\" border=\"0\">\n"
							var lineItem      = "<span id=\"ti"+menuIndex[tellerB]+"\">"+menuName[tellerB]+"</span>\n"
							if (hasChild(subItem) == 1){
								var lineArrow ="<img src=\""+rootFolder+"images/m_pijl_leeg.gif\" alt=\"\" border=\"0\"><br>\n"
							}else{
								var lineArrow ="<img src=\""+rootFolder+"images/m_pijl_leeg.gif\" alt=\"\" border=\"0\"><br>\n"
							}
							var lineLinkend   = "</a>"
							
							//---- piecing together the items with the building-blocks
							if (n==1){
								writeString = writeString+ lineTableStartNS
								writeString = writeString+ lineLCellStart+lineLinkstart//+lineIcon
								writeString = writeString+ lineItem+lineLinkend+lineCellEnd
								writeString = writeString+ lineRCellStart+lineLinkstart+lineArrow
								writeString = writeString+ lineLinkend+lineCellEnd
								writeString = writeString+ lineTableEnd							
							}else{
								writeString = writeString+ lineTableStart
								writeString = writeString+ lineRCellStart+lineLinkstart//+lineIcon
								writeString = writeString+ lineLinkend+lineCellEnd
								writeString = writeString+ lineLCellStart+lineLinkstart+lineItem+lineLinkend+lineCellEnd
								writeString = writeString+ lineRCellStart+lineLinkstart//+lineArrow
								writeString = writeString+ lineLinkend+lineCellEnd
								writeString = writeString+ lineTableEnd
							}


						}
						writeString = writeString+ "</table></td></tr></table>\n"
			
				if (n==1){writeString = writeString+ "</LAYER>\n\n";}else if (ie==1 || m==1){writeString = writeString+ "</DIV>\n\n";}
			}
		}
	return writeString
	}
//------------------ einde foldout menus -------------------------	