I have a javascript popup window for users to login from. i want the login form to submit back to the parent window and close the popup.

listed detail:
user clicks vote button and they are not logged in.
popup window opens with php login form in it.
when user submits login:
pop up window closes and parent window goes to the page that runs the login script.

how would i do this. heres what i have

pop up window:
Code JavaScript:
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 440,top = 312');");
// End -->

the vote button decides with php if they are logged in or not:
PHP Code:
if(user is logged in) {
} else {
open pop up window   // i need the script for this
javascript:popUp('functions/login.php')   //guess

the login form :
PHP Code:
<div class="loginForm">
table id="loginTable">
form action="login.php" method="get">
tr><td class="formtxt" align="right">Username:</td><td align="left"><input type='text' name='user' id='user' class="input" /></td></tr>
tr><td class="formtxt" align="right">Password:</td><td align="left"><input type='password' name='pass' id='pass' class="input" /></td></tr>
tr><td align="center" colspan="2"><input type='submit' id="submit" name="submit" class="submit" value='Log In' /></td></tr>

other than that i'm lost. plz help. thnx