//=====================================================================
//  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>
//=====================================================================
//
//
// :: Script modified by MizzMona to include imgPath & input buttons ::
//
//

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgPath="/btn/";
	var imgarr=document.getElementsByTagName('img');
	var imgarr2=document.getElementsByTagName('input');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (n=0;n<2;n++){
		for (i=0;i<imgarr.length;i++){
			if (imgarr[i].className.indexOf('domroll')!=-1){
				imgSrc[i]=imgarr[i].getAttribute('src');
				imgClass[i]=imgarr[i].className;
				imgPreload[i]=new Image();
				if (imgClass[i].match(/domroll (\S+)/)) {
					imgPreload[i].src=imgPath+imgClass[i].match(/domroll (\S+)/)[1];
				}
				imgarr[i].setAttribute('psrc', imgPreload[i].src);
				imgarr[i].setAttribute('xsrc', imgSrc[i]);
				imgarr[i].onmouseover=function(){
					this.setAttribute('src',this.getAttribute('psrc'))
				}
				imgarr[i].onmouseout=function(){
					this.setAttribute('src',this.getAttribute('xsrc'))
				}
			}
		}
		imgarr=imgarr2;
	}
}
domRollover();