// JavaScript Document
/** dynamic rollover images **/

function addRollover (img, rolloverURL){
	if (typeof img == "string"){
		var id = img;
		img = null;
		
		if (document.getElementById) img = document.getElementById(id);
		else if (document.all) img = document.all[id];
		
		if (!img) img = document.images[id];
		
		if (!img) return;
	}
	
	if (img.tagName.toLowerCase() != "img") return;
	
	var baseURL = img.src;
	
	(new Image()).src = rolloverURL;
	
	img.onmouseover = function() {img.src = rolloverURL;}
	img.onmouseout = function() {img.src = baseURL;}
}

function initRollovers(){
	var images = document.getElementsByTagName("img");
	for(var i=0; i<images.length; i++){
		var image = images[i];
		var rolloverURL = image.getAttribute("rollover");
		if (rolloverURL) addRollover(image, rolloverURL);
	}
}

if (window.addEventListener)
	window.addEventListener("load", initRollovers, false);
else if (window.attachEvent)
	window.attachEvent("onload", initRollovers);
