function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_ov."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_ov.", "_off."));
				}
			}
		}
	}
}

//実行の際にonloadイベントで他のライブラリとバッティングせず使用させるためのコード
if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

//以上
/*
使用法
　　（1）smatrollover.jsをHTML等のhead要素内に読み込む
	（2）通常時の画像（gif・jpg・png可）と、ロールオーバー時の画像を別々で用意して、
	　　以下のようにファイル名の最後に「_ov」「_off」とつける。
　　　　　（menu_ov.gif　menu_off.gif）
	（3）ソースは「○○_off」の画像をご自由に配置。（他に属性等は不要）
*/

