//this script loops through all images on the page and adds hover swapping on images with class="before"

function hoverSwap(imageURL) {
   return imageURL.replace("-off.","-on.");
}

function hoverRestore(imageURL) {
   return imageURL.replace("-on.","-off.");
}

function hoverImages() {
 var images = getElementsByClass("hover");
 for (var i=0; i<images.length; i++) {
   var image = images[i];
   if (image.getAttribute("src")) {
   image.onmouseover = function () { this.src=hoverSwap(this.src); }
   image.onmouseout = function () { this.src=hoverRestore(this.src); }
   }
 }
}
addLoadEvent(hoverImages);
