/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {
	if (!document.getElementById) return

	initRolloversForArray( document.getElementsByTagName('img') );
	initRolloversForArray( document.getElementsByTagName('input') );
}

function initRolloversForArray( arr )
{
	var aPreLoad = new Array();
	var sTempSrc;
	
	for (var i = 0; i < arr.length; i++) {		
		if (arr[i].id == 'rollover') {
			var src = arr[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '-on'+ftype);

			arr[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			arr[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
				window.status = this.getAttribute('alt');
			}	
			
			arr[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('-on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
				window.status = '';
			}
		}
	}
}

window.onload = initRollovers;