﻿var wSD4 = document.getElementById("wSD4");
var nowScrollTimes = 0;
var i_9_d_b_2_scrollTimes = 5;
var wSD4ScrollVar;
var nowScrollTimesAddVar;
var isLeftOrRight = 0;
wSD4Scroll();
function wSD4Scroll() {

    if (nowScrollTimes * 142 <= wSD4.scrollLeft && wSD4.scrollLeft < (nowScrollTimes + 1) * 142 - 10) {
        wSD4.scrollLeft += 5;
        wSD4ScrollVar = setTimeout(wSD4Scroll, 20);
    }
    else {
        clearTimeout(wSD4ScrollVar);
        clearTimeout(nowScrollTimesAddVar);
        clearTimeout(wSD4Scroll_backVar);
        clearTimeout(nowScrollTimesDecVar);
        wSD4.scrollLeft = (nowScrollTimes + 1) * 142;

        nowScrollTimesAddVar = setTimeout(nowScrollTimesAdd, 2000);
    }
}
function nowScrollTimesAdd() {
    clearTimeout(wSD4ScrollVar);
    clearTimeout(nowScrollTimesAddVar);
    clearTimeout(wSD4Scroll_backVar);
    clearTimeout(nowScrollTimesDecVar);
    nowScrollTimes++;
    if (nowScrollTimes < i_9_d_b_2_scrollTimes) {
        wSD4Scroll();
    }
    if (nowScrollTimes == i_9_d_b_2_scrollTimes) {
        wSD4Scroll_back();
        isLeftOrRight = 1;
    }
}
var wSD4Scroll_backVar;
var nowScrollTimesDecVar;
function wSD4Scroll_back() {

    if ((nowScrollTimes - 1) * 142 < wSD4.scrollLeft && wSD4.scrollLeft <= nowScrollTimes * 142) {
        wSD4.scrollLeft -= 5;
        wSD4Scroll_backVar = setTimeout(wSD4Scroll_back, 20);
    }
    else {
        clearTimeout(wSD4Scroll_backVar);
        clearTimeout(nowScrollTimesDecVar);
        clearTimeout(wSD4ScrollVar);
        clearTimeout(nowScrollTimesAddVar);
        wSD4.scrollLeft = (nowScrollTimes - 1) * 142;

        nowScrollTimesDecVar = setTimeout(nowScrollTimesDec, 2000);
    }
}
function nowScrollTimesDec() {
    clearTimeout(wSD4Scroll_backVar);
    clearTimeout(nowScrollTimesDecVar);
    clearTimeout(wSD4ScrollVar);
    clearTimeout(nowScrollTimesAddVar);
    nowScrollTimes--;
    if (nowScrollTimes > 0) {
        wSD4Scroll_back();
    }
    if (nowScrollTimes == 0) {
        wSD4Scroll();
        isLeftOrRight = 0;
    }
}





