title: Defined global variable in javascript becomes undefined again
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;&lt;meta charset="utf-8" /&gt;
      &lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&amp;region=vi&amp;language=vi"&gt;    
      &lt;/script&gt;
  
      &lt;script type="text/javascript" src="jquery-1.7.1.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          var map;
      &lt;/script&gt;
      &lt;style type="text/css"&gt;
          html {
              height: 100%;
          }
  
          body {
              height: 100%;
              margin: 0;
              padding: 0;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body onload="initialize()"&gt;
      &lt;div id="map_canvas" style="width: 100%; height: 100%"&gt;&lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          function initialize() {
              var mapOptions = {
                  center: new google.maps.LatLng(10.79, 826.694),
                  zoom: 13,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              map = new google.maps.Map(document.getElementById("map_canvas"),
                  mapOptions);
          }
      &lt;/script&gt;    
  
      &lt;script&gt;            
          alert(map);
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>A couple of my functions need to use the <code>map</code> variable, however, I keep receiving alerts that complain <code>map</code> variable is unidentified.
  How can I make browser remember that map was defined on <code>map = new google.maps.Map(document.getElementById("map_canvas"),
                      mapOptions);</code>
  Thank you</p>