function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p.className = "active";

  var top  = (c["at_position"] == "y") ? p.offsetHeight : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth  : 0;

  for (; p; p = p.offsetParent)
  {
    if (p.style.position != 'absolute')
    {
			left += p.offsetLeft;
      top  += p.offsetTop;
    }
  }
	
  c.style.position   = "absolute";
  c.style.top        = (top - c.clientHeight - 21) +'px';
  c.style.left       = left +'px';
  c.style.visibility = "visible";
}

function at_hide_aux(parent, child)
{
  document.getElementById(parent).className = "parent";
  document.getElementById(child).style.visibility = "hidden";
}

function at_show_pwel()
{
  c = document.getElementById(this["at_child" ]);
	this.style.backgroundImage='url(/pic/backgrounds/kopmenu_bg_active.png)';
	this.style.cursor='pointer';
  at_show_aux(this.id, c.id);
  clearTimeout(c["at_timeout"]);
}

function at_show_pniet()
{
  c = document.getElementById(this["at_child" ]);
  at_show_aux(this.id, c.id);
  clearTimeout(c["at_timeout"]);
}

function at_show_c()
{
  p = document.getElementById(this["at_parent"]);
  at_show_aux(p.id, this.id);
  clearTimeout(this["at_timeout"]);
}

function at_hide_pwel()
{
  c = document.getElementById(this["at_child" ]);
	this.style.backgroundImage='none';
	this.style.cursor='default';
  c["at_timeout"] = setTimeout("at_hide_aux('"+this.id+"', '"+c.id+"')", 300);
}

function at_hide_pniet()
{
  c = document.getElementById(this["at_child" ]);
  c["at_timeout"] = setTimeout("at_hide_aux('"+this.id+"', '"+c.id+"')", 300);
}

function at_hide_c()
{
  p = document.getElementById(this["at_parent"]);
  this["at_timeout"] = setTimeout("at_hide_aux('"+p.id+"', '"+this.id+"')", 300);
}

function at_attach(parent, child, position)
{
  p = document.getElementById(parent);
  c = document.getElementById(child);

  p["at_child"]    = c.id;
  c["at_parent"]   = p.id;
  c["at_position"] = position;

	if (p.onmouseover != null)
	{
  	p.onmouseover = at_show_pwel;
  	p.onmouseout  = at_hide_pwel;
  }
  else
	{
  	p.onmouseover = at_show_pniet;
  	p.onmouseout  = at_hide_pniet;
  }
  c.onmouseover = at_show_c;
  c.onmouseout  = at_hide_c;
}

function dhtmlmenu_build_aux(parent, child, position)
{
  document.getElementById(parent).className = "parent";
	document.write('<div class="vert_menu" id="'+parent+'_child"><table id="'+parent+'_childtable" cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td width="24" height="9" style="width: 24px; max-width: 24px; background-image: url(/pic/backgrounds/kopvertleft.png); line-height: 9px; behavior: url(/css/iepngfix.htc);">&nbsp;</td><td id="'+parent+'_childcell" height="9" style="background-image: url(/pic/backgrounds/kopvertmid.png); background-repeat: repeat-x; line-height: 9px; width: auto; behavior: url(/css/iepngfix.htc);">&nbsp;</td><td width="3" height="9" style="width: 3px; max-width: 3px; background-image: url(/pic/backgrounds/kopvertright.png); line-height: 9px; font-size: 1px; behavior: url(/css/iepngfix.htc);">&nbsp;</td></tr>');
  n = 0;
  for (var i in child)
  {
    if (i == '-')
    {
      document.getElementById(parent).href = child[i];
      continue;
    }

    if (typeof child[i] == "object")
    {
      document.write('<tr><td colspan="3" style="background-image: url(/pic/backgrounds/kopsub_bg.png); padding: 0px 5px 0px 5px; white-space: nowrap; height: 12px; behavior: url(/css/iepngfix.htc);"><a onfocus="this.blur();" class="parent" id="'+parent+'_'+n+'">'+i+'</a></td></tr>');
      dhtmlmenu_build_aux(parent+'_'+n, child[i], "x");
    }

    if (typeof child[i] != "object")
    {    
    	if (child[i] != '')
    	{ document.write('<tr><td colspan="3" style="background-image: url(/pic/backgrounds/kopsub_bg.png); padding: 0px 5px 0px 5px; white-space: nowrap; height: 12px; behavior: url(/css/iepngfix.htc);"><a onfocus="this.blur();" id="'+parent+'_'+n+'" href="'+child[i]+'">'+i+'</a></td></tr>'); }
    	else document.write('<tr><td colspan="3" style="padding: 0px 5px 0px 5px; white-space: nowrap; background-color: #545456; height: 12px;"><a onfocus="this.blur();" id="'+parent+'_'+n+'" style="cursor: default;">'+i+'</a></td></tr>');
    }
    n++;
  }

  document.write('</tbody></table></div>');


	var huh = document.getElementById(parent+'_childtable').offsetWidth;
	document.getElementById(parent+'_childcell').style.width = (huh -27) +'px';


  at_attach(parent, parent+"_child", position);
}

function dhtmlmenu_build(menu)
{
  for (var i in menu) dhtmlmenu_build_aux(i, menu[i], "y");
}
