   id = Popup.nextId()
   @mousedown (e) -> e.stopPropagation()
   
+  element = null
+  
+  options = $.extend({}, options);
+  options._close = options.close
+  options.close = ->
+    close.call element, element if close
+    options._close.call element, element if options._close
+  
   @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+      open.call element, element if open
+      options.open.call element, element if options.open

    @_popupID = id
    @_detach = options.detach

    offset = element.offset()


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