      @elems.pageBackgrounds = elem
 
     setPages: (H, W) ->
-     #@setFills()
-     #return
+     return if not @_sidebarAligned()
      @pageHeight = H
      @mainNodes = @getMainNodes()
      @sidenoteMap =  @getSidenoteMap()



    setFills: ->
     for sidenote in @sidenotes
      elemSidenote = sidenote.elem
      elemContent = @map.nodes[sidenote.link].elem

     else
      throw new Error "Unknown type #{node.type} - #{node.level}"

    _sidebarAligned: ->
     sidebar = @getOffsetTop @elems.sidebar, document.body
     main = @getOffsetTop @elems.main, document.body

     mainHeight = @elems.main.offsetHeight

     diff = Math.abs main - sidebar
     if diff < mainHeight / 4
      return true
     else
      return false

    getBreakCost: (node) ->
     parent = node.parent()
     cost = 0
