var menu={

collapseMenu:function(node)
{
  if (!document.getElementById) return false;
  if (!document.getElementById("menu")) return false;
  if (!node) node = document.getElementById("menu");

  if (node.childNodes.length > 0)
  {
    //alert(node.childNodes.length) ;
    for (var i=0; i<node.childNodes.length; i++)
    {
      var child = node.childNodes[i];
      if (child.nodeName == "UL")
      {
        /*
        if (child.style.display != "block")
          child.style.display = "none";
        */
        //alert(child.className) ;
        if (child.className != "classshow")
          child.className = "classhide";
      }
      menu.collapseMenu(child);
    }
  }
},

prepareMenu:function()
{
  if (!document.getElementById || !document.getElementsByTagName) return false;
  if (!document.getElementById("menu")) return false;

  var links = document.getElementById("menu").getElementsByTagName("a");

  //alert(links.length) ;
  for (var i=0; i<links.length; i++)
  {
  	if (links[i].parentNode.getElementsByTagName("UL"))
	{
		links[i].onclick = function()
		{
			alert('x') ;
		/*
		  alert(i + "-" + links[i].href + "-" + this.parentNode.getElementsByTagName("UL")[0].className + "-" + this.parentNode.getElementsByTagName("UL").className) ;*/
		  menu.toggleMenu(this.parentNode.getElementsByTagName("UL")[0], this.href);
		  return false;
		}
	}
  }
},

prepareMenuHover:function()
{
  if (!document.getElementById || !document.getElementsByTagName) return false;
  if (!document.getElementById("menu")) return false;

  var links = document.getElementById("menu").getElementsByTagName("li");

  //alert(links.length) ;
  for (var i=0; i<links.length; i++)
  {
    if (links[i].id && links[i].id.substring(0,3)=="li2")// && links[i].id == "li2_299")
	{
		ullist = links[i].getElementsByTagName("ul");
		if (ullist)
		{
			//alert(ullist[0].id) ;
			if (ullist[0].className.search(/classhide/) == -1)
				ullist[0].className += " classhide" ;
			links[i].onmouseover=function() {
				//alert('x') ;
				/*
				x = this.className ;
				//alert(this.className) ;
				//this.className+=" over";
				this.className=this.className.replace("classhide", "classshow");
				//alert(x + "-" + this.className) ;
				alert(this.className) ;
				*/
				ullist = this.getElementsByTagName("ul");
				ullist[0].className=ullist[0].className.replace(/classhide/g, "classshow");
			}
			links[i].onmouseout=function() {
				/*
				x = this.className ;
				//alert('xxxx') ;
				this.className=this.className.replace("classshow", "classhide");
				alert(x + "-" + this.className) ;
				*/
				ullist = this.getElementsByTagName("ul");
				ullist[0].className=ullist[0].className.replace(/classshow/g, "classhide");
			}
		}
	}
  }
},

preselectMenu:function(menuid)
{	
//menuid = "ul1_100" ;
  node = document.getElementById(menuid);
  if (node)
  {
	  if (node.className.search(/classhide/) != -1)
		node.className=node.className.replace(/classhide/g, "classshow");
	  else
	  	node.className += " classshow" ;
  }
},

toggleMenu:function(node, link)
{
  if (!document.getElementById) return false;
  if (!link) return false;
  if (!node) location.href = link.href;

  menu.hideallmenu(node) ;

  if (node.className == "classhide")
  {
    node.className = "classshow";
  } 
  else 
  {
    node.className = "classhide";  
  }
},

hideonemenu:function(node)
{
if (!document.getElementById) return false;
if (!node) return false;

node.className = "classhide";
},


hideallmenu:function(currentnode)
{
  var links = document.getElementById("menu").getElementsByTagName("a");
  //alert(links.length) ;
  for (var i=0; i<links.length; i++)
  {    
     if (links[i].parentNode.getElementsByTagName("UL")[0] != currentnode)
     {
        menu.hideonemenu(links[i].parentNode.getElementsByTagName("UL")[0]) ;
     }
  }
}

//end menu
}

//addLoadEvent(menu.collapseMenu);
//addLoadEvent(menu.prepareMenu);
//addLoadEvent(menu.prepareMenuHover);
//addLoadEvent(menu.preselectMenu);