/**
 * Expects array of page objects of the form
 * {title:"page title",selector:"id_used_to_activate_page",template:"template_path"}
 * By default, the first page in the array will be selected
 * @param pages
 */

var pages = [
    {title:"Splash",selector:"splash",template:"ninja/splash"},
    {title:"Main",selector:"main",template: "ninja/main"}

];

var navigation = function(pages)
{
    
    this.pages = pages;
    this.selectPage = ko.observable('splash');
    this.selectedPage = ko.dependentObservable(function(){
         for(var page in this.pages){
            if(this.pages[page]['selector'] == this.selectPage()){
                return this.pages[page];
            }
        }
        return this.pages[0];

    }.bind(this));
    this.displayCartSummary = ko.observable(false);

    this.goToPage = function(selector){
        for(var page in this.pages){
            if(this.pages[page]['selector'] == selector){
                this.selectedPage(this.pages[page]);
            }
        }
    }

};
