﻿/**
 * 16:13 2010/03/15
 * ファイル名の途中に「_off」があっても（例：logo_official.png） match してしまうバグを修正。
 * ループを最適化。
 */

(function () {
	function a() {
		if (document.getElementsByTagName) {
			var b = document.getElementsByTagName("img");
			var suffix = /_off\./;
			for (var d = 0, l = b.length; d < l; d++) {
				var t = b[d], s = t.getAttribute("src");
				if (s.match(suffix)) {
					var c = new Image();
					c.src = s.replace("_off.", "_on.");
					t.onmouseover = function () {
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
					};
					t.onclick = t.onmouseup = t.onmouseout = function () {
						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
					};
				}
			}
		}
	}
	if (window.addEventListener) {
		window.addEventListener("load", a, false)
	} else {
		if (window.attachEvent) {
			window.attachEvent("onload", a)
		}
	}
})();
