 
 #Session.setDefault 'images', {}
 images = {}
+imagesInternal = {}
 id2template = {}
 scrollToLater = null
 fileQuery = null

          images[id].count += 1
          checkImage id
      @images = newImages

scrollDelay = 750


  .observeChanges
    added: (id, fields) ->
      images[id].file = fields.file
      initImageInternal images[id].file, id if images[id].file?
    changed: (id, fields) ->
      if fields.file? and images[id].file != fields.file
        forceImgReload urlToFile id
        imagesInternal[images[id].file].image = null if images[id].file?
        images[id].file = fields.file
        initImageInternal images[id].file, id if images[id].file?

initImage = (id) ->
  if id not of images
