         messageHtml += "<p class='log-message'><strong>#{username}:</strong> #{message}</p>"
 
     $messages = $popup.find('.popup_messages').append($(messageHtml))
-    @scrollToBottom()
+    @scrollToBottom($popup)
 
   # todo: make this and addLogMessages construct messages from a common source
   receiveMessage: (messageId, username, message, options) =>
     $popup = @$findOrCreatePopup(messageId)
     $messages = $popup.find('.popup_messages')
-    wasAtBottom = @isAtBottom()
+    wasAtBottom = @isAtBottom($popup)
     if options.type == 'error'
       $messages.append("<p class='privmsg-error'>#{message}</p>")
     else if options.type == 'alert'

  toggleChallengeEvent: (e) =>
    $popup = @$closestPopup(e.currentTarget)
    $challenge = $popup.find('.challenge')
    wasAtBottom = @isAtBottom()
    if $challenge.hasClass("hidden")
      @createChallenge($popup)
    else if $challenge.find('.cancel_challenge').text() == 'Cancel'
      $popup.find('.send_challenge').click()
    else
      @closeChallenge(@messageFromPopup($popup))
    if wasAtBottom then @scrollToBottom()

  sendChallengeEvent: (e) =>
    $popup = @$closestPopup(e.currentTarget)

        $popup.addClass('new_message')
        PokeBattle.notifyUser(PokeBattle.NotificationTypes.PRIVATE_MESSAGE, username)
      $messages.append("<p><strong>#{username}:</strong> #{message}</p>")
    if wasAtBottom then @scrollToBottom($popup)

  openChallenge: (messageId, generation, conditions) =>
    $popup = @$findOrCreatePopup(messageId)
