/*
簡単ロールオーバーイメージ
(c)Sapphirus.Biz

「_o」と「_h」という名前が含まれるイメージファイルを二つ用意します。
「_o」が通常のイメージとなり、マウスオーバーすると「_h」のイメージファイルに
入れ変わります。マウスを外すと「_o」の画像に戻ります。
Ex.) イメージファイル「menu1_o.gif」「 menu1_h.gif」
<img src="menu1_o.gif" />
*/
function setRollOver() {
	if (!document.getElementsByTagName) return false;
	var ovrImgList = document.getElementsByTagName('img');
	for (var i = 0; i < ovrImgList.length; i++) {
		if (ovrImgList[i].src.match(/_o\./i)) {
			var loadedImg = new Image();
			loadedImg.src = ovrImgList[i].src.replace(/_o\./i, '_h.');
			ovrImgList[i].onmouseover = function() { // マウスオーバー
				this.src = this.src.replace(/_o\./i, '_h.');
			}
			ovrImgList[i].onmouseout = function() { // マウスアウト
				this.src = this.src.replace(/_h\./i, '_o.');
			}
			ovrImgList[i].onmouseup = function() { // クリック後のロールオーバー解除
				this.src = this.src.replace(/_h\./i, '_o.');
			}
		}
	}
	return true;
}
if (window.addEventListener) window.addEventListener('load', setRollOver, false);
if (window.attachEvent) window.attachEvent('onload', setRollOver);

