         if @_view
           @_view.release()
           @_view = null
-        $(this).children().detach() if @_detach
+        
+        if @_detach
+          $(this).children().detach()
+        else if @_reattach
+          $(document.body).append $(this).children().hide()
+        
         $(this).remove()
         
   nextId: ->

  id = Popup.nextId()
  @mousedown (e) -> e.stopPropagation()
  
  @click (e) ->
    e.preventDefault()
    element = this
    options = $.extend({}, options);
    options.close = -> close.call element if close
    if Popup._popupID == id
      Popup.close()
    else
      Popup.show $(this), id, (if items.call then items.call(element, e.altKey || e.shiftKey) else items), options
      open.call element, element if open

    @_popupID = id
    @_detach = options.detach
    @_reattach = options.reattach

    offset = element.offset()

