Calling a function defined inside jQuery ready from outside of it
<p>My aspx page:-</p>

<pre><code>  &lt;script src="js/jquery-1.4.2.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="js/jquery-ui-1.8.2.custom.js" type="text/javascript"&gt;&lt;/script&gt;

  &lt;script type="text/javascript"&gt;
    $(document).ready(function () {
      //lots of other code here....
      function showMessage(){
        $("#msgDiv").dialog({
                        modal: true,
                        buttons: {
                                  Ok: function() {
                                          $(this).dialog('close');
                                      }
                        },
                        resizable: true,
                        show: "explode",
                        position: "center",
                        closeOnEscape: true,
                        draggable: false
                      });
      }
    });
   &lt;/script&gt;
</code></pre>

<p>Another aspx pop up page which is triggered from the above page</p>

<pre><code>&lt;script type="text/javascript"&gt;

    window.opener.document.getElementById("msgDiv").innerHTML = &lt;%=MessageToShow%&gt;; //works very well for me.
    window.opener.document.showMessage(); // I am unable to access it like this?
    window.close();

&lt;/script&gt;
</code></pre>

<p>Basically I want to call <code>showMessage()</code> from the pop up window. I also have other logics to perform in both pages.</p>
