       $(window).bind 'popstate', (event) =>
         cid = @getImageFromUri()
         if cid > 0 and cid isnt @current
-          if @current is null then @show cid else @updateImage cid, false
+          if @current is null then @show cid else @open cid, false
 
     $(window).bind 'keyup', (event) =>
       if @overlay.hasClass 'show'

#   test.mozRequestFullScreen()

class Chocolate
  images:  {}
  current: null
  length:  0

  ###
   Конструктор

      @overlay.removeClass 'show'
    @

  open: (cid) ->
    @updateImage cid if @images[cid]?
    @

  next: ->
    next = @current + 1

