var MultiPageViewer = new Class({

    /* Properties */
    currentPage: '',

    /* Methods */
    initialize: function(options) {
        this.options = options;
        for (id in this.options.pages) {
            this.addPage(id, this.options.pages[id]);
        }
    },

    addPage: function(id, pages) {
        // add the page to the container
        var superThis = this;
        pages.each(function(elementId) {
            $(elementId).setStyles({position: 'absolute'})
                .setOpacity(0)
                .injectInside($(superThis.options.container));
        });
    },

    show: function(pageId) {
        if (this.currentPage === pageId) {
            return;
        }
        if (this.currentPage) {
            this.options.pages[this.currentPage].each(function(elementId) {
                $(elementId).fade(0);
            });
        }
        this.currentPage = pageId;
        this.options.pages[pageId].each(function(elementId) {
            $(elementId).fade(1);
        });
    }
});
