       # 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)

      console.log "Dialog could not be displayed. Invalid options passed."
      console.log options
      return false
  
  ajaxLoad: (url, insertedDialog)->
    insertedDialog.addClass 'ajax'
    insertedDialog.addClass 'loading'
    $.ajax
      url: options.url
      success: (data)=> this.displayDialog(insertedDialog, data)

  # Add a behaviour callback which will be executed
  addBehavior: (options)->

    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)
