﻿var photos = [];
photos[photos.length] = {"src": "ys1_newborns.jpg", "caption": "1:新しい木や草が生まれ成長している"};
photos[photos.length] = {"src": "ys2_heart_lake_with_mt_sheridan.jpg", "caption": "2:シェリダン山とハートレイク"};
photos[photos.length] = {"src": "ys3_yellowstone_lake.jpg", "caption": "3:美しいイエローストーン湖"};
photos[photos.length] = {"src": "ys4_geyser.jpg", "caption": "4:あちこちから噴出す間欠泉"};
photos[photos.length] = {"src": "ys5_old_faitful.jpg", "caption": "5:もっとも有名な高く噴出す間欠泉"};
photos[photos.length] = {"src": "ys6_quell_spa.jpg", "caption": "6:鮮やかな色をした温泉噴出し口"};
photos[photos.length] = {"src": "ys7_deer.jpg", "caption": "7:野性の鹿"};
photos[photos.length] = {"src": "ys8_water_fall.jpg", "caption": "8:イエローストーン川の滝"};
photos[photos.length] = {"src": "ys9_american_baison.jpg", "caption": "9:野性のバイソン（バッファロー）"};
photos[photos.length] = {"src": "ys10_yellowstone_river.jpg", "caption": "10:イエローストーン・リバーが流れる"};

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;
	}
}

