$().ready(->
  $(window).resize( ->
    App.UI.setAutoHeight()
  ).trigger('resize')

  Backbone.Events.on('resizeWorkspace', -> App.UI.setAutoHeight())

  $('#js-search-contacts').keyup( ->
    searchTerm = $(this).val()
    App.UI.filterContacts(searchTerm)
  )

  $('.chat-alert .close').click((e) ->
    e.preventDefault()
    $('.chat-alert').fadeOut(250, ->
      $(this).html('').show()
    )
  )

  setTimeout(->
    $('.chat-alert .close').click()
  , 2000);

  $('#add-contact').click((e) ->
    e.preventDefault()
    $('#js-popup .close').click()
    popup = new Xmpp.Views.Popup.AddContactView()
    popup.render()
  )
)