//// Show/hide division code for Abbeydale site ////
//

var sCurrent = "";
var tmrDiv = 0;
var dlyDiv = 333;

function showDiv(sDivId, evt)
  {
  // shut down currently open div first...
  if (sCurrent != "")
    shutDiv(sCurrent);
  // find new div to open...
  var el = document.getElementById(sDivId);
  if (el && evt)
    {
    var dx = 0;
    // must display item before it can have height...
    el.style.position = "absolute";
    el.style.left = "-1000px";
    el.style.top = "-1000px";
    el.style.display = "block";
    //alert("class:"+el.className+", height:"+el.offsetHeight);
    switch (el.className)
      {
      case "popup_red":
        dx = 20;
        break;
      case "popup_yel":
        dx = -el.offsetHeight / 2;
        break;
      case "popup_blu":
        dx = -el.offsetHeight - 20;
      }
    el.style.left = evt.clientX + 30 + "px";
    el.style.top = evt.clientY + dx + "px";
    // mark this as currently open div...
    sCurrent = sDivId;
    }
  return false;
  }

function hideDiv(sDivId)
  {
  tmrDiv = setTimeout("shutDiv(\""+sDivId+"\")", dlyDiv);
  return false;
  }

function keepDiv(sDivId)
  {
  //alert("sDivId="+sDivId+", sCurrent="+sCurrent);
  if (sDivId == sCurrent)
    clearTimeout(tmrDiv);
  return false;
  }

function shutDiv(sDivId)
  {
  var el = document.getElementById(sDivId);
  if (el)
    {
    clearTimeout(tmrDiv);
    el.style.display = "none";
    sCurrent = "";
    }
  return false;
  }
