function roll_on() {
  this.src = this.src.replace(/_off/,'_on');
}

function roll_off() {
  this.src = this.src.replace(/_on/,'_off');
}

function img_test() {
  for (i = 0; i < document.images.length; i++) {
    if (document.images[i].src.indexOf('_off.') > 0) {
      document.images[i].onmouseover = roll_on;
      document.images[i].onmouseout = roll_off;
    }
  }
}

img_test(); 