﻿    var scrollTimer;
    var scrollCont = "#blog_container";
    var scrollCont2 = "#scroller_container";
    function scroll() {
        sb = $(scrollCont);
        cur_scroll = sb.scrollTop();
        pad = sb.innerHeight() - sb.height();
        content_h = sb.get(0).scrollHeight;
        elem_h = sb.height();

        if (elem_h < content_h && cur_scroll < (content_h - elem_h - pad)) sb.scrollTo(cur_scroll + 120, 800);
        //	if (elem_h < content_h && cur_scroll < (content_h - elem_h - pad)) sb.scrollTo(cur_scroll + elem_h, 800);

        else sb.scrollTo(0, 1000);

        scrollTimer = setTimeout(scroll, 5000);
    }

    $(function () {
        $(scrollCont).click(function () {
            clearTimeout(scrollTimer);
        });
        scrollTimer = setTimeout(scroll, 5000);
    });

    function scroll2() {
        sb = $(scrollCont2);
        cur_scroll = sb.scrollTop();
        pad = sb.innerHeight() - sb.height();
        content_h = sb.get(0).scrollHeight;
        elem_h = sb.height();

        if (elem_h < content_h && cur_scroll < (content_h - elem_h - pad)) sb.scrollTo(cur_scroll + 120, 800);
        //	if (elem_h < content_h && cur_scroll < (content_h - elem_h - pad)) sb.scrollTo(cur_scroll + elem_h, 800);

        else sb.scrollTo(0, 1000);

        scrollTimer2 = setTimeout(scroll2, 5000);
    }

    $(function() {
        $(scrollCont2).click(function() {
            clearTimeout(scrollTimer2);
        });
        scrollTimer2 = setTimeout(scroll2, 5000);
    });

