title: Dynamically Loading Google Maps api's
body: <p>Im trying to load the google maps api's dynamically.
  I'm using the following code:</p>
  
  <pre><code>var head= document.getElementsByTagName('head')[0];
  var script= document.createElement('script');
  script.type= 'text/javascript';
  script.src= 'http://www.google.com/jsapi?key=&lt;MY_KEY&gt;;
  head.appendChild(script);
  </code></pre>
  
  <p>but when trying to create the map </p>
  
  <pre><code>map = new GMap2(document.getElementById("map"));
  </code></pre>
  
  <p>or </p>
  
  <pre><code>map = new google.maps.Map2(document.getElementById("map"));
  </code></pre>
  
  <p>I'm getting an error that google (or GMap2) is undefined.</p>