Remove all instances of object
<p><em>Edit: Example - <a href="http://jsfiddle.net/JWx7z/9/" rel="nofollow">http://jsfiddle.net/JWx7z/9/</a></em></p>

<p>I'm using a lightbox plugin <a href="https://github.com/premasagar/nitelite" rel="nofollow">https://github.com/premasagar/nitelite</a> and I'm hacking it a bit to get it to behave how I want.</p>

<p>The lightbox is made up of two elements: the overlay (dark slightly transparent window), and the content containing window.</p>

<p>Normally when a lightbox is closed the overlay is faded out and removed. When opening a lightbox it is added and faded in.</p>

<p>However when traversing from lightbox to another lightbox this makes the transition undesirable. I have hacked it so the old overlay remains, and the new overlay is aborted if we are going between 2 lightboxes, so it is just the content window that changes.</p>

<p>This means of course the overlay is a seperate instance of the lightbox to the current content window. Which in turn means when I try and close the lightbox by clicking on the overlay, only the overlay is removed - leaving the content window still on my page.</p>

<pre><code>...

$(this.overlay)
    .bind('add', function() {
        this.node
            .one('click', function(){
                lb.close();
            });
    });
</code></pre>

<p><em>Note: Each instance of the lightbox is called lb.</em></p>

<p>I can remove this window by adding an artificial click to the close button:</p>

<pre><code>$('#lightbox p.close a').click();
</code></pre>

<p>but this has reprecussions later as some remnants of lb still exist - for example if I want to open a new lightbox it thinks a lightbox already exists and we're moving between the two, so doesn't add an overlay as it thinks there is already one there.</p>

<p>How can I work it so all instances of lb are closed when clicking on the overlay?</p>

<p>Thanks</p>

<p><em>Edit: Code for aborting addition of overlay if coming from a lightbox</em> </p>

<pre><code>...

open: function(contents, transition){
    var lb = this;
        if (transition !== 0) {
            this.overlay.add();
    } 

...
</code></pre>
