           context.trigger 'showContent', {data: msg, target: "#contents"}
       }
 
-    this.bind 'postAndReplace', ->
+    @bind 'postAndReplace', ->
       target = "##{context.params['post_id']} .bubble"
       $.ajax {
         type: "POST",


    # before and after filter
    #
    this.before () ->
      this.trigger 'loadingNotification'
      context.path = "#{this.path.split('#')[0]}.js"
      context.path_json = "#{this.path.split('#')[0]}.json"
      context.params = this.params
      context.title = $('title').text()

    this.after () ->
      this.trigger 'subscribeToWS', {id: 'index'}
      if _gaq?
        _gaq.push ['_trackPageview']
        _gaq.push ['_trackEvent', this.path, this.verb, 'blabbr']

    # bindings
    #
    this.bind 'loadingNotification', ->
      $("#contents").append '<p class="loading"></p>'

    this.bind 'hideLoadingNotification', ->
      $('.loading').hide()

    this.bind 'getAndShow', (e, infos) ->
      path = infos.path || context.path
      $.ajax {
        type: "GET"

          context.trigger 'hideLoadingNotification'
      }

    @bind 'showContent', (e, data) ->
      $(data.target).show().html data.data
      @trigger 'updateTitle'

    @bind 'addContent', (e, data) ->
      id = data.target || "#contents"
      $(id).append(data.data)

    @bind 'replaceContent', (e, data) ->
      $(data.target).html(data.data)

    @bind 'updateTitle', ->
      title = $('.page-title').attr 'title'
      $("#page-title").html title
      document.title = "Blabbr - #{title}"

    @bind 'notify', ->
      context.trigger 'lostFocus'
      context.trigger 'blinkTitle', 1
      if current_user.audio?
        @trigger 'audioNotification'

    @bind 'lostFocus', ->
      window.isActive = false

    @bind 'blinkTitle', (e, state) ->
      unless window.isActive
        if state == 1
          document.title = "[new!] - #{context.title}";
