// These functions derived from http://jehiah.cz/archive/simple-swap
// based specifically from comment #37
//
// Changes: Fixed syntax errors...

function SimpleSwapSetup()
{
 var images = document.getElementsByTagName("img");
 for (var i=0; i<images.length;i++)
 {
   if (!images[i].src.match('_off.gif$')) continue;
   // preload image
   // comment the next two lines to disable image pre-loading
   images[i].oversrcimg = new Image();
   images[i].oversrcimg.src = images[i].getAttribute("src").replace("off.", "on.");
   // set event handlers
   images[i].onmouseover = new Function("SimpleSwap(this, 'oversrc');");
   images[i].onmouseout = new Function("SimpleSwap(this);");
   // save original src
   images[i].setAttribute("origsrc", images[i].src);
   images[i].setAttribute("oversrc", images[i].oversrcimg.src);
 }
}

function SimpleSwap(el,which) {
 el.src=el.getAttribute(which||"origsrc");
}

