   return if (isShowingHelpDialog || !document.body || fid != frameId)
   isShowingHelpDialog = true
 
-  VimiumHelpDialog.init html
-  VimiumHelpDialog.show()
+  VimiumHelpDialog.init()
+  VimiumHelpDialog.show html
 
 hideHelpDialog = (clickEvent) ->
   isShowingHelpDialog = false

    DomUtils.simulateClick document.getElementById "vimiumHelpDialog"

  hide: ->
    helpDialog = document.getElementById("vimiumHelpDialogContainer")
    if (helpDialog)
      helpDialog.parentNode.removeChild(helpDialog)

  #
  # Advanced commands are hidden by default so they don't overwhelm new and casual users.

  new FindMode()

VimiumHelpDialog =
  container: null
  dialogElement: null

  # This setting is pulled out of local storage. It's false by default.
  getShowAdvancedCommands: -> Settings.get("helpDialog_showAdvancedCommands")

  init: ->
    unless @container?
      @container = DomUtils.createElement "div"
      @container.id = "vimiumHelpDialogContainer"
      @container.className = "vimiumReset"

  show: (html) ->
    document.body.appendChild @container

    @container.innerHTML = html
    @container.getElementsByClassName("closeButton")[0].addEventListener("click", hideHelpDialog, false)
    @container.getElementsByClassName("optionsPage")[0].addEventListener("click", (clickEvent) ->
        clickEvent.preventDefault()
        chrome.runtime.sendMessage({handler: "openOptionsPageInNewTab"})
      false)

    @dialogElement = @container.querySelector "#VimiumHelpDialog"
    @dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click",
      VimiumHelpDialog.toggleAdvancedCommands, false)
    @showAdvancedCommands(@getShowAdvancedCommands())
