title: Google maps in hidden div
body: <p>I have a page with two tabs. The first tab has photos and the second a google map. The problem is that the google map is not completely drawing because it is in a hidden div. So I moved the initialize() function to the href of the map tab using onclick(). This works the first time you click on it but when you return to the photos tab and then go back to the map tab the map only partially draws. If you click the map tab a second time it works perfectly. Any ideas?</p>
  
  <p>tabs javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(function () {
      var tabContainers = $('div.tabs &gt; div');
  
      $('div.tabs ul.tabNavigation a').click(function () {
          tabContainers.hide().filter(this.hash).show();
  
          $('div.tabs ul.tabNavigation a').removeClass('selected');
          $(this).addClass('selected');
  
          return false;
      }).filter(':first').click();
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>google maps javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function initialize() {
      var latlng = new google.maps.LatLng(&lt;?=$lat ?&gt;, &lt;?=$lng ?&gt;);
      var myOptions = {
        zoom: 15,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById("map_canvas"),
          myOptions);
  
     var marker = new google.maps.Marker({
        position: latlng, 
        map: map, 
        title:"&lt;?=$fulladdress ?&gt;"
    });   
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;div class="tabs"&gt;
          &lt;ul class="tabNavigation"&gt;
              &lt;li&gt;&lt;a href="#first"&gt;Photos&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#map_canvas" onclick="initialize(); return false;"&gt;Map&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
  
  
          &lt;div id="first"&gt; &lt;/div&gt;
        &lt;div id="map_canvas" &gt;&lt;/div&gt;
  </code></pre>