﻿var ShowMore = {
    _Settings: {},

    Init: function(setting) {
        this._Settings = {
            currentPage: 0,
            itemsPerPage: 10,
            totalItems: 0,
            display: '#display'
        };

        if (setting) {
            $.extend(this._Settings, setting);
        }

        // clear our display
        $(this._Settings.display).html('');
    },

    AppendContent: function(content) {
        $(this._Settings.display).append(content);
    },

    ShowMore: function() {
        this._Settings.currentPage++;
    },

    Skip: function() {
        return this._Settings.itemsPerPage * this._Settings.currentPage;
    },

    HasMore: function() {
        return (((this._Settings.currentPage + 1) * this._Settings.itemsPerPage) < this._Settings.totalItems);
    },

    ItemsPerPage: function() {
        return this._Settings.itemsPerPage;
    },

    CurrentPage: function() {
        return this._Settings.currentPage;
    },

    TotalItems: function() {
        return this._Settings.totalItems;
    }
};
