var lastHeadingObj = 0;
var lastOpenObj = 0;
var haveOpen = 0;
function toggleMenu(currMenu, thisHeadingObj)
{
  var thisMenuObj = document.getElementById(currMenu);
  var thisMenu    = thisMenuObj.style;
  var thisHeading = thisHeadingObj.style;
  var lastHeading = lastHeadingObj.style;

  if ((haveOpen == 1) && (lastOpenObj != thisMenuObj))
  {
    var lastOpen    = lastOpenObj.style;
    var lastHeading = lastHeadingObj.style;

    if (lastOpen)
      lastOpen.display = "none";

    if (lastHeading)
      lastHeading.color = "black";

    haveOpen = 0;
  }

  if (  (thisMenu.display == "none")
      ||(thisMenu.display == ""))
  {
    thisMenu.display = "block";
  }
  else
  {
    thisMenu.display = "none";
  }

  if (thisMenu.display == "block")
  {
    thisHeading.color   = "#3c98a8";
    lastHeadingObj      = thisHeadingObj;
    lastOpenObj         = thisMenuObj;
    haveOpen = 1;
  }
  else
  {
    thisHeading.color = "black";
    haveOpen = 0;
  }
  return false;
}

var lastOpenDiv;
var haveOpenDiv = 0;
function toggleDiv(currDiv)
{
  var rootDivObj = document.getElementById("contenthome");
  var rootDiv = rootDivObj.style;
  var thisDivObj = document.getElementById(currDiv);
  var thisDiv = thisDivObj.style;

  if ((haveOpenDiv == 1) && (lastOpenDiv != thisDivObj))
  {
    var myOpenDiv = lastOpenDiv.style;
    myOpenDiv.display = "none";
    haveOpenDiv = 0;
  }

  if (  (thisDiv.display == "none")
      ||(thisDiv.display == "") )
  {
    if (thisDivObj != rootDivObj)
      rootDiv.display = "none";

    thisDiv.display = "block";
  }
  else
    thisDiv.display = "none";

  if (thisDiv.display == "block")
  {
    lastOpenDiv = thisDivObj;
    haveOpenDiv = 1;
  }
  else
  {
    haveOpenDiv = 0;
    rootDiv.display = "block";
  }
  return false;
}

// get coordingates of image to place hidden DIV
function popup_getCoordinates(obj) {
var newObj = new Object();
newObj.x = obj.offsetLeft;
newObj.y = obj.offsetTop;
theParent = obj.offsetParent;       
while (theParent != null){
  newObj.y += theParent.offsetTop;
  newObj.x += theParent.offsetLeft;
  theParent = theParent.offsetParent;
}
return newObj;
}

function toggleMenuContents(currMenu, currId)
{
  var thisMenu = document.getElementById(currMenu);
  var thisId = document.getElementById(currId);
  thisMenu = thisMenu.style;
  if (thisMenu.display == "none")
  {    
     thisMenu.display = "block";
     thisId.className ="nomore";
  }
  else if (thisMenu.display == "")
  {
     thisMenu.display = "block";
     thisId.className ="nomore";
  }
  else
  {
    thisMenu.display = "none";
    thisId.className ="more";
  }
  return false;
}
 




