﻿var photos = [];
photos[photos.length] = {"src": "p1_koyo_nanjenji.jpg", "caption": "1:南禅寺の紅葉が美しい境内"};
photos[photos.length] = {"src": "p2_incline.jpg", "caption": "2:有名なインクライン"};
photos[photos.length] = {"src": "p3_view_from_sanmon.jpg", "caption": "3:南禅寺山門からの眺め"};
photos[photos.length] = {"src": "p4_tetsugakunomichi1.jpg", "caption": "4:永観堂近辺の紅葉"};
photos[photos.length] = {"src": "p5_eikando.jpg", "caption": "5:永観堂の眺め"};
photos[photos.length] = {"src": "p6_tetsugakunomichi2.jpg", "caption": "6:疎水にそって哲学の道を行く"};
photos[photos.length] = {"src": "p7_tetsugakunomichi3_from_honenin.jpg", "caption": "7:法然院付近から"};
photos[photos.length] = {"src": "p8_tetsugakunomichi4_ginkaku.jpg", "caption": "8:銀閣寺付近の哲学の道"};
photos[photos.length] = {"src": "p9_tetsugakunomichi5_ginkaku.jpg", "caption": "9:銀閣寺付近の哲学の道2"};
photos[photos.length] = {"src": "p10_ginkakuji.jpg", "caption": "10:静かにたたずむ銀閣寺"};
photos[photos.length] = {"src": "p11_honenin.jpg", "caption": "11:雪の法然院山門"};
window.onload = function() {
	var menu = document.createElement("form");
	var menulist = document.createElement("select");
	
	document.body.appendChild(menu);
	menu.appendChild(menulist);
	var options = new Array();
	var caption = document.createTextNode("選んでください");
	options[0] = document.createElement("option");
	options[0].appendChild(caption);
	menulist.appendChild(options[0]);
	for(var i = 0; i<photos.length; i++) {
		var caption = document.createTextNode(photos[i].caption);
		options[i+1] = document.createElement("option");
		options[i+1].appendChild(caption);
		menulist.appendChild(options[i+1]);
	}

	menulist.onchange = function() {
		if(!this.selectedIndex) return false;
		if(document.getElementById("photoframe")) {
			var photoframe = document.getElementById("photoframe");
		} else {
			var photoframe = document.createElement("img");
			photoframe.id = "photoframe";
			photoframe.width = "240";
			photoframe.height = "180";
			document.body.appendChild(photoframe);
		}
		photoframe.src = photos[this.selectedIndex-1].src;
	}
}

