﻿var photos = [];
photos[photos.length] = {"src": "picasso1_womans_bust.jpg", "caption": "1:女の胸像（1937）"};
photos[photos.length] = {"src": "picasso2_lecture.jpg", "caption": "2:読書（la lecture 1932　ピカソ美術館　パリ）"};
photos[photos.length] = {"src": "picasso3_woman_with_hat.jpg", "caption": "3:緑色と黄色の帽子をかぶった座る女（1962/個人蔵）"};
photos[photos.length] = {"src": "picasso4_woman_chair.jpg", "caption": "4:椅子に座る女"};
photos[photos.length] = {"src": "picasso5_figure_et_profil.jpg", "caption": "5:人物と横顔　（1928/ピカソ美術館　パリ）"};
photos[photos.length] = {"src": "picasso6_bullfight.jpg", "caption": "6:闘牛1　(bullfight）"};
photos[photos.length] = {"src": "picasso7_bullfight.jpg", "caption": "7:闘牛2　(bullfight）"};
photos[photos.length] = {"src": "picasso8_dora_marl.jpg", "caption": "8:ドラ・マールの肖像（１９３７、油彩）"};
photos[photos.length] = {"src": "picasso9_self_portrait.jpg", "caption": "9:自画像（１９０１、油彩）"};
photos[photos.length] = {"src": "picasso10_three_person.jpg", "caption": "10:木陰の三人の人物（1907～1908）"};
photos[photos.length] = {"src": "picasso11_minotauros.jpg", "caption": "11:夜、鳩を抱いた少女に導かれる盲目のミノタウロス（1934）"};
photos[photos.length] = {"src": "picasso12_hue.jpg", "caption": "12:牧神パンの笛（1923）"};
photos[photos.length] = {"src": "picasso13_jyacreen.jpg", "caption": "13:膝を抱えるジャクリーヌ（1954）"};
photos[photos.length] = {"src": "picasso14_doramarl.jpg", "caption": "14:ドラマールの肖像（1937）"};
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 = "270";
			photoframe.height = "383";
			document.body.appendChild(photoframe);
		}
		photoframe.src = photos[this.selectedIndex-1].src;
	}
}

