function applyImageSwap() {
  var i;
  var elem;
  var arrElements = $$(".imgswap");
  var count = arrElements.length;
  for (i = 0; i < count; i++) {
    elem = arrElements[i];
    elem.onmouseover = function() {
      showImage(this);
    }
  }
}
function showImage(elem) {
  hideAllImages();
  var elemId;
  var medImg;
  elemId = elem.getAttribute("id");
  // find the number at the end of the id (slice off the leading 'thumb', replace with 'med')
  elemId = elemId.slice(5);
  elemId = "med" + elemId;
  // get the medium image and show it
  medImg = $(elemId);
  medImg.style.display = "block";
}
function hideAllImages() {
  var i;
  var elem;
  var arrElements = $$(".imgswapmed");
  var count = arrElements.length;
  for (i = 0; i < count; i++) {
    elem = arrElements[i];
    elem.style.display = "none";
  }
}
window.onload = function() {
  applyImageSwap();
}