$(function() {
	
	var angle = 0;
	setInterval(function() { 
	    angle += 10; 
	    $("#bj-loding .ball div").rotate(angle); 
	}, 50);

	$('.header .nav li').hover(function() {
		navem(this);
	}, function() {
		navem('.header .nav li.current');
	});
	navem('.header .nav li.current');

	function navem(e) {
		var left = $(e).position().left+10;
		var width = $(e).innerWidth()-20;
		$(".header .nav em").stop(true).animate({
			left: left,
			width: width
		}, 300);
	}
	
	var mySwiper_banner = new Swiper('.in_banner_swiper',{
		pagination: '.in_banner_pa',
		loop:true,
		grabCursor: true,
		autoplay : 3500,
		autoplayDisableOnInteraction : false,
		paginationClickable: true
	});
	
	var miniAppsList_swiper = new Swiper ('.miniAppsList-swiper', {
	    slidesPerView: 4,
	    paginationClickable: true,
	    pagination: '.miniAppsList-pagination',
		grabCursor: true,
		autoplay: 3000,
		autoplayDisableOnInteraction : false,
	    loop:true
	})
	
	$(window).scroll(function(){
		var scrollTop=0;
		scrollTop = $(document).scrollTop();
		var a = scrollTop/1000;
	    if(a<=0.9){
	    	$(".header_w").css({"background":"rgba(0,0,0,"+a+")"});
	    }if(a>0.9){
	    	$(".header_w").css({"background":"rgba(0,0,0,0.9)"});
	    }
	});
	
	$(".in_case_list li").hover(function(){
		$(this).find(".l1").stop().animate({"width":"100%"});
		$(this).find(".l2").stop().animate({"height":"100%"});
		$(this).find(".l3").stop().animate({"width":"100%"});
		$(this).find(".l4").stop().animate({"height":"100%"});
	},function(){
		$(this).find(".l1").stop().animate({"width":"0"});
		$(this).find(".l2").stop().animate({"height":"0"});
		$(this).find(".l3").stop().animate({"width":"0"});
		$(this).find(".l4").stop().animate({"height":"0"});
	});
	
	$(".app_service_list li").hover(function(){
		$(this).find(".mask").stop().fadeIn();
		$(this).find(".li_c").stop().animate({"padding":"30px 0 80px;"});
	},function(){
		$(this).find(".mask").stop().fadeOut();
		$(this).find(".li_c").stop().animate({"padding":"40px 0 70px;"});
	})
	
	$(".app_advantage li").hover(function(){
		$(this).find(".icon").stop().animate({"top":"-55px"}).animate({"top":"-46px"});
	},function(){
		$(this).find(".icon").stop().animate({"top":"-46px"});
	})
	
	$(".web_advantage_list li").hover(function(){
		$(this).find(".line").stop().fadeOut();
		$(this).find(".mask").stop().fadeIn();
		$(this).find(".li_c").stop().delay(200).animate({"padding-top":"35%"});
		$(this).find(".des").stop().delay(400).fadeIn();
	},function(){
		$(this).find(".line").stop().fadeIn();
		$(this).find(".mask").stop().fadeOut();
		$(this).find(".li_c").stop().animate({"padding-top":"45%"});
		$(this).find(".des").stop().fadeOut();
	})
	
	$(".caseList li").hover(function(){
		$(this).find(".mask").stop().fadeIn();
		$(this).find(".title").stop().animate({"bottom":"50%","opacity":"1"});
		$(this).find(".des").stop().delay(200).animate({"bottom":"38%","opacity":"1"});
	},function(){
		$(this).find(".mask").stop().fadeOut();
		$(this).find(".title").stop().animate({"bottom":"-40px","opacity":"0"});
		$(this).find(".des").stop().animate({"bottom":"-40px","opacity":"0"});
	})
	
	setTimeout(function () {
		setTimeout(function () {
			$(".page_banner_mask .p1").animate({"top":"0","opacity":"1"});
		}, 400);
		setTimeout(function () {
			$(".page_banner_mask .p2").animate({"top":"0","opacity":"1"});
		}, 800);
		setTimeout(function () {
			$(".page_banner_mask .btn").animate({"top":"0","opacity":"1"});
		}, 1200);
		setTimeout(function () {
			$(".page_banner_mask .text").animate({"top":"0","opacity":"1"});
		}, 1600);
		
		setTimeout(function () {
			$(".caseDetail_banner_mask .title").animate({"top":"0","opacity":"1"});
		}, 400);
		setTimeout(function () {
			$(".caseDetail_banner_mask .des").animate({"top":"0","opacity":"1"});
		}, 800);
		setTimeout(function () {
			$(".caseDetail_banner_mask .btn").animate({"top":"0","opacity":"1"});
		}, 1200);
	}, 0);
	
	var $window = $(window),
		win_height_padded = $window.height() * 1.1;
	$window.on('scroll', revealOnScroll);
	function revealOnScroll() {
		var scrolled = $window.scrollTop();
		$(".isAnimation:not(.animated)").each(function () {
			var $this = $(this),
				offsetTop = $this.offset().top;
			if (scrolled + win_height_padded > offsetTop) {
				if ($this.data('timeout')) {
				 	window.setTimeout(function(){
				 		$this.addClass('animated ' + $this.data('animation'));
				 		$this.removeClass("isAnimation");
				 	}, parseInt($this.data('timeout'),10));
				} else {
					$this.addClass('animated ' + $this.data('animation'));
					$this.removeClass("isAnimation");
				}
			}
		});
	}
	
	//banner视差效果
	$(window).scroll(function() {
        var top = $(window).scrollTop() / 2;
        $(".bgimg").css('top', top);
    });
    
	$("#side ul .li").hover(function(){
		$(this).find(".sidebox").stop().animate({"width":"180px"}).css({"opacity":"1","filter":"Alpha(opacity=100)"});
	},function(){
		$(this).find(".sidebox").stop().animate({"width":"54px"}).css({"opacity":"0.8","filter":"Alpha(opacity=80)"});
	});

	$("#side ul .code").hover(function() {
		//setTimeout(function() {
			$("#side .code_img").stop().fadeIn();
		//}, 100)
	}, function() {
		$("#side .code_img").stop().fadeOut();
	})

	//回到顶部函数
	$("#side .sidetop").click(function(){
		$('html,body').animate({'scrollTop':0},300);
	});
    
});