function getMenu(){
	setMenu(readCookie("menu"));
}

function saveMenu(topic){
	document.cookie = "menu=" + topic;
	setMenu(topic);
}

function setMenu(topic){
	// disable default class and show the whole menu tree when javascript is enabled
	var obj0 = document.getElementById("menu");
	if (obj0 != null) obj0.className = "";

	// set current topic
	var obj1 = document.getElementById(topic);
	obj1.className = "currentTopic";

	// make topic visible if topic is a subtopic
	var obj2 = obj1.parentNode; // parent ul element to sub topic 
	obj2.style.display = "block";

	// set properties parent topic 
	var obj3 = obj2.parentNode;

	// makes sub topics visible if topic has sub topics 
	var objList = obj1.getElementsByTagName('ul');
	if (objList[0] != null) objList[0].style.display = "block";
}

function readCookie(name){
 	var nameEQ = name + "=";
 	var ca = document.cookie.split(';');
 	for(var i=0;i < ca.length;i++){
  	var c = ca[i];
  	while (c.charAt(0)==' ') c = c.substring(1,c.length);
  		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 	}
 	return null;
}

