
/*-- « SwapImage ----------------------------------
---------------------------------------------------*/

//y«ƒ[ƒ‹ƒI[ƒo[ SET«z
function smartRollover(){
	
	if(document.getElementsByTagName){
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			
			// <img class="noOver"> ‚Åƒ[ƒ‹ƒI[ƒo[‚ð OFF
			if(images[i].getAttribute("src").match("_off.") && images[i].className != "noOver"){
				
				this["nPre"+i] = new Image();
				this["nPre"+i].src = images[i].getAttribute("src").replace("_off.", "_ov.");
				//alert(this["nPre"+i].src);
				
				// Mouse ƒCƒxƒ“ƒg
				images[i].onmouseover = function(){replaceSrc(this, "over");};
				images[i].onmouseout = function(){replaceSrc(this, "off");};
			}
		}
	}
	
}


//y«‰æ‘œ‚Ì’u‚«Š·‚¦«z
function replaceSrc(nSrc, nMode){
	
	switch(nMode){
		case "off" : nSrc.setAttribute("src", nSrc.getAttribute("src").replace("_ov.", "_off.")); break;
		case "over" : nSrc.setAttribute("src", nSrc.getAttribute("src").replace("_off.", "_ov.")); break;
	}
}


//y«ƒ[ƒhŽž‚Ìˆ—«z
if(window.addEventListener) window.addEventListener("load", smartRollover, false);	// ¨ For IE
else if(window.attachEvent) window.attachEvent("onload", smartRollover);						// ¨ For Others