       new_zoom = 0.25 if new_zoom < 0.25
       new_zoom = 2.0 if new_zoom > 2.0
       @zoom(new_zoom)
+    
+    unless @demo_mode
+      $(window).bind 'beforeunload', =>
+        return "You have unsaved changes. Leave anyway?" unless @saved
   
   createSubmissionPages: ->
     previousPage = undefined

  clickGrade: (phrase) =>
    if @gradingMode != 'sum' && !phrase.criterion.annotationsHaveGrades()
      this.addCommand(new SetSelectedPhraseCommand(phrase.criterion, phrase))
      @saved = false
  
  
  clickPhrase: (phrase) =>

  
  addCommand: (command) ->
    @commandBuffer.buffer.push(command)
    @saved = false
  
  
  subscribeToAnnotation: (annotation) ->
