window.onload = function()
{
  layoutOnLoad();
  new xMenu1('hn_solutions', 'hn_solutions_sub', 0, 'mouseover');
  new xMenu1('hn_about_tequa', 'hn_about_tequa_sub', 0, 'mouseover');
  getLinksToBlur();
}

// xMenu1 stuff
function xMenu1(triggerId, menuId, mouseMargin, openEvent)
{
  var isOpen = false;
  var trg = xGetElementById(triggerId);
  var mnu = xGetElementById(menuId);
  if (trg && mnu) {
    xAddEventListener(trg, openEvent, onOpen, false);
  }
  function onOpen()
  {
    if (!isOpen) {
      xMoveTo(mnu, xPageX(trg), xPageY(trg) + xHeight(trg) - 5);
      xShow(mnu);
      xAddEventListener(document, 'mousemove', onMousemove, false);
      isOpen = true;
    }
  }
  function onMousemove(ev)
  {
    var e = new xEvent(ev);
    if (!xHasPoint(mnu, e.pageX, e.pageY, -mouseMargin) &&
        !xHasPoint(trg, e.pageX, e.pageY, -mouseMargin))
    {
      xHide(mnu);
      xRemoveEventListener(document, 'mousemove', onMousemove, false);
      isOpen = false;
    }
  }
} // end xMenu1

// layout2 stuff
function layoutOnLoad()
{
  var ele = xGetElementById('col1');
  if (ele && xDef(ele.style, ele.offsetHeight)) { // another compatibility check
    adjustLayout();
    xAddEventListener(window, 'resize', layoutOnResize, false);
  }
}
function layoutOnResize()
{
  adjustLayout();
}
function adjustLayout()
{
  // Get content heights
  var cHeight = xHeight('col2');
  var lHeight = xHeight('col1');

  // Find the maximum height
  var maxHeight = Math.max(lHeight, cHeight);

  // Assign maximum height to all columns
  xHeight('col1', maxHeight);
  xHeight('col2', maxHeight);

  // Show the footer
  //xShow('footer');
}

// removes annoying dotted border around "active" links
function unblur() {
  this.blur();
}
function getLinksToBlur() {
  if (!document.getElementById) return;
  links = document.getElementsByTagName("a");
  for(i=0; i<links.length; i++) {
    links[i].onfocus = unblur;
  }
  links = document.getElementsByTagName("area");
  for(i=0; i<links.length; i++) {
    links[i].onfocus = unblur;
  }
}


