var preLoads = new Array();
function initRollOvers(){
	if (!document.getElementById){
		return false;
	}
	var allImages = document.getElementsByTagName('img');
	var imgSrc, onSrc, sep;

	for (var i = 0; i < allImages.length; i++) {		
		if (allImages[i].className == 'rollover') {
			imgSrc = allImages[i].getAttribute('src');
			sep = imgSrc.lastIndexOf('.');
			onSrc = imgSrc.substr(0, sep) + '_on' + imgSrc.substr(sep, imgSrc.length-sep);

			allImages[i].setAttribute('imgSrc', imgSrc);
			allImages[i].setAttribute('onSrc', onSrc);

			preLoads[i] = new Image();
			preLoads[i].src = onSrc;

			allImages[i].onmouseover = function() {
				this.setAttribute('src', this.getAttribute('onSrc'));
			}
			allImages[i].onmouseout = function() {
				this.setAttribute('src', this.getAttribute('imgSrc'));
			}
		}
	}
}
function addOnLoadEvent(func){
	var oldOnload = window.onload;
	if (typeof window.onload != 'function'){
		window.onload = func;
	}else{
		window.onload = function(){
			oldOnload();
			func();
		}
	}
}
addOnLoadEvent(initRollOvers);
