 
   hidden: true
 
-  clickedVeryRecently: false
-
   constructor: ->
     super
     @el.addClass @constructor::className


  show: ->
    @el.toggleClass 'hidden', false
    $(@associated)?.toggleClass 'showing-overlay', true
    @hidden = false
    addEventListener 'click', @onClick, false
    addEventListener 'hashchange', @onHashChange, false
    addEventListener 'keydown', @onKeyDown, false

  hide: ->
    @el.toggleClass 'hidden', true
    $(@associated)?.toggleClass 'showing-overlay', false
    @hidden = true
    removeEventListener 'click', @onClick, false
    removeEventListener 'hashchange', @onHashChange, false
    removeEventListener 'keydown', @onKeyDown, false


    @hide() if @hidden
    @el.prependTo document.body

  onHashChange: =>
    setTimeout (=> @hide()), 250

  onKeyDown: (e) =>
    if e.which is ESC
