


function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ***** DropDown Control ******************************************************

var at_timeout = 200;

// ***** Show Aux *****

function at_show_aux2(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);
  var I = document.getElementById("imgMyReports");

  p.className        = "nav_navmyreports";

  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 top   = (c["at_position"] == "y") ?  p.offsetHeight : 0;
  var left1 = (c["at_position"] == "x") ?  p.offsetWidth  : 0;
  var left2 = (c["at_position"] == "x") ? -c.offsetWidth  : 0;
  var left3 = (c["at_position"] == "x") ?  p.offsetWidth  : 0;

  for (; p; p = p.offsetParent)
  {
    if (p.style.position != 'absolute')
    {
      left1 += p.offsetLeft;
      left2 += p.offsetLeft;
      top   += p.offsetTop;
    }
    left3 += p.offsetLeft;
  }

  //if (direction)
  //{
  //  left = (direction == 'right') ? left1 : left2;
  //  c['at_direction'] = direction;
    //left = left - 1 ;
  //}
  //else
  //{
    left = (left3+c.offsetWidth < document.body.offsetWidth) ? left1 : left2;
    c['at_direction'] = (left3+c.offsetWidth < document.body.offsetWidth) ? 'right' : 'left';
    //left = left1 ;
  //}

    //alert('hi') ;

    //top = top + 1 ;
    left = left + 1 ;

  c.style.position   = "absolute";
  c.style.visibility = "visible";
  c.style.display    = "block";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  
  //document.getElementById("imgMyReports").src = '/analysis/img/nav2/myreports_on.gif'  ;
}

// ***** Hide Aux *****

function at_hide_aux2(parent, child)
{
  
  document.getElementById(parent).className        = "nav_navmyreports";
  document.getElementById(child ).style.visibility = "hidden";
  document.getElementById(child ).style.display    = "block";
  
  //document.getElementById("imgMyReports").src = '/analysis/img/nav2/myreports_off.gif'  ;
  

}

// ***** Show *****

function at_show2(e)
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);
  var I = document.getElementById("imgMyReports");

  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_aux2('"+this["at_parent"]+"', '"+this["at_child" ]+"')", at_timeout) ;
}

// ***** Attach *****

function at_attach2(parent, child, position)
{
  p = document.getElementById(parent);
  c = document.getElementById(child);
  i = document.getElementById("imgMyReports");

  p["at_child"]    = c.id;
  c["at_child"]    = c.id;
  i["at_image"]    = i.id
  p["at_parent"]   = p.id;
  c["at_parent"]   = p.id;
  c["at_position"] = position;

  p.onmouseover = at_show2;
  p.onmouseout  = at_hide2;
  c.onmouseover = at_show2;
  c.onmouseout  = at_hide2;
}

// ***** DropDown Menu *********************************************************

// ***** Build Aux *****

function dhtmlmenu_build_aux(parent, child, position)
{
  document.getElementById(parent).className = "nav_navmyreports";
  I = document.getElementById("imgMyReports");

  
  document.write('<div nowrap class="vert_menu" id="'+parent+'_child">');
  
  //document.write('<div id="'+parent+'_child"><table cellpadding="0" cellspacing="0">');

  var n = 0;
  for (var i in child)
  {
    if (i == '-')
    {
      document.getElementById(parent).href = child[i];
      continue;
    }

    if (typeof child[i] == "object")
    {
      document.write('<a id="'+parent+'_'+n+'">'+i+'</a>');
      dhtmlmenu_build_aux(parent+'_'+n, child[i], "x");
    }
    else document.write('<a onmouseover="javascript:funMyReports();" class="nav_navmyreports" id="'+parent+'_'+n+'" href="'+child[i]+'">'+i+'</a>');
    n++;
  }

  document.write('</div>');

  at_attach2(parent, parent+"_child", position);
}

// ***** Build *****

function dhtmlmenu_build(menu)
{
  for (var i in menu) dhtmlmenu_build_aux(i, menu[i], "y");
}

function funMyReports()
{

    //alert('hi') ;
    
    var c = document.getElementById(this["at_child"]);

    clearTimeout(c["at_timeout"]);
    
    //document.getElementById("imgMyReports").src = '/analysis/img/nav2/myreports_on.gif'  ;
    
}
