var timerrun=0;
var target=null;
var m_open=null;
var allopen=0;

show= function()
{
if (typeof timerrun != "undefined") clearTimeout(timerrun);
 link = document.getElementById(target);
 link.getElementsByTagName("ul")[0].style.visibility="visible"
 m_open = target;
}

hide = function()
{
 if (target != null && allopen==0)
 {
  link = document.getElementById(target);
  link.getElementsByTagName("ul")[0].style.visibility="hidden"
  m_open=null;
  target=null;
 }
}

overout = function(link,abSH)
{
 target=link;
 if (abSH == 1)
 {
  if (m_open != null && allopen==0)
  {
   link = document.getElementById(m_open);
   link.getElementsByTagName("ul")[0].style.visibility="hidden"
  }
  show();
 }
 else
 {
   timerrun=setTimeout("hide()",400);
 }
}

closeAll = function()
{
  var li = document.getElementById("menu").getElementsByTagName("ul")[0];
  document.getElementById("expandbutton").firstChild.title="Expand All"
  document.getElementById("expandbutton").firstChild.src="images/menu_arrow_runter.gif"
  for (i=0;i<li.childNodes.length;i++)
  {
   if (li.childNodes[i].tagName != "LI") continue;
   if (li.childNodes[i].getElementsByTagName("ul")[0])
   {
    li.childNodes[i].getElementsByTagName("ul")[0].style.visibility="hidden";
   }
  }
  allopen=0;
  m_open=null;
  target=null;
}

toggleDropdown = function(event)
{
 if (!event) var event = window.event; 
 if (event.stopPropagation) {
   event.stopPropagation();
 } else {
   event.cancelBubble = true;
 } 
 var li = document.getElementById("menu").getElementsByTagName("ul")[0];
 if (allopen == 0)
 {
  document.getElementById("expandbutton").firstChild.title="Collapse All"
  document.getElementById("expandbutton").firstChild.src="images/menu_arrow_hoch.gif"
  for (i=0;i<li.childNodes.length;i++)
  {
   if (li.childNodes[i].tagName != "LI") continue;
   if (li.childNodes[i].getElementsByTagName("ul")[0])
   {
    li.childNodes[i].getElementsByTagName("ul")[0].style.visibility="visible";
   }
  }
  allopen=1;
 }
 else
 {
  closeAll();
 }
}




start= function() 
{
}
 
window.onload=start; 
 
togglePopup = function(event,link) 
{ 
 target=link; 
 if (m_open==link) 
 { 
  hide(); 
 } 
 else 
 { 
  if (m_open != null && allopen==0) 
  { 
   link = document.getElementById(m_open); 
   link.getElementsByTagName("ul")[0].style.visibility="hidden" 
  } 
  show(); 
 } 
 stopevt(event); 
} 
 
stopevt= function(event) 
{ 
if (event.stopPropagation) { 
    event.stopPropagation(); 
  } else { 
    event.cancelBubble = true; 
  }  
} 


/*document.onclick=closeAll;*/
