function autoplay() {
index++;
if (index >= list.length) {
index = 0;
}
changeoption(index);
}
function changeoption( curIndex){
for (var j = 0; j < list.length; j++) {
list[j].className = ""
}
list[curIndex].className = "on";
pic.style.marginTop = -170 * (curIndex) + "px";
index = curIndex;
                }
                function tab() {
                    for (var i = 0; i < list.length; i++) {
                        list[i].id = i;
                        list[i].onmouseover = function () {
                            clearInterval(timer);
                            changeoption(this.id);
                        }
                        list[i].onmouseout = function () {
                            clearInterval(timer);
                            timer = setInterval(autoplay, 2000)
                        }
                    }
                    clearInterval(timer);
                    timer = setInterval(autoplay, 2000)
                }
                tab();
        }