 @hideSpinner = ->
     Meteor.defer ->
         if MessagesHandle.ready()
-            console.log("Hide Spinner")
+            #console.log("Hide Spinner")
             $('#small-spinner').fadeTo(100, 0)
             if not scrollToBottomOK
                 Meteor.defer ->

Template.messagesList.events
    'scroll .messages-list-box': (e) ->
        if MessagesHandle.ready() and Messages.find().count() > MessagesHandle.loaded()
            console.log("scroll:" + $('.messages-list-box').scrollTop())
            if $('.messages-list-box').scrollTop() == 0
                $('#small-spinner').fadeTo(100, 1)
                Meteor.defer ->


    
Template.messages.rendered = ->
    #console.log("render template messages")
    #_.once ->
    setMessageListHeight()
    scrollToBottom()
    hideSpinner()
    
Template.messagesList.created = ->
    #console.log("created template messagesList")
    scrollToBottomOK = true

Template.messagesList.rendered = ->
    #console.log("render template messagesList")
    # Note: messages.rendered should be called after this...
    #scrollToBottom()
    #hideSpinner()
