The guy who originally coded this is no longer with us and we can't seem to figure out why this code isn't working. Neither of us really know JS. I've messed with jQuery more than I've messed with straight up JS but even that is limited knowledge.

Basically this code is supposed to keep track of the left navigation so when it goes to a new page it holds the opened menus open.

Here's a snippet of HTML:
Code:
<ul id="leftnav">
		<li class="widthT1">
		
    	<div id="2042-open" style="display: none;"><a href="javascript:treeToggle('2042', 'open', '/JobSeekers/Recently_Unemployed/index.aspx');" class="orangePlus">Recently Unemployed</a></div>
    	<div id="2042-close" style="margin-bottom:10px;"><a href="javascript:treeToggle('2042', 'close');" class="orangeMinus">Recently Unemployed</a>		
    	<!--<div class="fix1"><hr class="grey1HR"/></div>-->
    		<ul class="fix4">		
      			<li>
                  <div id="2063-open" style="display: none;"><a href="javascript:treeToggle('2063', 'open', '/JobSeekers/Recently_Unemployed/Apply_for_Unemployment_Insurance_Benefits/index.aspx');" class="orangePlusGT2">Apply for Unemployment Insurance Benefits</a></div>
                  <div id="2063-close"><a href="javascript:treeToggle('2063', 'close');" class="orangeMinusGT2">Apply for Unemployment Insurance Benefits</a>

     	          <!--<div class="fix2"><hr class="grey2HR"/></div>-->
                    <ul>
The above is repeated but that should be enough to show you what it's doing?

Here's the JS:
Code:
function getTreeStateArray()
{
    var empty = new Array();

    var soc = document.cookie.indexOf("treestate=");
    if(soc != -1)
    {
        var eoc = document.cookie.indexOf("-", soc);
        if(eoc == -1)
            eoc = document.cookie.length;

        return(unescape(document.cookie.substring(soc+10, eoc)).split("-"));
    }
    return(empty);
}

function setTreeStateArray(treeState)
{
    document.cookie = "treestate=" + escape(treeState.join("-"));
}

function restoreTreeState(treeID)
{
    var treestate = getTreeStateArray();
    var i, j, treeNodeName, treeElements;

    treeElements = document.getElementById(treeID).getElementsByTagName("div");
    for(i = 0; i < treeElements.length; i++)
    {
        var sosuffix = treeElements[i].id.indexOf('-close');
        if(sosuffix == -1)
            sosoffix = treeElements[i].id.indexOf('-open');
        if(sosuffix != -1)
        {
            var nodeName = treeElements[i].id.substring(0, sosuffix);
            var found = false;

            for(j = 0; j < treestate.length; j++)
            {
                if(treestate[j] == nodeName)
                    found = true;
            }
            if(found == true)
            {
                document.getElementById(nodeName + '-open').style.display = 'none';
                document.getElementById(nodeName + '-close').style.display = 'block';
            }
            else
            {
                document.getElementById(nodeName + '-open').style.display = 'block';
                document.getElementById(nodeName + '-close').style.display = 'none';
            }
        }
    }
}

function removeNodeFromTreeState(nodeName)
{
    var treestate = getTreeStateArray();
    var newTreeState = new Array();
    var i, treeNodeName;

    for(i = 0; i < treestate.length; i++)
    {
        treeNodeName = treestate[i];
        if(treeNodeName != nodeName)
            newTreeState.push(treeNodeName);
    }
    setTreeStateArray(newTreeState);
}

function addNodeToTreeState(nodeName)
{
    var treestate = getTreeStateArray();
    var newTreeState = new Array();
    var i, treeNodeName;

    for(i = 0; i < treestate.length; i++)
    {
        treeNodeName = treestate[i];
        if(treeNodeName == nodeName)
            return;
        newTreeState.push(treeNodeName);
    }
    newTreeState.push(nodeName);
    setTreeStateArray(newTreeState);
}

function treeToggle(treeNodeName, treeNodeState, followLink)
{
   if(treeNodeState == 'open')
   {
       addNodeToTreeState(treeNodeName);
       document.getElementById(treeNodeName + '-open').style.display =
'none';
       document.getElementById(treeNodeName + '-close').style.display =
'block';
	if(typeof(followLink) != 'undefined')
           window.location.href = followLink;
   }
   else
   {
       removeNodeFromTreeState(treeNodeName);
       document.getElementById(treeNodeName + '-open').style.display =
'block';
       document.getElementById(treeNodeName + '-close').style.display =
'none';
   }
}
What happens is it remembers the first thing you click on, but nothing more. We looked at the cookie value and it seems to be right. 4digit number followed by - followed by 4 more digits etc etc (0000-0001-0002 etc)

If anyone could help that would be wonderful.

Thanks for any and all help,
Justin