﻿var photos = [];
photos[photos.length] = {"src": "heian1_kawaramachisanjo.jpg", "caption": "1:河原町三条付近"};
photos[photos.length] = {"src": "heian2_sanjokobashi_takasegawa.jpg", "caption": "2:高瀬川と三条小橋"};
photos[photos.length] = {"src": "heian3_sanjoohashi.jpg", "caption": "3:三条大橋"};
photos[photos.length] = {"src": "heian4_kamogawa_sanjo.jpg", "caption": "4:三条付近の鴨川"};
photos[photos.length] = {"src": "heian5_kamogawa_sanjo.jpg", "caption": "5:三条付近の鴨川2"};
photos[photos.length] = {"src": "heian6_kamogawa.jpg", "caption": "6:三条付近から鴨川"};
photos[photos.length] = {"src": "heian7_shirakawa_sanjo.jpg", "caption": "7:三条通りの白川"};
photos[photos.length] = {"src": "heian8_sanjojingudo.jpg", "caption": "8:三条神宮道から見える大鳥居"};
photos[photos.length] = {"src": "heian9_ootorii.jpg", "caption": "9:平安神宮の大鳥居"};
photos[photos.length] = {"src": "heian10.jpg", "caption": "10:平安神宮の應天門（神門）"};
photos[photos.length] = {"src": "heian11.jpg", "caption": "11:平安神宮の神殿"};
photos[photos.length] = {"src": "heian12_jinen.jpg", "caption": "12:平安神宮の神苑"};
photos[photos.length] = {"src": "", "caption": ""};

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;
	}
}

