// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// Include this script on your page
// then make image rollovers simple like:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//
// http://jehiah.com/archive/simple-swap
// 


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

//gecon: altered to allow script validation
//over images will have color. in the end of filename, normal will have b_w.
//
function SimpleSwapSetup()
{
var images = document.getElementsByTagName("img");
//for (var i=0; ioff,''))
for (var i=0;i<images.length;i++){
{
// 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("b_w.", "color.");
// 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);
}
}
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

