function setupRollovers() {
  if (!document.getElementsByTagName) return;
  var all_links = document.getElementsByTagName('a');
  for (var i = 0; i < all_links.length; i++) {
    var link = all_links[i];
    if (link.className && (' ' + link.className + ' ').indexOf(' rollover ') != -1) {
      if (link.childNodes && link.childNodes.length == 1 && link.childNodes[0].nodeName.toLowerCase() == 'img') {
        addEvent (link, 'mouseover', rollover_mouseover, false);
        addEvent (link, 'mouseout', rollover_mouseout, false);
      }
    }
  }
}

function rollover_mouseover(e) {
  var target = findTarget(e);
  if (!target) return;
  // the only child node of the a-tag in target will be an img-tag
  var img_tag = target.childNodes[0];
  // Take the "src", which names an image called "something.ext",
  // Make it point to "something_over.ext"
  // This is done with a regular expression
  img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '_over$1');
}

function rollover_mouseout(e) {
  var target = findTarget(e);
  if (!target) return;
  // the only child node of the a-tag in target will be an img-tag
  var img_tag = target.childNodes[0];
  // Take the "src", which names an image as "something_over.ext",
  // Make it point to "something.ext"
  // This is done with a regular expression
  img_tag.src = img_tag.src.replace(/_over(\.[^.]+)$/, '$1');
}

// When the page loads, set up the rollovers
addEvent (window, 'load', setupRollovers, false);