/*
 * Rollover Code
 * - Replaces _0 with _1 on mouseover
 *
 * Usage:
 *
 * <body onload="preload();">
 *
 * <img src="images/image_0.gif">
 *
 */


function swapImage(obj, strState) {
	if ((obj.src.indexOf('_0') >0) || (strState=='1')) {
		obj.src = obj.src.replace('_0', '_1');
	} else {
		obj.src = obj.src.replace('_1', '_0');
	}
}

function preloadImage(obj) {
	imgTmp=new Image();
  	imgTmp.src=obj.src.replace('_0', '_1');
}


// Where as this one in the body onload event will automagically hook up the swap images for you
function preload() {
	var preloadcount=0;
	var imgarr = document.images;
	for (var i = 0; i < imgarr.length; i++) {
		if (imgarr[i].src.indexOf('_0.') > 0) {
			preloadImage(imgarr[i]);
			imgarr[i].onmouseover=function(){swapImage(this, '1')};
			imgarr[i].onmouseout=function(){swapImage(this, '0')};
		}
	}
}
