title: trigger google maps marker click
body: <p>I have a google map set up to find the user's current location, and center the map at that closest marker to their location. The markers, when clicked, open up an infobox (note this is a little different than an infoWindow - <a href="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html" rel="noreferrer">http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html</a>).  What I want to do, however, is automatically open up the nearest marker without the user actually clicking. Here's the code to trigger a marker opening:</p>
  
  <pre><code>//loop through all locations to add a marker:
  addMarker = function(loc) {
      var markerLoc = new google.maps.LatLng(loc.Lat, loc.Long);
  
      var marker = new google.maps.Marker({
          map: map,
          position: markerLoc
      });
  
      google.maps.event.addListener(marker, "mousedown", function() {
  
          var infoOpts = {
              content: loc.markerText,
              boxStyle: { background: "none transparent", width: "180px"},
              pixelOffset: new google.maps.Size(-90, 0),
              closeBoxMargin: "5px"
          };
  
          var ib = new InfoBox(infoOpts);
          ib.open(map, marker);
      });
  
      markers.push(marker);
  };
  </code></pre>
  
  <p>So somehow I have to trigger the mouseDown function of the appropriate marker, but it has to be done in a function outside of this one. I will have a reference to the appropriate marker in the array (markers[closestmarker]).</p>