function toggleMenu() {
var ob = document.getElementById(
'mainMenu').style;
var status = "";
if (ob.
style.display == 'block') {
ob.
style.display = 'none';
status = 'closed';
} else {
ob.
style.display = 'block';
status = 'open';
}
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 1000*60*60*24)
setCookie('mainMenu', status, expires);
}
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString();
}
-----------------------------------
I highlighted some important changes.
As for the cookie reading: it's a lot to type, so I'll point you to my .JS file.
http://apocalypse.dkpsystem.com/settings/apocalypse/files/ActionScript.jsWhen you click that link it will download it to your computer. All my code is in there. Feel free to use and abuse it, as it isn't anything super extraordinary.
Something to note: My code basically creates a named array of objects that are Menu objects. In your case, if you are specifying the mainMenu by name, you won't need to iterate through an array of Menu names like I do. However, you WILL need to iterate through the cookie "crumbs". Each "crumb" is a name/value pair (i.e. crumb[0]/crumb[1]), so once you find your crumb you are looking for, get its value... do your thing... and break from the iteration.
FYI: The code is quick and dirty. There are some slight adjustments I could make to it to reduce the code size, but frankly, I really don't care to spend the time on it.
Anyway... besides that script, the last thing you need is a Page_Onload() function in your body tag:
<body onload="Page_onLoad()" onunload="toggleMenu()">If you have any questions, post them here.