/* Indexページの読み込み完了 */
function TopBodyLoad(){
	TopBmpChange();
	SetSlideTimer(5000);
}
/* Top画像randomチェンジ */
function TopBmpChange(){
	num = 0;
	num = Math.floor(Math.random() * 14);
	document.TopBmp.src= "top/top_" + num + ".jpg";
}

/* スライドショーのタイマーセット */
function SetSlideTimer(msec)
{
	setInterval("TopSlideShow(Folder)", msec);
	TopSlideShow();
}

/* スライドショー */
function TopSlideShow(){
	/* ToDo */
	MainMinNum = 1		/* ToDo */
	MainMaxNum = 1;	/* ToDo */
	SubMaxNum = 57;
/*	Folder = "20100418"	*//* ToDo */
	Folder = "111030"	/* ToDo */
	count = 0;

	FilePath = "";
	do{
		MainNum = 0;
		SubNum = 0;
		
		MainNum = Math.floor((Math.random() * (MainMaxNum - MainMinNum)) + MainMinNum/* 最大値 */);
		SubNum = Math.floor(Math.random() * SubMaxNum/* 最大値 */);
		
/*		MainNum++;
		SubNum++;
*/		
		FilePath = 
			"./gallery/event/Data/" + Folder + "/s/" + MainNum + "-" + SubNum + ".jpg"; 	/* ToDo */
/*			"./gallery/other/Data/" + Folder + "/s/" + MainNum + "-" + SubNum + ".jpg";*/

		count++;
		if(count > 10){
			break;
		}

	}while(false == ShowBmp(FilePath));

}

/* 画像が存在すれば表示 */
function ShowBmp(FilePath)
{
    var img = new Image();
    img.src = FilePath;

	if(img.height > 40){
		document.TopSlideBmp.src = FilePath;
		return true;
	}else{
		return false;
	}
}

/* 更新日時表示 */
function LastUpDataTime(){
	document.writeln("Last update：" + document.lastModified);
}

/* イイネボタン表示 */
function IineButton(){
	/* イイネ facebook */
	document.write('<iframe src="http://www.facebook.com/plugins/like.php?app_id=129485957141569&amp;href=http%3A%2F%2Fgata.in&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>');

	/* mixi */
	document.write('<iframe scrolling="no" frameborder="0" allowTransparency="true" style="overflow:hidden; border:0; width:80px; height:20px" src="http://plugins.mixi.jp/favorite.pl?href=http%3A%2F%2Fgata.in&service_key=3b642cd2fdb64d1a0bc8fbfe3bb8c72538a3de7c&show_faces=false&width=80"></iframe>');

	/* twitter */
	document.write('　' + '<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://gata.in" data-count="horizontal" data-lang="ja">' + 'ツイートする' + '</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js" charset="utf-8"></script>');
}


