title: Close all info windows google maps API V3?
body: <p>How do i get all info windows to close upon clikcing another pin or clicking the map in itself? 
  I'm using <a href="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html">http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html</a>
  and a kml overlay.
  heres my JS so far:</p>
  
  <pre><code>jQuery(document).ready(function ($) {
      function initialize() {
          google.maps.visualRefresh = true;
          var myLatlng = new google.maps.LatLng(51.201465, -0.30244);
          var mapOptions = {
              zoom: 12,
              center: myLatlng,
              mapTypeId: google.maps.MapTypeId.ROADMAP
          };
  
          var map = new google.maps.Map(document.getElementById('map-canvas'),
          mapOptions);
  
          var kmlLayer = new google.maps.KmlLayer({
              url: 'http://***.com/new/wp-content/themes/required-starter/CGAGolfAcademies.kml?rand=' + (new Date()).valueOf(),
              suppressInfoWindows: true,
              map: map
          });
  
          google.maps.event.addListener(kmlLayer, 'click', function (kmlEvent) {
              showInContentWindow(kmlEvent.latLng, kmlEvent.featureData.description);
          });
  
          function showInContentWindow(position, text) {
              var content = "&lt;div class='info_win'&gt;&lt;p&gt;" + text + "&lt;/p&gt;&lt;/div&gt;";
              var infowindow =new InfoBox({
                   content: content,
                   disableAutoPan: false,
                   maxWidth: 0,
                   position: position,
                   pixelOffset: new google.maps.Size(-140, 0),
                   zIndex: null,
                   boxStyle: { 
                    background: "#FBFBFB"
                    ,opacity: 0.90
                    ,width: "280px"
                   },
                   closeBoxMargin: "10px 2px 2px 2px",
                   closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
                   infoBoxClearance: new google.maps.Size(1, 1),
                   isHidden: false,
                   pane: "floatPane",
                   enableEventPropagation: false
          });
  
  
      infowindow.open(map);
  
          }
                      /******AJAX MAP ****/
              siteURL = 'http://' + top.location.host.toString();
              coachesLinks = jQuery('.info_win a');
              coachesLinks.click(function (e) {
                  e.preventDefault();
              });
              coachesLinks.click(function (e) {
                  alert('FRED');
                  $el = jQuery(this);
                  URL = $el.attr('href');
                  shareurl = $el.attr('href');
                  URL = URL + " .main";
                  jQuery('#content_two').show('slow').load(URL, function () {
                      scrollToAnchor('content_two');
                      $('.main').css('overflow', 'visible');
                      $('#content_two').css('overflow', 'visible');
                      jQuery('#content_two .back').on('click', function () {
                          jQuery(this).hide('slow');
                          var contentTwo = jQuery('#content_two');
                          if (contentTwo.is(':hidden')) {
                              jQuery('#content_two .back').hide();
                          } else {
                              contentTwo.hide('slow');
                              jQuery('#content &gt; .main').show('slow');
                              jQuery('#content &gt; .main').css('overflow', 'visible');
                              scrollToAnchor('access');
                          }
                      });
  
                  });
                  $('#content &gt; .main').hide('slow');
              });
  
      }
  
      google.maps.event.addDomListener(window, 'load', initialize);
  });
  </code></pre>