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

  p.className = "active";

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

  for (; p; p = p.offsetParent)
  {
    if (p.style.position != 'absolute')
    {
      left += p.offsetLeft;
      top  += p.offsetTop;
    }
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.display = "block";
}

function at_hide_aux2(parent, child)
{
  document.getElementById(parent).className = "parent";;
  document.getElementById(child ).style.display = "none";
}

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

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

function at_hide_p2()
{
  c = document.getElementById(this["at_child" ]);
  c["at_timeout"] = setTimeout("at_hide_aux2('"+this.id+"', '"+c.id+"')", 1000);
}

function at_hide_c2()
{
  p = document.getElementById(this["at_parent"]);
  this["at_timeout"] = setTimeout("at_hide_aux2('"+p.id+"', '"+this.id+"')", 1000);
}

function at_attach2(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;

  p.onmouseover = at_show_p2;
  p.onmouseout  = at_hide_p2;
  c.onmouseover = at_show_c2;
  c.onmouseout  = at_hide_c2;
}

function dhtmlmenu_build_aux2(parent, child, position)
{
  document.getElementById(parent).className = "parent";

  document.write('<div class="exigent_vert_menu" id="'+parent+'_child">');

  n = 0;
  for (var i in child)
  {
    if (i == '-')
    {
      document.getElementById(parent).href = child[i];
      continue;
    }

    if (typeof child[i] == "object")
    {
      document.write('<a class="parent" id="'+parent+'_'+n+'">'+i+'</a>');
      dhtmlmenu_build_aux2(parent+'_'+n, child[i], "x");
    }
    if (n == 0 || n == 2)
    { document.write('<a id="'+parent+'_'+n+'" href="'+child[i]+'">'+i+'</a>'); }
    else document.write('<a id="'+parent+'_'+n+'" style="cursor: default;">'+i+'</a>');
    n++;
  }

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

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

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