function GetSection()
{
  url     = new String(document.location);
  tokens  = url.split(/\//);
  section = tokens[tokens.length-2];
  if (section == "www.chrfr.de" || section == "alpha-centauri")
  {
    section = "home";
  }
  return section;
}

function GetButtonSrc(id, state)
{
  name = "/images/menu/" + id + "_";
  if (state == 0)  {name += "normal.png";}
  if (state == 1)  {name += "active.png";}
  if (state == 2)  {name += "pressed.png";}
  return name;
}

function ProcessButton(id, state)
{  
  if (state == 0)
  {
    hideToolTip();
  }
  else
  {
    if (id == "Home") showToolTip("Overview and contact information");
    if (id == "Software") showToolTip("Software development, games, downloads");
    if (id == "Imaging") showToolTip("Computer graphics and raytracing (under construction)");
    if (id == "Astronomy") showToolTip("Astronomy and other sciences");
  }

  if (state == 0 && GetSection() == id.toLowerCase())
  {
    state = 1;
  }

  document[id].src = GetButtonSrc(id, state);
}

section = GetSection();
section = section.charAt(0).toUpperCase() + section.substr(1,section.length-1);
document.title = "Personal Pages of Christian Fröschlin - " + section + " Section";
