Javascipt: Trouble accessing a parent global varaible from a child window
<p>I spawn a new window thus and attach scripts thus:</p>

<pre><code>  var newwindow2=window.open('','name','height=200,width=150,menubar=yes');
  var tmp = newwindow2.document;
  tmp.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;');
  tmp.write('&lt;link rel="stylesheet" href="css/app-style2.css"&gt;');
  tmp.write('&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;div id="myapp"&gt;&lt;/div&gt;');


  var headtag = tmp.getElementsByTagName('head')[0];
  var fileref=document.createElement("script");
  fileref.setAttribute("type", "text/javascript");
  fileref.setAttribute("language", "JavaScript");
  fileref.setAttribute("src", "js/test.js");
  headtag.appendChild(fileref);
</code></pre>

<p>In  test.js which is also attached to the opener. I have global array  of objects called contacts.   If  I add an onload function thus to see how panes is loading,  I see the array amount just fine. </p>

<pre><code> fileref.onload = function() {

 alert(contacts.length);
 };
</code></pre>

<p>I try to access panes and get get "null". </p>

<pre><code>function getObj(contactID){

  for (var i=1;i&lt;= contacts.length;i++) {
      if (contactID == contacts[i].id)
      return contacts[i];     
  }
  return null;
}
</code></pre>

<p>Any idea on where I'm going wrong?
BTW: This is demo ware and only needs to work on FF (and if possible chrome)</p>

<p>Thanks!!</p>
