I confirmed that this is a problem, I describe the exact nature and location of the bug, and I provide the fix.
The problem is that the "getCookie" method of the ddacordion.js script uses a regular expression to match the cookie name, which results in an array of matches, and it arbitrarily uses the first match. This is only a problem when you use menu/submenu names where one is an ending substring of the other, as in the example: "expandable" and "subexpandable". For example, names like "header" and "subheader" would be problematic, but "topheader" and "subheader" would be fine.
var re=new RegExp(Name+"=[^;]+", "i") //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re).split("=") //return its value
One solution is to add a word boundary anchor to the Regex, so that only the full cookie name is matched, rather than just the end of it. Or, you could simply choose sufficiently different header class names.
Just change the line in the getCookie method in the ddaccordion.js script that defines the regular expression so that it includes the word boundary anchor "\\b" (notice escaped backslash):
var re=new RegExp("\\b"+Name+"=[^;]+", "i")