 			if error
 				toastr.error error.reason
 
+	'load img': (e, template) ->
+		template.sendToBottomIfNecessary?()
+
+
 Template.room.onCreated ->
 	# this.scrollOnBottom = true
 	# this.typing = new msgTyping this.data._id

	# ScrollListener.init()

	wrapper = this.find('.wrapper')
	newMessage = this.find(".new-message")

	template = this

	wrapperOffset = $('.messages-box > .wrapper').offset()

	onscroll = _.throttle ->
		template.atBottom = wrapper.scrollTop >= wrapper.scrollHeight - wrapper.clientHeight
	, 200

	updateUnreadCount = _.throttle ->
		firstMessageOnScreen = document.elementFromPoint(wrapperOffset.left+1, wrapperOffset.top+50)

			else
				template.unreadCount.set 0
	, 300

	# salva a data da renderização para exibir alertas de novas mensagens
	$.data(this.firstNode, 'renderedAt', new Date)
