window.onload = function () {
    // 公司宣传视频
    var company_video = document.getElementById("company_video")
    // company_video.style.width = window.screen.width + "px";
    company_video.style.height = window.screen.height - 170 + "px";
    
    // 视差滚动
    $.stellar({
        horizontalScrolling: false,
            responsive: true
    });

    var photo = document.getElementById("person_photo");
    var photo_single =  photo.getElementsByTagName("li")
    var content_single = document.getElementsByClassName("personage")

    for(var i = 0;i < photo_single.length ; i++){
        photo_single[i].index = i;
        photo_single[i].onmouseover = function(){
            for(var a = 0; a < photo_single.length ; a++){
                photo_single[a].classList.remove("li_hover")
                content_single[a].style.display="none";
            } 
            photo_single[this.index].classList.add("li_hover")
            content_single[this.index].style.display = "block";
        }
    }

    // 视频轮播
    var video_banner = document.getElementById("video_banner");
    var video_box = video_banner.getElementsByClassName("video_box")[0]
    var video_single = video_banner.getElementsByTagName("li");
    var timer=null;
    var speed=-2;
    video_box.innerHTML+=video_box.innerHTML;
    video_box.style.width=(video_single[0].offsetWidth+25)*video_single.length+"px"

    function autoPlay(){  
        timer=setInterval(function(){
            video_box.style.left=video_box.offsetLeft+speed+"px";
            if(video_box.offsetLeft<-video_box.offsetWidth/2){     
                video_box.style.left="0px";       
            }else if(video_box.offsetLeft>0){
                video_box.style.left=-video_box.offsetWidth/2+"px";
            }
        },14);
    }
    autoPlay();
    video_banner.onmouseover=function(){
        clearInterval(timer);
    };
    video_banner.onmouseout=function(){
        autoPlay();
    }
}