Hi, I new to the whole javascript and webdesign game. So here is my question:

From the parent window I want to open a child window and then from the same function to change a value on a form in the child window. Here is what I have for code:

<script language="javascript">

function opencourse(url,name,details)
    newwindow = window.open(url,name,'height=420,width=605');
    try {    
        newwindow.document.title = name;
        newwindow.document.getElementByID('hideme').value = details;
    catch(e) {
        newwindow.onload=function(){newwindow.document.title.value = name;
        newwindow.document.getElementByID('hideme').value = details;

and then the link that calls the function looks like this:
HTML Code:
<a href="javascript:opencourse('http://www.imisd.com/Forms/course.php','intake','Procurement and Contract Negotiations Skills')">

Then in the child window the form calls itself and uses the php mail() function to send the info to a specified email address. Here is the form code:

HTML Code:
<form method="POST" action="course.php" name="intakeform" id="intakeform">

<fieldset class="fltright"><legend>Position Details</legend>
<label for="Title">Title:</label><br />
<input type="text" name="Title" id="Title" class="textfield"><br />
<label for="Department">Department:</label><br />
<input type="text" name="Department" id="Department" class="textfield"><br />
<label for="Company">Company:</label><br />
<input type="text" name="Company" id="Company" class="textfield"><br />
<label for="Website">Website:</label><br />
<input type="text" name="Website" id="Website" class="textfield"></p>
<label for="Comments">Comments/Questions:</label><br />
<textarea name="Comments" id="Comments" class="textarea"></textarea><br />
<p>Fields marked (*) are required</p>


<fieldset >
<legend>Personal Information</legend>
<label for="Salutation">Salutation:</label><br />
<input type="text" name="Salutation" id="Salutation" class="textfield"><br />
<label for="Name">Name:* </label><br />
<input type="text" name="Name" id="Name" class="textfield"><br />
<label for="Address">Address:</label><br />
<textarea name="Address" id="Address" class="textarea"></textarea><br />
<label for="eMail">eMail:* </label><br />
<input type="text" name="eMail" id="eMail" class="textfield"><br />
<label for="Tel">Tel:</label><br />
<input type="text" name="Tel" id="Tel" class="textfield"><br />
<label for="Fax">Fax:</label><br />
<input type="text" name="Fax" id="Fax" class="textfield"><br />
<label for="Mobile">Mobile:</label><br />
<input type="text" name="Mobile" id="Mobile"  class="textfield"></fieldset>

<input type="hidden" name="hideme" id="hideme" /> 

<input type="submit" id="submit" class="submit" >
I use to have a simpler function that tried to open window and directly change the values, but then once it was finished loading it would change everything back to its original value.

Any ideas what does this and how to solve this problem which has had me pulling at my hair the whole day?