Um I'm not too sure what you mean by 'if the condition is met' - if you could let me know what you're trying to check for, I'll see if I can write the code for you.
In the meantime, here's an example that is kind of similar, it uses a function though. The popup redirects and closes if the checkbox is checked.
-- page1.htm --
<BODY>Original Page (page1.htm)<br>
<a href="page1.htm" onClick="window.open('popup.htm')">Click here to open new window</a>.
-- popup.htm --
window.opener.location = "page2.htm";
<BODY>Popup Page (popup.htm)<br>
<input type="checkbox" name="redirectMe" value="redir" onClick="redirect()">If you check this box, the redirect occurs and this window closes.
-- page2.htm --
<BODY>Redirect Page (page2.htm)<br>
<a href="page1.htm">Click here to return to page1.htm</a>.
-- end of script --
Hope that is of some help... as I say, if you post some more details I'd be happy to give it another go.