Click function for map marker syntax

Click function for map marker syntax

I'm writing a script to call a unique bootstrap modal depending on which map marker is clicked on a google map.  I can't get the modal to launch within my click event of the for loop.  If I write a click event for each marker independently it works fine, but I don't want to write 50 click events...  I know its how I'm writing the click event thats the problem, I just don't know how to write it properly.

  1.   var map;
  2.   var mapOptions = {
  3.     zoom: 8,
  4.     center: new google.maps.LatLng(43.819201,-79.535474),
  5.     disableUi: true
  6.   };
  7.   map = new google.maps.Map(document.getElementById('map-canvas'),
  8.       mapOptions);
  9.  
  10. var commerciallocations = [
  11.          ['Regan',43.703264,-79.804144,'#modal0'],
  12. ['Lake',43.897239,-78.6594789, '#modal1'],
  13. ['Rowe',43.72277,-80.378554, '#modal2'],
  14. ['Westport',43.649826,-79.6599653, '#modal3'],
  15. ['Vinefresh',42.9556009,-81.6699305, '#modal4'],
  16. ['Winery', 42.1209449,-82.9707676, '#modal5']
  17. ];
  18. var markers =[];
  19. for (var i = 0; i < commerciallocations.length; i++) {  
  20. var place = commerciallocations[i];
  21. var marker = new google.maps.Marker({
  22. position: new google.maps.LatLng(commerciallocations[i][1],                                                     commerciallocations[i[2]),
  23. map: null,
  24. icon:'images/commercialmapicon.png',
  25. title: place[0]
  26. });
  27. markers.push(marker);
  28. google.maps.event.addListener(marker, 'click', function() {
  29. place[5].modal('show');
  30. });
  31. }

  32. function toggleLayer() {
  33.     for (var i = 0; i < markers.length; i++) {
  34.         if (markers[i].getMap() === null) {
  35.             markers[i].setMap(map);
  36.         } else {
  37.             markers[i].setMap(null);
  38.         }
  39.     }
  40. }