function SetActiveMenuItem(itemId)
{
    var item = document.getElementById(itemId);
    
    if(item!=null)
    {
        //item.firstChild.style.fontWeight = "bold";
        ShowMenu(item.parentNode.parentNode.firstChild);
    }
}
function SetActiveThirdMenuItem(itemId)
{
    var item = document.getElementById(itemId);
    
    if(item!=null)
    {
        item.firstChild.style.fontWeight = "bold";
        ShowThirdMenu(item.parentNode.parentNode.firstChild);
    }
}

function ShowMenu(sender)
{
    var list = getElementsByClassName(sender.parentNode, "Second");
    for (var i = 0; i < list.length; i++) 
    {
        list[i].style.display = "block";
    }    
	sender.onclick = function() {HideMenu(sender)}	
}
function HideMenu(sender)
{
    var list = getElementsByClassName(sender.parentNode, "Second");
    for (var i = 0; i < list.length; i++) 
    {
        list[i].style.display = "none";
    }    
	sender.onclick = function() {ShowMenu(sender)}
}

function ShowThirdMenu(sender)
{
    var list = getElementsByClassName(sender.parentNode, "Third");
    for (var i = 0; i < list.length; i++) 
    {
        list[i].style.display = "block";
    }    
	sender.onclick = function() {HideThirdMenu(sender)}	
}
function HideThirdMenu(sender)
{
    var list = getElementsByClassName(sender.parentNode, "Third");
    for (var i = 0; i < list.length; i++) 
    {
        list[i].style.display = "none";
    }    
	sender.onclick = function() {ShowThirdMenu(sender)}
}
function getElementsByClassName(sender,cl) 
{
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = sender.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) 
    {
        var classes = elem[i].className;
        if (myclass.test(classes)) retnode.push(elem[i]);
    }
    return retnode;
}; 
function RemoveTextNode(startBrother)
{
  endBrother=startBrother;
  if(endBrother!=null)
  {  
      while(endBrother.nodeType!=1)
      {
        endBrother = endBrother.nextSibling;
      }
  }
  return endBrother;
};

