function resetMenu()
{
    var frame = top.document.getElementById('contentwrapper');
        
    var menus = frame.getElementsByTagName("DIV")
    var cnt = 0;
	
    for(var i in menus) 
    {
        var menu = menus[i];
        if(menu.className=="innerMenu") 
        {
            if(menu.style.display=="block") 
            {
                menu.style.display="none"
            }
	}
	if(menu.className=="leftMenu_on") 
        {
            menu.className="leftMenu"
	}
    }
}

function openMenu(id, topId, fade) 
{
    if(fade == null)
    {
        fade = true;
    }
    var frame = top.document.getElementById('contentwrapper');
        
    var menus = frame.getElementsByTagName("DIV")
    var cnt = 0;
	
    for(var i in menus) 
    {
        var menu = menus[i];
        if(menu.className=="innerMenu") 
        {
            if(menu.style.display=="block") 
            {
                menu.style.display="none"
            }
	}
	if(menu.className=="leftMenu_on") 
        {
            menu.className="leftMenu"
	}
    }
	
    top.document.getElementById(topId).className="leftMenu_on";
    top.document.getElementById(id).style.display="block";
    if(fade == true)
    {
        fadeInMenu(id,0);
    }
}

function fadeInMenu(objId,opacity) 
{
  // play with these numbers to adjust the smoothness and speed
  // at whih the images fades
  var opacityFactor = 10 // lower=smoother, higher='choppier'
  var timeoutFactor = 20 // lower=faster, higher=slower
  
  if (top.document.getElementById) 
  {
    var obj = top.document.getElementById(objId);
    if (opacity <= 100) 
    {
      setOpacity(obj, opacity);
      opacity += opacityFactor;
      window.setTimeout("fadeInMenu('"+objId+"',"+opacity+")", timeoutFactor);
    }
  }
}

function selectThis(This) 
{
    var frame = top.document.getElementById('contentwrapper');
    var links = frame.getElementsByTagName("A")
	
    for(var i in links) 
    {
        if(links[i].className=="menuLink") 
        {			
            if(links[i].parentNode.childNodes[0].tagName=="SPAN") 
            {
                links[i].parentNode.childNodes[0].innerHTML=""
            }
        }
    }
        
    This.parentNode.childNodes[0].innerHTML = ">> "
    This.blur()
}

function updateMenu(tier1, tier2, tier3)
{
    // We open the menu with a requirement not to do a fade. The 
    // fade code is not playing nice with a call from a different frame
    // to the one the menu resides in. Since all calls from the right frame
    // do not require a change of the first tier this is not necessary 
    // anyway.
    openMenu(tier2, tier1, false);
    selectThis(top.document.getElementById(tier3));
}



/*
 * This function makes a clicked-on top menu to be "selected"
 * by resetting the class names and then setting a "selected" 
 * class name when the menu is clicked on
 */
function selectTopMenu(This) 
{
    // these are the IDs of the top menu <li> tags
    var topMenus = new Array("one","two","three","four")  
    
    for(var i in topMenus) 
    {
        document.getElementById(topMenus[i]).className=""
    }
    
    // "This" is actualy the <a> tag, the parent node is the <li>,
    // the style of which needs to be set
    This.parentNode.className = "selectedTopMenu"
    This.blur()
}














