       false
     
   # Complete the opening of a dialog with the given HTML
-  displayDialog: (dialog, content, options={})->
+  displayDialog: (dialog, content)->
     dialog.html(content)
     dialog.fadeIn('fast')
     dialog.removeClass 'loading'
+    options = dialog.data('options')
     if options.behavior? && behavior = this.behaviors[options.behavior]
       behavior.onLoad.call(null, dialog, options) if behavior.onLoad?
     options.afterLoad.call(null, dialog) if options.afterLoad?

  #                 Behaviors can be setup using the Nifty.Dialog.addBehavior method.
  #
  open: (options={})->

    # set a dialog ID for this dialog
    dialogsOpen = $('div.niftyDialog').length
    dialogID = if dialogsOpen == 0 then this.startingID else (dialogsOpen * 10) + this.startingID

  # given ID if one is given).
  setContent: (content, id = null)->
    dialog = if id == null then $('div.niftyDialog:last') else $("div.niftyDialog#dialog-#{id}")
    if dialog.length
      dialog.html(content)
      options = dialog.data('options')
      if options.behavior? && behavior = this.behaviors[options.behavior]
        behavior.onSetContent.call(null, dialog, options) if behavior.onSetContent?
      this.onSetContent(null, dialog) if this.onSetContent?
  
  # Create a new overlay
  createOverlay: (options)->
