     }]
     
     initialize: (options = {}) ->
-      @set('toc', [])
+      @set('toc', toc)
 
       @fetch
         success: () => @load(options.page)


    load: (page) ->
      if @get('type') is 'book'
        toc = @get('toc')
        for i in [0..@get('pages')] by 1
          toc.add(@findPage(i+1))

        @setPage(page or 1) # Default to page 1
      else
        @set('currentPage', new Page({id: @id}))
        @get('currentPage').fetch()

    findPage: (num) ->
      search = (contents) ->
        for item in contents.models
          if item.get('page') is num
            return item
          else if item.get('contents')
            result = search(item.get('contents'))
            return result if result
        return

      return search(@get('contents'))

    setPage: (num) ->
      if num < 1 then num = 1

      @get('currentPage')?.set('active', false)
      @set('currentPage', page)
      page.set('active', true)
      @trigger('changePage')

      if not page.loaded
        page.fetch
          success: () =>
            page.loaded = true
            @trigger('changePage:content')

    nextPage: () ->
      page = @get('page')
