title: Javascript's window.open function inconsistent, does not open pop up when expected
body: <p>Ok, I'm going nuts here.  I'm trying to implement a basic popup window to display images.  If my javascript code is fully specified in an HTML tag with the onclick property, the window pops up correctly.  If my IDENTICAL javascript code is called from either the script tag at the beginning of the HTML document or from a separate js file, the link (or image in my case) opens not in a popup, but in the same window. &lt; frustration ></p>
  
  <p>This opens a popup:</p>
  
  <pre><code>&lt;a href="test.jpg" onclick="window.open('test.jpg','test_name','width=500,height=500,scrollbars=no'); return false"&gt;test_name&lt;/a&gt;
  </code></pre>
  
  <p><br />
  This does not open a popup:</p>
  
  <pre><code>function cleanPopup(url, title) {
  window.open(url, title, 'width=500,height=500,scrollbars=no');
  return false;
  }
  
  &lt;a href="test.jpg" onclick="return cleanPopup('test.jpg', 'test_name')"&gt;test_name&lt;/a&gt;
  </code></pre>
  
  <p><br />
  Any help would be appreciated.</p>
  
  <p>PS: Tested in Chrome and Firefox.</p>
  
  <p>EDIT:</p>
  
  <p>I've discovered my problem.  I originally only called the js file in the head tag. There is something about the layers of div's when created with multiple scripts of a templating tool (Template Toolkit in my case) that makes the original script element within the head element seemingly invisible to the deeper child elements.  </p>
  
  <p>I do not know exactly what's going on, and I don't have the time to explore it.  I've added this edit just in case some other person has a similar issue and somehow stumbles across this thread.  If someone understands this phenomenon, and can explain it, please do.</p>
  
  <p>EDIT 2:</p>
  
  <p><b>The "name" parameter of the window.open method can not contain spaces for the popup to work in IE.  Thanks M$.</b></p>