// ------------------------------------------------------------------------------
//  top js
// ------------------------------------------------------------------------------
/*

   01........ホテル情報

*/


// ------------------------------------------------------------------------------
// ***01 ホテル情報***
// ------------------------------------------------------------------------------

var currentIndex = 0;

$(function(){
	$("body.topPage div#hotelInfoSection ul li a").mouseover(function(){
		currentIndex= $("body.topPage div#hotelInfoSection ul li a").index(this);//何番目の<a>が選択されたかを取得
	});
});


$(function(){
		   
	$("body.topPage div#hotelInfoSection div:gt(0)").hide();//2個目以降の<div>を隠す 	
		
	var blockChange = function(){
		$("body.topPage div#hotelInfoSection li").removeClass("stay");//ホテルメニューら.stayを削除
		$("body.topPage div#hotelInfoSection li:eq("+currentIndex+")").addClass("stay");//該当するホテルメニューに.stayを付加
		$("body.topPage div#hotelInfoSection div").removeClass("stayBlock");//ホテル情報ブロックから.stayBlockを削除
		$("body.topPage div#hotelInfoSection div:eq("+currentIndex+")").addClass("stayBlock");//該当するホテル情報ブロックに.stayBlockを付加
		$("body.topPage div#hotelInfoSection div:not(.stayBlock)").fadeOut("500",function(){
				$("body.topPage div#hotelInfoSection div.stayBlock").fadeIn("500");
			});
	}
	

	//時間制御
	//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	var currentIndexPlus = function(){
		if (currentIndex < 4){
			currentIndex++;
		}
		else {
			currentIndex = 0;
		}
		blockChange();
	}
	
	var timer
	timer = setInterval(currentIndexPlus,5000);
	

	//マウスオーバー時の処理
	//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	$("body.topPage div#hotelInfoSection").mouseover(function(){
		clearInterval(timer);													  	
		blockChange();
	});

	//マウスアウト時の処理
	//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	$("body.topPage div#hotelInfoSection").mouseout(function(){
		timer = setInterval(currentIndexPlus,5000);
	});	
	


});











