LOL! IT IS THE poptastic
function ITSELF that is the problem!
window.focus(); // Focus on the MAIN WINDOW!
After it opens the popup, it turns right around and says "but now put me back in front"!!!
*PROBABLY* all you need to do is remove
that line in red.
If for some reason that doesn't do it:
var popup = null; // must be outside the function
popup = window.open(url,'_blank');
popup.focus(); // force focus to the new window
setTimeout( "popup.focus()", 500 ); // just in case, do it again in half a second