addEvent(window, "load", applyMakingPhotos); // オンロード時に↓を実行
function applyMakingPhotos() {
	var photoElement	= document.getElementById("reportPhotoArea"); // 変化させるimgを取得
	var buttonsParent	= document.getElementById("reportButtons"); // ボタンの親nodeを取得
	if(buttonsParent) {
		var buttons = buttonsParent.getElementsByTagName("a"); // ボタンのnode(aタグ)を配列として取得
	}
	var photos = new Array; // 画像を配列として格納(プリロード)
	for(var i = 0; i < buttons.length; i++) {
		var n = i + 1;
		photos[i] = new Image();
		photos[i].src = "/future/report/images/img_report_la_fr_photo" + n + ".jpg";
	}
	if(photoElement && buttons) {
		for(var j = 0; j < buttons.length; j++) {
			buttons[j].onclick = function() { // 各ボタンにオンマウス時のアクションを設定
				var targetUrl = this.getAttribute("href");
				var n = parseInt(targetUrl.charAt(targetUrl.length - 5)); // 変化後の画像・説明文はボタンのhrefによる
				if(n && n > 0) {
					n = n - 1;
					photoElement.setAttribute("src", photos[n].src);
				}
				return false;
			};
		}
	}
}
function addEvent(obj, type, fn) {
	if(obj.addEventListener) {
		obj.addEventListener(type, fn, false);
	} else if(obj.attachEvent) {
		obj.attachEvent("on" + type, fn);
	}
}


