var lon = 0;

function ball(u) {
  // change the numbered light
  n = document.images[lon].src;
  document.images[lon].src = n.replace("redglass.gif", "blueglass.gif");
  lon = u;
  n = document.images[lon].src;
  document.images[lon].src = n.replace("blueglass.gif", "redglass.gif");
}  