var container="menu";
var menuitem="dt";
var menucontents="dd";
var nested=true;
var single=false;
/* ************************************************************************** */
function togglelayer(e)
{
  var t=null,obj=null;

  if(single&&(!nested)) hidealllayers(container);

  if(document.all) t=event.srcElement;
  else t=e.target;

  while((t)&&(t.className!="closed")&&(t.className!="opened"))
    t=t.parentElement;

  if(t) obj=t.nextSibling;

  if(nested==true)
   while((obj)&&(obj.className!="contents"))
    obj=obj.nextSibling;

  if(obj)
    if(obj.style)
      if(obj.style.display)
  {
    what=(""+obj.style.display).toLowerCase();
    if(what=="block")
    {
      t.className="closed";
      obj.style.display="none";
    }
    else
    {
      t.className="opened";
      obj.style.display="block";
    }
  }

  if(navigator.appName=="Microsoft Internet Explorer")
  {
    if(event)
    {
      event.cancelBubble=true;
      event.returnValue=false;
    }
  }
}
/* ************************************************************************** */
function hidealllayers(id)
{
  var root=null,obj=null,i=0;

  root=document.getElementById(id);

  obj=root.getElementsByTagName(menuitem);
  for(i=0; i<obj.length; i++)
  {
    obj[i].className="closed";
  }

  obj=root.getElementsByTagName(menucontents);
  for(i=0; i<obj.length; i++)
  {
    obj[i].style.display="none";
  }
}
/* ************************************************************************** */
function showalllayers(id)
{
  var root=null,obj=null,i=0;

  root=document.getElementById(id);

  obj=root.getElementsByTagName(menuitem);
  for(i=0; i<obj.length; i++)
  {
    obj[i].className="opened";
  }

  obj=root.getElementsByTagName(menucontents);
  for(i=0; i<obj.length; i++)
  {
    obj[i].style.display="block";
  }
}
/* ************************************************************************** */
function setuplayers(id)
{
  var root=null,obj=null,i=0;

  container=id;
  root=document.getElementById(container);

  obj=root.getElementsByTagName(menuitem);
  
  for(i=0; i<obj.length; i++)
  {
    if((obj[i].className.length)<1)
    {
      obj[i].className="closed";
      if(document.all)
        obj[i].onclick=togglelayer;
      else
        obj[i].addEventListener("click", togglelayer, true);
    }
  }

  //if(navigator.userAgent.indexOf("Opera")>=0) return;
  obj=root.getElementsByTagName(menucontents);
  for(i=0; i<obj.length; i++)
  {
    if((obj[i].className.length)<1)
    {
      obj[i].className="contents";
      obj[i].style.display="none";
    }
  }
}
/* ************************************************************************** */
