//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var domimgarr=document.getElementsByTagName('img');
	var domimgPreload=new Array();
	var domimgSrc=new Array();
	var domimgClass=new Array();
	for (i=0;i<domimgarr.length;i++){
		if (domimgarr[i].className.indexOf('domroll')!=-1){
			domimgSrc[i]=domimgarr[i].getAttribute('src');
			domimgClass[i]=domimgarr[i].className;
			domimgPreload[i]=new Image();
			if (domimgClass[i].match(/domroll (\S+)/)) {
				domimgPreload[i].src = domimgClass[i].match(/domroll (\S+)/)[1]

			}
			domimgarr[i].setAttribute('xsrc', domimgSrc[i]);
			domimgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			domimgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}		
		}
	}
}
//domRollover();
