﻿var graphicContainer = {
    autoPlay: true,

    timeSpeed: 5000,

    currentIndex: 0,

    init: function() {
        this.scrollToGraphic(this.currentIndex);
    },

    scrollToGraphic: function(index) {
        var count = $("#graphicContent").find("li").length;
        if (count == 0) {
            return;
        }
        var nextLi = $("#graphicContent").find("li").eq(0);
        if (index >= $("#graphicContent").find("li").length) {
            this.currentIndex = 0;
        }
        else {
            nextLi = $("#graphicContent").find("li").eq(index);
        }
        $("#graphicContent").scrollTo(nextLi, 1000);
        var graphicMsg = nextLi.attr("title");
        $("#graphicMsg").text(graphicMsg);
        if (this.autoPlay) {
            this.currentIndex = this.currentIndex + 1;
            window.setTimeout("graphicContainer.scrollToGraphic(" + this.currentIndex + ");", this.timeSpeed);
        }
    }
};
