﻿var photos = [];
photos[photos.length] = {"src": "ph1_view_of_pikes_peak.jpg", "caption": "1:コロラドスプリングスからパイクスピークを望む"};
photos[photos.length] = {"src": "ph2_highway_entrance.jpg", "caption": "2:パイクスピークハイウェイの入口"};
photos[photos.length] = {"src": "ph3_highway2.jpg", "caption": "3:パイクスピークハイウェイ2"};
photos[photos.length] = {"src": "ph4_highway3.jpg", "caption": "4:ハイウェイの風景3"};
photos[photos.length] = {"src": "ph5_highway4.jpg", "caption": "5:ハイウェイの風景4"};
photos[photos.length] = {"src": "ph6_highway5.jpg", "caption": "6:ハイウェイの風景5"};
photos[photos.length] = {"src": "ph7_highway6.jpg", "caption": "7:途中に見える湖の絶景"};
photos[photos.length] = {"src": "ph8_highway7.jpg", "caption": "8:ハイウェイの風景7"};
photos[photos.length] = {"src": "ph9_highway8.jpg", "caption": "9:雪が残るハイウェイ"};
photos[photos.length] = {"src": "ph10_highway9.jpg", "caption": "10:ハイウェイの風景9"};
photos[photos.length] = {"src": "ph11_highway10.jpg", "caption": "11:ガードレールなど野暮なものは無いハイウェイ"};
photos[photos.length] = {"src": "ph12_summit.jpg", "caption": "12:パイクスピークの頂上"};
photos[photos.length] = {"src": "ph13_cog_railway.jpg", "caption": "13:登山電車が走る"};
photos[photos.length] = {"src": "ph14_cog_terminal.jpg", "caption": "14:山頂の登山電車の終着駅"};
photos[photos.length] = {"src": "ph15_hill_climb.jpg", "caption": "15:ヒルクライムを疾駆する"};

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;
	}
}

