title: Javascript: closing a popup window
body: <p>I am a JS noob, so please excuse me if this question is too "noobish".</p>
  
  <p>Note: the function is long, but just scroll down till you see //<strong><em>*</em>**<em>*</em>**<em>*</em>**</strong> as that's the important part.</p>
  
  <p>My function:</p>
  
  <pre><code>function ShowWindowN(userId,url,width,height,courseId) {
    var iev=getIEVer();
    if(iev&gt;=6&amp;&amp;iev&lt;8){
      width+=16*1;
    }
    var w=screen.availWidth&lt;width?screen.availWidth:width;
    var csCookie=readCookie('course_settings_'+userId);
    var found=false;
    if(csCookie!=null){
      csCookie=eval('({'+csCookie.replace(/&amp;/g,',').replace(/=/g,':')+'})');
      if(csCookie[courseId]!=null){
        height+=1*csCookie[courseId].height;
        found=true;
      }
    }
    if(!found){
      var plCookie=readCookie('player_settings_'+userId);
      if(plCookie!=null){
        plCookie=eval('({'+plCookie.replace(/&amp;/g,',').replace(/=/g,':')+'})');
        height+=1*plCookie.window_extra_height;
      }else{
        height+=16;
      }
    }
    var h=screen.availHeight&lt;height?screen.availHeight:height;
    var left = (screen.availWidth/2)-(w/2);
    //************
    objMovieWindow=window.open(url, "movieWindow", "width=" + w + ", height=" + h + ", top=0, left="+left+", status=false, toolbar=false, menubar=false, location=false, directories=false, scrollbars=1, resizable=1"); 
    objMovieWindow.focus();
    //alert(objMovieWindow.name);
  };
  </code></pre>
  
  <p>If you look at the alert() on the 2nd last line, that does not work, it gives me a "permissions denied" error. I also have a function that says "close_me()" with just this:</p>
  
  <pre><code>objMovieWindow.close();
  </code></pre>
  
  <p>But that does not work and gives me an "undefined" error. Basically, I load the page, and click a link to launch the popup, then the parent page reloads, and by clicking a link on the parent page I want to close the popup.</p>
  
  <p>Please tell me how I can close the damn popup window?</p>