     text
 
   _hide: (jFlash) ->
-    clearTimeout jFlash.data 'timeout_id'
+    clearTimeout jFlash.data 'timeoutId'
     _self = @
     jFlash.slideUp @settings.slideTime, -> $(@).remove()  if _self.settings.removeOnHide
 
-  _setTimeout: (jFlash) ->
-    timeoutId = false
-    if @settings.showTime or @settings.showTimePerChar
-      timeoutId = setTimeout =>
+  _setTimeout: (jFlash, timeout = @settings.showTime + jFlash.text().length * @settings.showTimePerChar) ->
+    if timeout
+      jFlash.data 'timeoutId', setTimeout =>
+          jFlash.removeData 'timeoutId'
           @_hide jFlash
-        , @settings.showTime + jFlash.text().length * @settings.showTimePerChar
-      jFlash.data 'timeout_id', timeoutId
-    timeoutId
+        , timeout
 
   getSettings: ->
     @settings

      regExpLastWordWithoutDot: /[\wа-яёА-ЯЁ]{3,}$/
      regExpLastWordWithDot: /([\wа-яёА-ЯЁ]{3,})\.$/
      locale: 'en'

  jContainer: null
  settings: {}

  constructor: (@jContainer, options = {}) ->
    if I18n? and I18n.locale and I18n.t
      options['locale'] ||= I18n.locale
      if _localesFromI18n = I18n.t 'ultimate_flash'
        _defaultLocales = @constructor.defaults.locales[I18n.locale]
        for key, value of _localesFromI18n
          _defaultLocales[_.camelize key] = value
    _locale = options['locale'] or @constructor.defaults.options['locale']
    $.error "Locale [#{_locale}] not exists in UltimateFlash default locales."  unless @constructor.defaults.locales[_locale]
    @settings = $.extend {}, @constructor.defaults.options, @constructor.defaults.locales[_locale], options
    @jContainer.data @constructor.defaults.constants.widgetDataKey, @
    _self = @
    # delegate event for hide on click
    @jContainer.delegate '.flash:not(:animated)', 'click.ultimate_flash_close', ->
      _self._hide $ @  if _self.settings.hideOnClick
      false
    # init flashes from server
    @jFlashes().each ->
      jFlash = $ @
      jFlash.html _self._prepareText jFlash.html()
      _self._setTimeout jFlash
    # binding hook ajaxError handler
    @jContainer.ajaxError =>
      @ajaxError arguments  if @settings.showAjaxErrors

      if jqXHR.status >= 400 and jqXHR.responseText
        # try detect Rails raise message
        if raiseMatches = jqXHR.responseText.match /<\/h1>\n<pre>(.+?)<\/pre>/
          cout "replace thrownError = '#{thrownError}' with raiseMatches[1] = '#{raiseMatches[1]}'"
          thrownError = raiseMatches[1]
        else
          # try detect short text message as error
          if jqXHR.responseText.length <= @settings.detectPlainTextMaxLength
            cout "replace thrownError = '#{thrownError}' with jqXHR.responseText = '#{jqXHR.responseText}'"
            thrownError = jqXHR.responseText
      else
        if _.isString thrownError and not $.isEmptyString thrownError
          cout "replace thrownError = '#{thrownError}' with @settings.translations.defaultThrownError = '#{@settings.translations.defaultThrownError}'"
          thrownError = @settings.translations.defaultThrownError
      text += ': '  if text
      text += "#{thrownError} [#{jqXHR.status}]"
    return @alert text
