//var thisHeightLists = [];
//var thisWrapper = null;
//var thisScrollY = 0;
//var thisIndex = 0;
$(function () {
    initWrapperTop();
    $(".kj-category").click(function () {
        var index = $(".kj-category").index(this);
        $(".kj-category").removeClass("kj-active").eq(index).addClass("kj-active");
        $(".kj-item-wrapper").removeClass("kj-item-active").eq(index).addClass("kj-item-active");
        if (index == 2) {
            $(".v-item-list").removeClass("active").eq(0).addClass("active");
            $(".kj-high-lottery-category").removeClass("kj-active").eq(0).addClass("kj-active");
        }
        //if (index == 2 && thisWrapper == null) {
        //    setTimeout(initScroll, 500);
        //}
    })
    $(".kj-high-lottery-category").click(function () {
        var index = $(".kj-high-lottery-category").index(this);
        $(".kj-high-lottery-category").removeClass("kj-active").eq(index).addClass("kj-active");
        $(".v-item-list").removeClass("active").eq(index).addClass("active");
        $(".content").scrollTop(0);
        //var itemLists = document.getElementsByClassName("v-item-list");
        //var el = itemLists[index];
        //thisWrapper.scrollToElement(el, 300);
    })

})
function initWrapperTop() {
    $("#ads-wrapper").show();
    setTimeout(function () {
        var h1 = $("#ads-wrapper").height();
        var h = h1 + 43;
        $("#wrapper1").css({ top: h + "px" })
    }, 150);
}
//function initScroll() {
//    var wrapper = document.getElementById("wrapper");
//    thisWrapper = new BScroll(wrapper, {
//        probeType: 3,
//        click: true
//    });
//    var height = 0;
//    thisHeightLists.push(height);
//    var itemLists = document.getElementsByClassName("v-item-list");
//    for (var i = 0; i < itemLists.length; i++) {
//        height += itemLists[i].clientHeight;
//        if (i == 2) {
//            height = height - 2;
//        }
//        console.log("height", height);
//        thisHeightLists.push(height);
//    }
//    thisWrapper.on("scroll", function (pos) {
//        thisScrollY = Math.abs(Math.round(pos.y));
//        for (var i = 0; i < thisHeightLists.length; i++) {
//            var height1 = thisHeightLists[i];
//            var height2 = thisHeightLists[i + 1];
//            if (!height2 || (thisScrollY >= height1 && thisScrollY < height2)) {
//                console.log("thisIndex", thisIndex);
//                console.log("thisHeightLists", thisHeightLists)
//                console.log("thisScrollY", thisScrollY)
//                thisIndex = i;
//                break;
//            }
//        }
//        $(".kj-high-lottery-category").removeClass("kj-active").eq(thisIndex).addClass("kj-active");
//    })
//}