/*

	トップページメインビジュアルスクリプト
	lastupdate 07/10/03

	Update history
	07/10/03 Ver1.0		制作。
	
	Copyright NDS All Right Reserved.

===============================================================================*/
/*
	変数宣言

-------------------------------------------------------------------------------*/
var Top_Img = new Array();
Top_Img[0] = "index_main_01.jpg";
Top_Img[1] = "index_main_02.jpg";
Top_Img[2] = "index_main_03.jpg";

Prop = {
	Set_Time:4000,
	Img_Count:Top_Img.length,
	Count:Rand(Top_Img.length)
};


/*===============================================================================

	スクリプト本体

-------------------------------------------------------------------------------*/
//img先読み
var Img_Obj = new Array();
for(var i=0;i<Prop.Img_Count;i++){
	Img_Obj[i] = document.createElement("img");
	Img_Obj[i].src ="img/" + Top_Img[i];
}

function set_Img(){
	var H1_Img = document.getElementsByTagName("h1")[0];
	H1_Img.replaceChild(Img_Obj[Prop.Count],H1_Img.firstChild);
	
	var ClearID = setInterval("Time_Img()",Prop.Set_Time);
}

function Time_Img(H1_Img){
	var H1_Img = document.getElementsByTagName("h1")[0];
	(Prop.Count < Prop.Img_Count-1) ? Prop.Count++ : Prop.Count=0;
	H1_Img.replaceChild(Img_Obj[Prop.Count],H1_Img.firstChild);

}

window.onload = set_Img;

//------------------------------------------------------------------------------
//	乱数
//------------------------------------------------------------------------------
function Rand(x){
	number=Math.floor(Math.random()*x);
	return number;
}



