
$(".banner").slide({ titCell:".bantil li", mainCell:".bd ul", effect:"fold",  autoPlay:true, delayTime:700,prevCell:".prev01",nextCell:".next01"});
$(".banner").hover(function () {
        $(this).find(".prev01,.next01").stop(true, true).fadeTo("show", 0.5)
    }, function () {
        $(this).find(".prev01,.next01").fadeOut()
    });
    
// 搜索
var key = document.getElementById("key");
	function searchInfo() {
		var base = $('head').data('base');
		if (key.value) {
			location.href = base + "search.php?key=" + key.value;
		} else {
			alert('请输入关键词....');
		}
	}
	key.addEventListener('keypress', function(event) {
		var keycode = event.keycode || event.which;
		if (keycode == "13") {
			searchInfo();
		}
	});

$(".pro2").slide({titOnClassName:'cur',titCell: ".prot h3", mainCell: ".pro3",effect:"fold", autoPlay: false });
$(".pro1").slide({mainCell:".pro4 ul",autoPlay:true,effect:"leftMarquee",vis:4,interTime:50,trigger:"click"});

$(document).ready(function() {
	$(".video2 li").mouseover(function() {
		$(this).addClass("cur").siblings('li').removeClass('cur');
	})
});

$(".par").slide({mainCell:".par1 ul",autoPlay:true,effect:"leftMarquee",vis:5,interTime:50,trigger:"click",prevCell:".par_l",nextCell:".par_r"});

$(".dy").slide({targetCell:".dyt h5 a",titOnClassName:'cur',titCell: ".dyt h3", mainCell: ".dy1",effect:"fold", autoPlay: false, });	

$(".faq").slide({mainCell:".faq2",autoPlay:true,effect:"topMarquee",vis:3,interTime:50,trigger:"click"});


//数字增加动画
    $.fn.countTo = function(options) {
        options = $.extend({}, $.fn.countTo.defaults, options || {});
        var loops = Math.ceil(options.speed / options.refreshInterval),
            increment = (options.to - options.from) / loops;

        return $(this).each(function() {
            var _this = this,
                loopCount = 0,
                value = options.from,
                interval = setInterval(updateTimer, options.refreshInterval);

            function updateTimer() {
                value += increment;
                loopCount++;
                $(_this).html(value.toFixed(options.decimals));

                if (typeof(options.onUpdate) == 'function') {
                    options.onUpdate.call(_this, value);
                }

                if (loopCount >= loops) {
                    clearInterval(interval);
                    value = options.to;

                    if (typeof(options.onComplete) == 'function') {
                        options.onComplete.call(_this, value);
                    }
                }
            }
        })
    };
        function countadd(){
            var count = 0;
            count++;
            $('.ibrand-num li').each(function(){
                dataperc = $(this).attr('data-perc'),
                $(this).find('.num').delay(6000).countTo({
                from: 0,
                to: dataperc,
                speed: 4000,
                refreshInterval: 450
                });
            });
        }
        function scrolltop(){
            var top = $(window).scrollTop();
            var htop = $('.num').offset().top - $(window).height()/3;
            if(top>=htop){
                countadd();
                $('.ibrand-num').removeClass('ani');
                
            }
        }
        scrolltop();

        $(window).scroll(function(){
            scrolltop();
    
        });