	//jarle - function to capture a parameter
	function getURLParam(strParamName){
	  var strReturn = "";
	  var strHref = location.href;
		  if ( strHref.indexOf("?") > -1 ){
			var strQueryString = strHref.substr(strHref.indexOf("?"));
			var aQueryString = strQueryString.split("&");
			for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
				  if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
					var aParam = aQueryString[iParam].split("=");
					strReturn = aParam[1];
					break;
				  }
			}
	  }
	  return strReturn;		
	} 

	if(!window.Node){
		var Node = {ELEMENT_NODE : 1, TEXT_NODE : 3};
	}
	function checkNode(node, filter){
		return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());
	}
	function getChildren(node, filter){
		var result = new Array();
		var children = node.childNodes;
		for(var i = 0; i < children.length; i++){
			if(checkNode(children[i], filter)) result[result.length] = children[i];
		}
		return result;
	}
	function getChildrenByElement(node){
		return getChildren(node, "ELEMENT_NODE");
	}
	function getFirstChild(node, filter){
		var child;
		var children = node.childNodes;
		for(var i = 0; i < children.length; i++){
			child = children[i];
			if(checkNode(child, filter)) return child;
		}
		return null;
	}
	function getFirstChildByText(node){
		return getFirstChild(node, "TEXT_NODE");
	}
	function getNextSibling(node, filter){
		for(var sibling = node.nextSibling; sibling != null; sibling = sibling.nextSibling){
			if(checkNode(sibling, filter)) return sibling;
		}
		return null;
	}
	function getNextSiblingByElement(node){
		return getNextSibling(node, "ELEMENT_NODE");
	}
	
	// ||||||||||||||||||||||||||||||||||||||||||||||||||
	// Menu Functions & Properties
	
	var activeMenu = null;
	var groupID = null; //jarle
	
	function showMenu(){

		if(activeMenu){
			activeMenu.className = "inactive";
			getNextSiblingByElement(activeMenu).style.display = "none";
		}
		if(this == activeMenu){
			activeMenu = null;
		}else{
			this.className = "active";
			getNextSiblingByElement(this).style.display = "block";
			activeMenu = this;
		}
	}
	function initMenu(){
		var menus, menu, text, a, i;
		menus = getChildrenByElement(document.getElementById("cssmenu"));
		for(i = 0; i < menus.length; i++){			
			menu = menus[i];
			text = getFirstChildByText(menu);
			a = document.createElement("a");
			menu.replaceChild(a, text); 
			a.appendChild(text);			
			
			if (i+1 == 1) a.href = "004.htm";		
			else if (i+1 == 2) a.href = "014.htm";	
			else if (i+1 == 3) a.href = "022.htm";	
			else if (i+1 == 4) a.href = "026.htm";	
			else if (i+1 == 5) a.href = "045.htm";	
			else if (i+1 == 6) a.href = "051.htm";	
			else if (i+1 == 7) a.href = "061.htm";	
				
			//if (i+1 == 3) a.href = "004.htm";	
			else  a.href = "#";	
			a.className = "inactive";
			//if (getURLParam("ch") == i+1) { //jarle
			if (chapter == i+1) { //jarle
				getNextSiblingByElement(a).style.display = "block"; 
				a.className = "active";
				activeMenu = a;
			}
						
			//a.onclick = showMenu;
			//a.onfocus = function(){this.blur()};
			
			
		}
		function trim(s) {
		  while (s.substring(0,1) == ' ') 
		  {
			s = s.substring(1,s.length);
		  }
		  while (s.substring(s.length-1,s.length) == ' ') 
		  {
			s = s.substring(0,s.length-1);
		  }
		  return s;
		}

	
	}
	if(document.createElement) window.onload = initMenu;