$(function(){    
    
    // 轮播图
    var i=0,
    auto,
    att=$(".banner .banner_ul li").length;
//     heights=$(window).height(),
//     widths=$(window).width();  
//     $(".banner .banner_ul").css("width","100%");
//     $(".banner .banner_ul li").css("height",heights+"px");
//     $(".banner .banner_ul li img").css({"height":heights+"px","width":widths+"px"});
//     $(".header").css({"height":heights+"px","width":widths+"px"}); 
    $(".banner .banner_ul li").eq(0).show().siblings().hide();
    $('.banner .banner_ol li').eq(0).addClass('banner_list').siblings().removeClass('banner_list');
    autoitm();
    //滑过
     $(".banner .banner_ol li").hover(function(){
        clearInterval(auto);
         i=$(this).index();
        autoban();
     },function(){
       autoitm();
	});
     
     function autoban(){
     	  $(".banner .banner_ul li").eq(i).stop(true,true).fadeIn(600).siblings().stop(true,true).fadeOut(600);      
       $(".banner .banner_ol li").eq(i).stop(true,true).addClass('banner_list').siblings().stop(true,true).removeClass('banner_list');
     };
     function autoitm(){
     	auto=setInterval(function(){
			 i++;
      if(i>att-1){
      	i=0;
      }
       autoban();
	},3000);
     };
     //手机版本
     
     $(".logo_nav").click(function(){
          $(".nav_ul").toggle();            
     })    
   
})

$(function(){
     $('.nav_ul li').hover(function(){
            a=$(this).index();  
           $(this).find('ul').show();
           $(this).css('background-color','rgba(99,99,99,.8)');
   // $('.nav_ul li a').eq(a).fadeIn(600).siblings().fadeOut(1000);
  
     },function(){
          $(this).find('ul').hide();
          $(this).css('background-color','rgba(0,0,0,0)');
     })
  })
  $(function(){
     
     window.onscroll = function () { 
          var myDiv = $(".nav");
          if (getScrollTop() >= 10) { 
               myDiv.css('background-color','rgba(0,47,106,0.8)');
          } else{
               myDiv.css('background-color','rgba(0,47,106,0)');
          }
     } 
     
     function getScrollTop() { 
     var scrollTop = 0; 
     if (document.documentElement && document.documentElement.scrollTop) { 
     scrollTop = document.documentElement.scrollTop; 
     } 
     else if (document.body) { 
     scrollTop = document.body.scrollTop; 
     } 
     return scrollTop; 
     } 
  })
  
  //弹框效果
$(function(){
	var widths=$(window).width(),heights=$(window).height(),texts=$(".lay .layDiv b").text();

	countDown(texts);
	$(".lay .layDiv span").click(function(){
	jump();
	
	})
	$(".lay").css({
		//"width":"1000px",
		//"height":"500px",
         "width":widths,
		 "height":heights,
		"margin":"0 auto",
		//"margin-left":"20%",		
		"background-image":"url(/public/static/modules/cms/img/lb2.jpg)",
		//"background-image":"url(images/bgs3.jpg)",
		"background-size":"100% 100%",
		"background-repeat":"norepeat"	,
        "display": "flex"	,
        "top":"0",
        "left":"0"		
	})
	function countDown(index){
		if(index>0){
			setTimeout(function(){
				index--;
				$(".lay .layDiv b").text(index);
                countDown(index)
                
			},1000)
			
		
		}else{
				jump();
				
			}
		
	}
	function jump(){
		$(".lay").stop(true,true).hide(800);
		
		tabtimes();
		
	}

		
	function tabtimes(){
	var n=0,
    autos,
    atts=$(".lay-img .lay-imga").length;
    $(" .lay-img .lay-imga").eq(0).show();
      autoitms();
      function autobans(){
     	  $(".lay-img .lay-imga").eq(n).stop(true,true).fadeIn(600).stop(true,true).siblings().fadeOut(600);     
     	return;
         
     };
     function autoitms(){
     	autos=setInterval(function(){
			 n++;
      if(n>atts-1){
      	n=0;
      }
       autobans(event);
	},6000);
     };
	}

    	tabtimes();	 
})