       # if loading from a URL, do this
       insertedDialog.addClass 'ajax'
       insertedDialog.addClass 'loading'
+      if options.behavior? && behavior = this.behaviors[options.behavior]
+        behavior.beforeLoad.call(null, insertedDialog, options) if behavior.beforeLoad?
+      
       $.ajax
         url: options.url
         success: (data)=> this.displayDialog(insertedDialog, data)

  #
  #   behavior   => the name of a behavior set to be invoked on dialog open/close.
  #                 Behaviors can be setup using the Nifty.Dialog.addBehavior method.
  #
  open: (options={})->
    # set a dialog ID for this dialog

    dialog = if id == null then $('div.niftyDialog:last') else $("div.niftyDialog#niftyDialog-#{id}")
    options = dialog.data('options')
    if options.url?
      if options.behavior? && behavior = this.behaviors[options.behavior]
        behavior.beforeLoad.call(null, insertedDialog, options) if behavior.beforeLoad?
      $.ajax
        url: options.url
        success: (data)=> this.setContent(data, id)
