﻿var photos = [];
photos[photos.length] = {"src": "ib1_sw.jpg", "caption": "1:南西から見たアイアンブリッジ"};
photos[photos.length] = {"src": "ib2_ne.jpg", "caption": "2:北東から見たアイアンブリッジ"};
photos[photos.length] = {"src": "ib3_se.jpg", "caption": "3:南東から見たアイアンブリッジ"};
photos[photos.length] = {"src": "ib4_s.jpg", "caption": "4:南側から見たアイアンブリッジ"};
photos[photos.length] = {"src": "ib5_world_first_ironbridge_1779.jpg", "caption": "5:世界最初のアイアンブリッジ(1779)のモニュメント"};
photos[photos.length] = {"src": "ib6_ne.jpg", "caption": "6:北東、道路より世界最初のアイアンブリッジ"};
photos[photos.length] = {"src": "ib7_se.jpg", "caption": "7:南東よりズームイン"};
photos[photos.length] = {"src": "ib8_severn_river.jpg", "caption": "8:アイアンブリッジがかかるセバーン川の流れ"};
photos[photos.length] = {"src": "ib9_road.jpg", "caption": "9:アイアンブリッジの前の道路"};

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;
	}
}

