Understanding obscure JavaScript code
<p>I found this code in the <code>&lt;head&gt;</code> section of an HTML page (a collegue made this but he doesn't work here anymore):</p>

<pre><code>(function(window, PhotoSwipe){ 
    document.addEventListener('DOMContentLoaded', function(){
        var options = {},
            instance = PhotoSwipe.attach( window.document.querySelectorAll('#Gallery a'), options );
    }, false);
}(window, window.Code.PhotoSwipe));
</code></pre>

<p>While I can understand the central part (from document.addEventListener), I can't understand the first and the last line. What they're doing here? The code is from an open source image gallery called PhotoSwipe. Any pointer is appreciated.</p>

<p>[EDIT]</p>

<p>Is this code the same as:</p>

<pre><code>document.addEventListener('DOMContentLoaded', function(){
        var options = {},
            instance = window.Code.PhotoSwipe.attach( window.document.querySelectorAll('#Gallery a'), options );
    }, false);
</code></pre>

<p>?</p>
