﻿$(function(){
/*	var toptxt=$("#top10").html();
	toptxt = toptxt.replace(/\$id/g,hotel[0]['id']).replace("$price",hotel[0]['price']).replace("$counter_price",hotel[0]['counter_price']);
	toptxt = toptxt.replace("$name",hotel[0]['name']).replace("$special_note",hotel[0]['special_note']);
    $("#top10").html(toptxt);
*/
     var len2  = $("#idNum2 > li").length;
	 var index2 = 0;
	 $("#idNum2 li").mouseover(function(){
		index2  =   $("#idNum2 li").index(this);
		showImg2(index2);
	});	
	 //滑入 停止动画，滑出开始动画.
	 $('#idTransformView2').hover(function(){
			  if(MyTime2){
				 clearInterval(MyTime2);
			  }
	 },function(){
			  MyTime2 = setInterval(function(){
			    showImg2(index2)
				index2++;
				if(index2==len2){index2=0;}
			  } , 4000);
	 });
	 //自动开始
	 var MyTime2 = setInterval(function(){
		showImg2(index2)
		index2++;
		if(index2==len2){index2=0;}
	 } , 4000);
})
// Demo2 : 关键函数：通过控制left ，来显示不通的幻灯片
function showImg2(i){
		$("#idSlider2").stop(true,false).animate({left : -300*i},800);
		 $("#idNum2 li")
			.eq(i).addClass("on")
			.siblings().removeClass("on");
}
