﻿var scroller;

$(document).ready(function() {
    if (PromosGridView.GetPageCount() > 1) {
        $("#promoup").show();
        $("#promodown").show();
        scroller = window.setInterval(function() {
            if (PromosGridView.GetPageIndex() == PromosGridView.GetPageCount() - 1) {
                PromosGridView.GotoPage(0);
            }
            else {
                PromosGridView.NextPage();
            }
        }, 10000);
    }
});

function promoup_click() {
    clearInterval(scroller);
    if (PromosGridView.GetPageIndex() == 0) {
        PromosGridView.GotoPage(PromosGridView.GetPageCount() - 1);
    }
    else {
        PromosGridView.PrevPage();
    }
}

function promodown_click() {
    clearInterval(scroller);
    if (PromosGridView.GetPageIndex() == PromosGridView.GetPageCount() - 1) {
        PromosGridView.GotoPage(0);
    }
    else{
        PromosGridView.NextPage();
    }
}

function promo_rowclick() {
    clearInterval(scroller);
}
