$(function() {
/*窗口变化时运行*/
$(window).resize(function() {
	
});
	
});
$(function() {
 $(".popup-bg").height($(document).height());
 $(".popup").css("margin-top","400px");
 $("#close-btn").click(function(){
  $(".popup-bg").hide();
  return false;
 });
 $("#popup-link").click(function(){
  $(".popup-bg").show();
  return false;
 });
})
$(function(){
	var page = 1;
	var index = 0;
    var n_img = 1; //每版放1个图片
	var v_width = $("#list-1 li").outerWidth()*n_img; //滚动的宽度
	var speed = 800;//速度
	var len = $("#list-1").find("li").length;
	var page_count = Math.ceil(len / n_img) ;
	$("#list-1").width($("#list-1 li").outerWidth()*len).parent().height($("#list-1").height());
	
	$("#home-banner-nav li a").click(function(){
   		index =   $("#home-banner-nav li a").index(this);
   		showImg(index);
		return false;
	}); 
	var MyTime = setInterval(function(){
			showImg(index);
		 	index++;
			if(index==len){index=0;}
		 } , 3000);
	$('#home-banner').hover(function(){
		 if(MyTime){
		 clearInterval(MyTime);
		 }
	},function(){
		 MyTime = setInterval(function(){
		   showImg(index);
		 index++;
		 if(index==len){index=0;}
		 } , 3000);
	});
	
	function showImg(i){
		if(i==0)
		$("#list-1").stop(true,false).animate({left : -v_width*i},1);
		else
		$("#list-1").stop(true,false).animate({left : -v_width*i},speed);
		$("#home-banner-nav").find("a").removeClass("hover-on");
		$("#home-banner-nav").find("a").eq(i).addClass("hover-on");
		page = i+1;
	}
});
$(function(){
	var page = 1;
	var index = 0;
    var n_img = 1; //每版放1个图片
	var v_width = $("#list-2 li").outerWidth()*n_img; //滚动的宽度
	var speed = 800;//速度
	var len = $("#list-2").find("li").length;
	var page_count = Math.ceil(len / n_img) ;
	$("#list-2").width($("#list-2 li").outerWidth()*len).parent().height($("#list-2").height());
	
	$("#home-bottom-nav li a").click(function(){
   		index =   $("#home-bottom-nav li a").index(this);
   		showImg(index);
		return false;
	}); 
	var MyTime = setInterval(function(){
		   showImg(index);
		 index++;
		 if(index==len){index=0;}
		 } , 6000);
	$('#home-bottom').hover(function(){
		 if(MyTime){
		 clearInterval(MyTime);
		 }
	},function(){
		 MyTime = setInterval(function(){
		   showImg(index);
		 index++;
		 if(index==len){index=0;}
		 } , 6000);
	});
	
	function showImg(i){
		$("#list-2").stop(true,false).animate({left : -v_width*i},speed);
		$("#home-bottom-nav").find("a").removeClass("hover-on");
		$("#home-bottom-nav").find("a").eq(i).addClass("hover-on");
		page = i+1;
	}
});
