     return "" unless @title?
     """<strong>#{@type.charAt(0).toUpperCase()}#{@type.substring(1)}!</strong>"""
   
-  _calc_offset: ->
+  calc_top_offset: ->
     amount = parseInt(@el.css 'top')
     (@el.siblings '.growlyflash').each (_, el) =>
       amount = Math.max(amount, parseInt(($ el).css 'top') + ($ el).outerHeight() + @spacing)
     amount
   
-  _calc_position: ->
-    styles = {}
-    styles.top = "#{@_calc_offset()}px"
-    styles.marginLeft = "-#{@el.outerWidth() / 2}px" if @align is 'center'
-    styles
+  calc_css_position: ->
+    css = {}
+    css.top        = "#{@calc_top_offset()}px"
+    css.marginLeft = "-#{@el.width() / 2}px" if @align is 'center'
+    css
 
 $.growlyflash = (flash, options = {}) ->
-  settings = $.extend(on, {}, Growlyflash.defaults, msg: flash.msg, type: flash.type, options)
+  settings = $.extend on, {}, Growlyflash.defaults, msg: flash.msg, type: flash.type, options
   alert = new Growlyflash.Alert(flash, settings)
   if flash instanceof Growlyflash.FlashStruct then flash else alert


Growlyflash.defaults =
  align:   'right'  # horizontal aligning (left, right or center)
  delay:   4000     # auto-dismiss timeout (0 to disable auto-dismiss)
  dismiss: yes      # allow to show close button
  spacing: 10       # spacing between alerts
  target:  'body'   # selector to target element where to place alerts
  title:   no       # switch for adding a title
  type:    null     # bootstrap alert class by default
  class:   ['alert', 'growlyflash', 'fade']

Growlyflash.KEY_MAPPING =
  alert:   'warning'


class Growlyflash.Alert
  constructor: (@flash, options) ->
    {@title, @align, @dismiss, @msg, @spacing, @type, @class} = options
    
    @el = ($ '<div>', 
      class: @_classes().join(' ')
      html: "#{@_dismiss()}#{@_title()}#{@msg}"
    ).appendTo(options.target)
    
    options.before_show.call(this, options)
    @show()
    
    return unless options.delay
    setTimeout => 
      @hide -> ($ @).remove()
    , options.delay
  
  show: -> @el.toggleClass 'in'
  hide: (fn) -> @el.fadeOut(fn)
  
  _classes: -> 
    @class.concat ("alert-#{type}" for type in [@type] when type?), ["growlyflash-#{@align}"]
