var lastColor = {};
var lastBackgroundColor = {};

function revertMenuColor(which)
{
  var el = document.getElementById(which);
  if (!el)
    return;

  if (lastBackgroundColor[which])
    el.style.backgroundColor = lastBackgroundColor[which];

  var links = el.getElementsByTagName('A');
  for (var idx in links)
    if (links[idx].style)
      links[idx].style.color = lastColor[which];

  return;
}

function changeMenuColor(which)
{
  var el = document.getElementById(which);
  if (!el)
    return;

  lastColor[which] = el.style.color;
  lastBackgroundColor[which] = el.style.backgroundColor;

  el.style.backgroundColor = '#ffeb36';

  var links = el.getElementsByTagName('A');
  for (var idx in links)
    if (links[idx].style)
      links[idx].style.color = 'black';

  return;
}

function loadURL(which)
{
  var el = document.getElementById(which);
  if (!el)
    return;

  var links = el.getElementsByTagName('A');
  if (links && links.length)
    window.location.href = links[0].href;
}
