/****************************************************
* DOM Image rollover v3.0: By Chris Poole http://chrispoole.com
* Script featured on http://www.dynamicdrive.com
* Modified by Eric Lau
*****************************************************/

function imagerollover()
{
	if (navigator.userAgent.match(/Opera (\S+)/)) 
	{
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById || operaVersion < 7) return;
	
	var imgarr = document.getElementsByTagName('img');
	var imgPreload = new Array();
	var imgSrc = new Array();
	var imgClass = new Array();
	
	for (i = 0; i < imgarr.length; i++)
	{
		if (imgarr[i].className.indexOf('imagerollover') != -1)
		{
			imgSrc[i] = imgarr[i].getAttribute('src');
			imgClass[i] = imgarr[i].className;
			imgPreload[i] = new Image();
			
			if (imgClass[i].match(/imagerollover (\S+)/))
			{
				imgPreload[i].src = imgClass[i].match(/imagerollover (\S+)/)[1]
			}
			
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function()
			{
				this.setAttribute('src', this.className.match(/imagerollover (\S+)/)[1])
			}
			imgarr[i].onmouseout=function()
			{
				this.setAttribute('src', this.getAttribute('xsrc'))
			}
		}
	}
}
imagerollover();