javascript stacking bug
<p>I have this code:</p>

<pre><code> $jq('.pop-tip').click( function(event) {
        width = '';
        height = '';
        var img = new Image();
        img.onload = function() {
            width = 'width='+(this.width + 240);
            height = 'height='+(this.height + 360);              
        }
        img.src = 'http://www.domain.com/uploads/2011/10/dealoftheweek.jpg';        
        destination = $jq(this).attr('title');
        postPop = $jq(this).attr('href');
        alert ( width );
        window.open(postPop, 'tip_pop',''+ width +', '+ height +', scrollbars=0' ).focus();
        window.open(destination, '_parent','' );
        event.preventDefault();
)};
</code></pre>

<p>For some reason it only works with the alert() just above the window.open call why is this and how can i fix it?</p>
