       overlay.fadeOut 'fast', ->
         overlay.remove()
     overlay.fadeIn('fast')
-    
+
   # Closes the top dialgo in the dialog stack
   closeTopDialog: ->
     if $('div.niftyDialog').length
       $('div.niftyDialog:last').data('closeAction').call()
-    
-  +
+

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

    # create a template and assign the ID
    dialogTemplate = $("<div class='niftyDialog #{options.class}' id='niftyDialog-#{options.id}'></div>")
    dialogTemplate.data('dialogID', dialogID)
    
    # insert the dialog into the page
    insertedDialog = dialogTemplate.appendTo($('body'))
    insertedDialog.css('z-index', 2000 + dialogID)
    
    # set the content on the dialog
    insertedDialog.data('options', options)
    
    overlayClass = ''
    overlayClass = 'invisible' if dialogID > 1
    theOverlay = $("<div class='niftyOverlay #{overlayClass}'></div>").insertBefore(insertedDialog).css('z-index', 2000 + dialogID - 1)
    theOverlay.fadeIn('fast')
    
    # if we have a width, set the width for the dialog
    if options.width?
      insertedDialog.css('width', "#{options.width}px")
      insertedDialog.css('margin-left', "-#{options.width / 2}px")
    
    if options.offset?
      insertedDialog.css('margin-top', "#{options.offset}px")



    # Set that clicking on the dialog's overlay will close the dialog
    theOverlay.on 'click', -> insertedDialog.data('closeAction').call()

    # load in the content
    if options.url?
      # if loading from a URL, do this
