LOL! IT IS THE poptastic function ITSELF that is the problem!
After it opens the popup, it turns right around and says "but now put me back in front"!!!
window.focus(); // Focus on the MAIN WINDOW!
*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