// <script>


function at_display2(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ***** DropDown Box **********************************************************

var at_timeout = 50;

// ***** Show Aux *****

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

  p.className        = "active";

  if (c.offsetWidth <= 0)
  {
    c.style.position   = "absolute";
    c.style.visibility = "visible";
    c.style.display    = "block";
  }

  var direction = undefined;
  if (p.parentNode && p.parentNode["at_position"] == "x")
    direction = p.parentNode["at_direction"];

var browserOffset = 0;
if (!document.all) { 
 browserOffset = 0;
} 

 var top  = (c["at_position"] == "y") ? p.offsetHeight + 75 : p.offsetTop;
  var left = (c["at_position"] == "x") ? p.offsetWidth + p.offsetLeft: p.offsetLeft + browserOffset;

 /* 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.visibility = "visible";

}
}

// ***** Hide Aux *****

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

// ***** Show *****

function at_show2(e)
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux2(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ***** Hide *****

function at_hide2()
{
  var c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("at_hide_aux('"+this["at_parent"]+"', '"+this["at_child" ]+"')", at_timeout);
}

// ***** Attach *****

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

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

  p.onmouseover = at_show;
  p.onmouseout  = at_hide;
  c.onmouseover = at_show;
  c.onmouseout  = at_hide;
}

// ***** DropDown Menu *********************************************************

// ***** Build Aux *****

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

  document.write('<div class="vert_menu" id="'+parent+'_child" style="visibility: hidden; position: absolute; display: block; top:0; left:0;">');

  var n = 0;
  for (var i in child)
  {
    if (i == '-')
    {
      document.getElementById(parent).href = child[i];
      continue;
    }
if(null != child[i]){
    if (typeof child[i] == "object")
    {
      document.write('<a class="parent" id="'+parent+'_'+n+'">'+i+'</a>');
      dhtmlmenu_build_aux2(parent+'_'+n, child[i], "x");
    }
    else document.write('<a id="'+parent+'_'+n+'" href="'+child[i]+'">'+i+'</a>');
}
    n++;
  }

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

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

// ***** Build *****

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

