var photosRoot = "../i/photos/s/";
var photoRoot = "../i/photos/";

var imglist = new Array(
  "img00.jpg",
  "img01.jpg",
  "img02.jpg",
  "img03.jpg",
  "img04.jpg",
  "img05.jpg",
  "img06.jpg",
  "img07.jpg",
  "img08.jpg",
  "img09.jpg",
  "img10.jpg",
  "img11.jpg",
  "img12.jpg",
  "img13.jpg",
  "img14.jpg",
  "img15.jpg",
  "img16.jpg",
  "img17.jpg",
  "img18.jpg",
  "img19.jpg",
  "img20.jpg",
  "img21.jpg",
  "img22.jpg",
  "img23.jpg",
  "img24.jpg",
  "img25.jpg",
  "img26.jpg",
  "img27.jpg",
  "img28.jpg",
  "img29.jpg",
  "img30.jpg",
  "img31.jpg");
  
var imglist_ = [
["img00.jpg","白い花"],
["img01.jpg","木漏れ日::-ハンガリー，エゲルにて-"],
["img02.jpg","まど::-ハンガリー，エゲルにて-"],
["img03.jpg","小川::-ハンガリー，エゲルにて-"],
["img04.jpg","日の当たる家::-ハンガリー，ブダペストにて-"],
["img05.jpg","広場::-ハンガリー，エゲルにて-"],
["img06.jpg","通り::-ハンガリー，エゲルにて-"],
["img07.jpg","門::-ハンガリー，エゲルにて-"],
["img08.jpg","大聖堂::-ハンガリー，エゲルにて-"],
["img09.jpg","ひまわり::-ハンガリー，エゲルにて-"],
["img10.jpg","駅"],
["img11.jpg","バッグと時計::-オーストリア，ウィーンにて-"],
["img12.jpg","標識::-オーストリア，ウィーンにて-"],
["img13.jpg","パンとスープ::-オーストリア，ウィーンにて-"],
["img14.jpg","盆栽::-中国，上海??にて-"],
["img15.jpg","石畳::-中国，上海にて-"],
["img16.jpg","門::-中国，上海付近にて-"],
["img17.jpg","夜景::-ニュージーランド，オークランドにて-"],
["img18.jpg","船倉庫::-ニュージーランド，ウィリントンにて-"],
["img19.jpg","オペラハウス::-オーストラリア，シドニーにて-"],
["img20.jpg","寺の屋根::-滋賀県，彦根にて-"],
["img21.jpg","特別公開のとき::-滋賀県，彦根にて-"],
["img22.jpg","黄昏時::-神奈川県，横浜にて-"],
["img23.jpg","横浜ビル::-神奈川県，横浜にて-"],
["img24.jpg","デザイン東京::-東京にて-"],
["img25.jpg","ぞうさん::-大阪府，天王寺にて-"],
["img26.jpg","プリモプエル::-東京都，浅草にて-"],
["img27.jpg","せんべい::-東京都，浅草にて-"],
["img28.jpg","新美術館::-東京都，六本木にて-"],
["img29.jpg","桜"],
["img30.jpg","桜アップ"],
["img31.jpg","船の待ち合い所"]];

function randPhotoArray() {
  var start,num;
  start = Math.floor(Math.random() * imglist.length);
  
  for(num=0; num<imglist_.length; num++) {
  	img = imglist_[(start+num)%imglist_.length];
    document.write('<div id="pict">'+"\n");
    document.write('<a href="'+photoRoot+img[0]+'" class="lightview" title="'+img[1]+'" rel="gallery">');
    document.write('<img src="'+photosRoot+img[0]+'" class="pict-p" alt="">');
    document.write('</a>'+"\n"+'</div>');
  }

}

function randimage(){
  x = Math.floor(Math.random() * imglist.length);
  y = Math.floor(Math.random() * imglist.length);
  if(x == y) y = (y+1)%imglist.length;
  document.getElementById("imgframe1").src = photosRoot+imglist[x];
  document.getElementById("imgframe1_").href = photoRoot+imglist[x];
  document.getElementById("imgframe2").src = photosRoot+imglist[y];
  document.getElementById("imgframe2_").href = photoRoot+imglist[y];
  document.getElementById("imgframe3").src = photosRoot+imglist[(y+1)%imglist.length];
  document.getElementById("imgframe3_").href = photoRoot+imglist[(y+1)%imglist.length];
  document.getElementById("imgframe4").src = photosRoot+imglist[(y+2)%imglist.length];
  document.getElementById("imgframe4_").href = photoRoot+imglist[(y+2)%imglist.length];
  document.getElementById("imgframe5").src = photosRoot+imglist[(y+3)%imglist.length]; 
  document.getElementById("imgframe5_").href = photoRoot+imglist[(y+3)%imglist.length];
  document.getElementById("imgframe6").src = photosRoot+imglist[(y+4)%imglist.length];
  document.getElementById("imgframe6_").href = photoRoot+imglist[(y+4)%imglist.length];
  document.getElementById("imgframe7").src = photosRoot+imglist[(y+5)%imglist.length];
  document.getElementById("imgframe7_").href = photoRoot+imglist[(y+5)%imglist.length];
  imgframe8.src = photosRoot+imglist[(y+6)%imglist.length]; imgframe8_.href = photoRoot+imglist[(y+6)%imglist.length];
  imgframe9.src = photosRoot+imglist[(y+7)%imglist.length]; imgframe9_.href = photoRoot+imglist[(y+7)%imglist.length];
  imgframe10.src = photosRoot+imglist[(y+8)%imglist.length]; imgframe10_.href = photoRoot+imglist[(y+8)%imglist.length];
  imgframe11.src = photosRoot+imglist[(y+9)%imglist.length]; imgframe11_.href = photoRoot+imglist[(y+9)%imglist.length];
  imgframe12.src = photosRoot+imglist[(y+10)%imglist.length]; imgframe12_.href = photoRoot+imglist[(y+10)%imglist.length];
  imgframe13.src = photosRoot+imglist[(y+11)%imglist.length]; imgframe13_.href = photoRoot+imglist[(y+11)%imglist.length];
  imgframe14.src = photosRoot+imglist[(y+12)%imglist.length]; imgframe14_.href = photoRoot+imglist[(y+12)%imglist.length];
  imgframe15.src = photosRoot+imglist[(y+13)%imglist.length]; imgframe15_.href = photoRoot+imglist[(y+13)%imglist.length];
  imgframe16.src = photosRoot+imglist[(y+14)%imglist.length]; imgframe16_.href = photoRoot+imglist[(y+14)%imglist.length];
  imgframe17.src = photosRoot+imglist[(y+15)%imglist.length]; imgframe17_.href = photoRoot+imglist[(y+15)%imglist.length];
  imgframe18.src = photosRoot+imglist[(y+16)%imglist.length]; imgframe18_.href = photoRoot+imglist[(y+16)%imglist.length];
  imgframe19.src = photosRoot+imglist[(y+17)%imglist.length]; imgframe19_.href = photoRoot+imglist[(y+17)%imglist.length];
  imgframe20.src = photosRoot+imglist[(y+18)%imglist.length]; imgframe20_.href = photoRoot+imglist[(y+18)%imglist.length];
  imgframe21.src = photosRoot+imglist[(y+19)%imglist.length]; imgframe21_.href = photoRoot+imglist[(y+19)%imglist.length];
  imgframe22.src = photosRoot+imglist[(y+20)%imglist.length]; imgframe22_.href = photoRoot+imglist[(y+20)%imglist.length];
  imgframe23.src = photosRoot+imglist[(y+21)%imglist.length]; imgframe23_.href = photoRoot+imglist[(y+21)%imglist.length];
  imgframe24.src = photosRoot+imglist[(y+22)%imglist.length]; imgframe24_.href = photoRoot+imglist[(y+22)%imglist.length];
  imgframe25.src = photosRoot+imglist[(y+23)%imglist.length]; imgframe25_.href = photoRoot+imglist[(y+23)%imglist.length];
  imgframe26.src = photosRoot+imglist[(y+24)%imglist.length]; imgframe26_.href = photoRoot+imglist[(y+24)%imglist.length];
  imgframe27.src = photosRoot+imglist[(y+25)%imglist.length]; imgframe27_.href = photoRoot+imglist[(y+25)%imglist.length];
  imgframe28.src = photosRoot+imglist[(y+26)%imglist.length]; imgframe28_.href = photoRoot+imglist[(y+26)%imglist.length];
  imgframe29.src = photosRoot+imglist[(y+27)%imglist.length]; imgframe29_.href = photoRoot+imglist[(y+27)%imglist.length];
}
/*
var imageRoot="http://www-sens.sys.es.osaka-u.ac.jp/users/goshiro/i/";
    if (document.images) {
        imgJapnese = new Image(); imgApps.src = imageRoot+"japanese1.gif";
        imgEnglish = new Image(); imgDocs.src = imageRoot+"english1.gif";
    }

function imgChange(imgNum,imgSrc) {
document.images[imgNum].src = imageRoot+imgSrc;
}*/

/* switch language button */
function switchLanguage() {
	var _query = $.query.get('la');
	if( _query == 'jp' ) {
		$("div.en").toggle();
		$("li a").each(function() {
			var _url = $(this).attr("href").split("?");
			$(this).attr("href", _url[0]+"?la=jp");
		});
		$("a.switch_button").toggle(function() {
			$(this).addClass("swap");
			$("div.jp").fadeOut("fast");
			$("div.jp").toggle();
			$("div.en").fadeIn("fast");
			$("a").each(function() {
				var _url = $(this).attr("href").split("?");
				$(this).attr("href", _url[0]+"?la=en");
			});
		}, function() {
			$(this).removeClass("swap");
			$("div.en").fadeOut("fast");
			$("div.en").toggle();
			$("div.jp").fadeIn("fast");
			$("a").each(function() {
				var _url = $(this).attr("href").split("?");
				$(this).attr("href", _url[0]+"?la=jp");
			});
		});
	} else {
		$("a.switch_button").addClass("swap");
		$("div.jp").toggle();
		$("li a").each(function() {
			var _url = $(this).attr("href").split("?");
			$(this).attr("href", _url[0]+"?la=en");
		});
		$("a.switch_button").toggle(function() {
			$(this).removeClass("swap");
			$("div.en").fadeOut("fast");
			$("div.en").toggle();
			$("div.jp").fadeIn("fast");
			$("a").each(function() {
				var _url = $(this).attr("href").split("?");
				$(this).attr("href", _url[0]+"?la=jp");
			});
		}, function() {
			$(this).addClass("swap");
			$("div.jp").fadeOut("fast");
			$("div.jp").toggle();
			$("div.en").fadeIn("fast");
			$("a").each(function() {
				var _url = $(this).attr("href").split("?");
				$(this).attr("href", _url[0]+"?la=en");
			});
		});
	}
}
