title: Cannot open google map marker from sidebar list
body: <p>I am working with the v3 API and trying to recreate the Store Locator sample (which is v2). I like the way the v2 version works vs the same article changed for v3 API. I have everything working with one exception: when I click the location result it does not open up the marker in the map for that location. Here is my code. I think the problem exists in the CreateSidebarEntry() function. Any help would be greatly appreciated! (you can see it in action here: <a href="http://www.webworksct.net/clients/ccparking/partners3.php" rel="nofollow noreferrer">http://www.webworksct.net/clients/ccparking/partners3.php</a> - just enter "orlando" in the search box and click search to get the results, then click a location in the list on the right...nothing happens).</p>
  
  <pre><code>//&lt;![CDATA[
      var map;
      var markers = [];
      var infoWindow;
   var sidebar;
      //var locationSelect;
  
      function load() {
        map = new google.maps.Map(document.getElementById("map"), {
          center: new google.maps.LatLng(40, -100),
          zoom: 4,
          mapTypeId: 'roadmap',
          mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT}
        });
        infoWindow = new google.maps.InfoWindow();
  
     sidebar = document.getElementById("sidebar");
  
     }
  
     function searchLocations() {
       var address = document.getElementById("addressInput").value;
       var geocoder = new google.maps.Geocoder();
       geocoder.geocode({address: address}, function(results, status) {
         if (status == google.maps.GeocoderStatus.OK) {
          searchLocationsNear(results[0].geometry.location);
         } else {
           alert(address + ' not found');
         }
       });
     }
  
     function clearLocations() {
       infoWindow.close();
       for (var i = 0; i &lt; markers.length; i++) {
         markers[i].setMap(null);
       }
       markers.length = 0;  
    sidebar.innerHTML = "";
     }
  
     function searchLocationsNear(center) {
       clearLocations(); 
  
       var radius = document.getElementById('radiusSelect').value;
       var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&amp;lng=' + center.lng() + '&amp;radius=' + radius;
       downloadUrl(searchUrl, function(data) {
         var xml = parseXml(data);
         var markerNodes = xml.documentElement.getElementsByTagName("marker");
         var bounds = new google.maps.LatLngBounds();
  
      var sidebar = document.getElementById('sidebar');
         sidebar.innerHTML = '';
         if (markerNodes.length == 0) {
           sidebar.innerHTML = 'No results found.';
           map.setCenter(new google.maps.LatLng(40, -100), 4);
           return;
         }
  
      for (var i = 0; i &lt; markerNodes.length; i++) {
           var name = markerNodes[i].getAttribute("name");
           var address = markerNodes[i].getAttribute("address");
           var distance = parseFloat(markerNodes[i].getAttribute("distance"));
           var latlng = new google.maps.LatLng(
                parseFloat(markerNodes[i].getAttribute("lat")),
                parseFloat(markerNodes[i].getAttribute("lng")));
  
           var marker = createMarker(latlng, name, address);
           bounds.extend(latlng);
  
     var sidebarEntry = createSidebarEntry(marker, name, address, distance);
           sidebar.appendChild(sidebarEntry);
         }
  
         map.fitBounds(bounds);
  
        });
      }
  
      function createMarker(latlng, name, address) {
        var html = "&lt;b&gt;" + name + "&lt;/b&gt; &lt;br/&gt;" + address;
        var marker = new google.maps.Marker({
          map: map,
          position: latlng
        });
        google.maps.event.addListener(marker, 'click', function() {
          infoWindow.setContent(html);
          infoWindow.open(map, marker);
        });
        markers.push(marker);
      }
  
   function createSidebarEntry(marker, name, address, distance) {
        var div = document.createElement('div');
        var html = '&lt;b&gt;' + name + '&lt;/b&gt; (' + distance.toFixed(1) + ')&lt;br/&gt;' + address;
        div.innerHTML = html;
        div.style.cursor = 'pointer';
        div.style.marginBottom = '5px'; 
        google.maps.event.addDomListener(div, 'click', function() {
          google.maps.event.trigger(marker, 'click');
        });
        google.maps.event.addDomListener(div, 'mouseover', function() {
          div.style.backgroundColor = '#eee';
        });
        google.maps.event.addDomListener(div, 'mouseout', function() {
          div.style.backgroundColor = '#fff';
        });
        return div;
      }
  
      function downloadUrl(url, callback) {
        var request = window.ActiveXObject ?
            new ActiveXObject('Microsoft.XMLHTTP') :
            new XMLHttpRequest;
  
        request.onreadystatechange = function() {
          if (request.readyState == 4) {
            request.onreadystatechange = doNothing;
            callback(request.responseText, request.status);
          }
        };
  
        request.open('GET', url, true);
        request.send(null);
      }
  
      function parseXml(str) {
        if (window.ActiveXObject) {
          var doc = new ActiveXObject('Microsoft.XMLDOM');
          doc.loadXML(str);
          return doc;
        } else if (window.DOMParser) {
          return (new DOMParser).parseFromString(str, 'text/xml');
        }
      }
  
      function doNothing() {}
  
      //]]&gt;
  </code></pre>