 
   isScrolledToTop: () ->
     return (0 + @scrollOffset) >= @scrollBody().scrollTop()
+
+  didChangeCurrentMessage: ( () ->
+    @focusTextArea()
+  ).observes('controller.currentMessage')
 
   didResize: (textarea) -> @organizeLayers()
 


        return false

    @scrollBody().bind("scroll", (event) => @didScroll(this, event))

    # setTimeout((=> $(@scrollParent).trigger("scroll")), 200)

    top = (@scrollBody()[0].scrollHeight - distance)
    @scrollBody().scrollTop(top)

  focusTextArea: ->
    if @state == "inDOM"
      @textArea().focus().select()

  scrollBody: () -> @collection()
  collection: () -> @.$('div.messages')
  form:       () -> @.$('form.new-message')
