<!-- 
//Copyright (C) Jackie Niebling 2004, modified by Thomas Papenmeier 2006
//This rubbish is of course public domain.
var multipleMenusOpen = false;

var plus = 'http://www.shadowmeretales.com/images/plus.png';
var minus = 'http://www.shadowmeretales.com/images/minus.png';

function menu(id) {
   var element = document.getElementById(id);
   if (element.style.display == 'block') {
      element.style.display = 'none';
	  document.getElementById(id + 'img').src = plus;
	  clearLastPosition();
   } else {
      if (!multipleMenusOpen) { closeAllMenus() };
	  	 openMenu(id);
	     element.style.display = 'block';
		 document.getElementById(id + 'img').src = minus;
		 setLastPosition(id);
   }
}

function openMenu(linkName) {
   document.getElementById(linkName).style.display = 'block';
   document.getElementById(linkName + 'img').src = minus;
}

function closeAllMenus() {
   var allSubs = document.getElementById("gamenavigation").getElementsByTagName("div");
   for (var i = 0; i < allSubs.length; i++) {
      allSubs[i].style.display = 'none';
   }
   
   var allSubImgs = document.getElementById("gamenavigation").getElementsByTagName("img");
   for (var i = 0; i < allSubImgs.length; i++) {
      if (allSubImgs[i].id != '') { allSubImgs[i].src = plus; }
   }
}

function setCookie(name, value, expires, path, domain, secure) {
   var curCookie = name + "=" + escape(value) +
	   ((expires) ? "; expires=" + expires.toGMTString() : "") +
       ((path) ? "; path=" + path : "") +
       ((domain) ? "; domain=" + domain : "") +
       ((secure) ? "; secure" : "");
   document.cookie = curCookie;
}

function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
       begin = dc.indexOf(prefix);
       if (begin != 0) { return null };
   } else {
       begin += 2;
   }	
   var end = document.cookie.indexOf(";", begin);
   if (end == -1) { end = dc.length; }
    
   return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
   if (getCookie(name)) {
       document.cookie = name + "=" +  
       ((path) ? "; path=" + path : "") +
       ((domain) ? "; domain=" + domain : "") +
       "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}

var positionCookie = "menuPosition";

function setLastPosition(linkName) {
   clearLastPosition();
   setCookie(positionCookie, linkName, '', '', '', '');
}

function clearLastPosition() {
   deleteCookie(positionCookie, '', '');
}

function getLastPosition() {
   var linkName = getCookie(positionCookie);
   if (linkName != null) {
       openMenu(linkName);
   }
}
-->
