/*
	imsSwap.js
	functions to pre load images and to swap them to creat rolover effects
	!!!!!!!!!!!!
	NOTE:
		The mouseover image's path is stored in the name attribute of the img tag and the preload function uses this too.
	!!!!!!!!!!!!
*/


function swapImg(theImg)
{
	var temp = theImg.src;
	theImg.src = theImg.name;
	theImg.name = temp;
}

function regSwapImg(theImg)
{
	addEvent(theImg.parentNode, 'mouseover', function() { swapImg(theImg); } );
	addEvent(theImg.parentNode, 'mouseout', function() { swapImg(theImg); } );
}

function initImgSwap()
{
	if ( document.getElementsByTagName )
	{
		var imgs = document.getElementsByTagName('img');
		for ( var i = 0; i != imgs.length; i++ )
		{
			if ( imgs[i].parentNode.nodeName.toLowerCase() == 'a' )
			{
				(new Image()).src = imgs[i].name;
				regSwapImg(imgs[i]);
			}
		}
	}
}

addEvent(window, 'load' , initImgSwap);
