Google Maps v3 Infowindows at true location anchor

This adapts the Google Maps API Infowindow example to place the infowindow anchor at the actual marker point, instead of the top of the marker image. This is achieved by temporarily hiding the marker visibility while the infowindow is being displayed. It also assigns the marker object directly to the markers array, instead of the usu al assignment to the marker variable which is then pushed to the markers array anyway. This prevents unneeded assignments, helps keep the global namespace cleaner, and speeds up processing.

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Map</title>
        <meta name="viewport" content="initial-scale=1.0">
        <meta charset="utf-8">
    </head>
<body>

<div><a href="#" data-reveal-id="myModal">Open google map</a></div>
<div id="map" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
  <div id="map"></div>
  <a class="close-reveal-modal" aria-label="Close">&#215;</a>
</div>


<script>
//Google Maps
    jQuery(function() {
        if ($("#map").length) {
            initMap();
        }
    });

    //initMap
    function initMap() {
       var locations = [
		[
			"Locatie title 0",
			52.083949,
			4.524197,
			"https://maps.google.com/mapfiles/ms/micons/blue.png",
			"city 0",
			"Address 0",
			"(071)|123|45|67"
		],
		[
			"Locatie title 1",
			52.147173,
			4.470745,
			"http://cdn.leafletjs.com/leaflet-0.6.4/images/marker-icon.png",
			"city 1",
			"Address 1",
			"+38/(071)/123/45/67"
		],
		[
			"Locatie title 2",
			52.166245,
			4.51764,
			"https://maps.google.com/mapfiles/ms/micons/blue.png",
			"city 2",
			"",
			"+38/(071)/123/45/67"
		],
		[
			"Locatie title 3",
			52.159244,
			4.572521,
			"https://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-dist/images/marker.png",
			"city 3",
			"",
			"+38/(071)/123/45/67"
		],
		[
			"Locatie title 4",
			52.126607,
			4.619146,
			"https://maps.google.com/mapfiles/ms/micons/blue.png",
			"",
			"Address 4",
			"+38 (071) 123-45-67"
		],
		[
			"Locatie title 5",
			52.159393,
			4.673784,
			"https://maps.google.com/mapfiles/ms/micons/blue.png",
			"City 5",
			"Address 5",
			"(071) 123 45 67"
		]
	];
        var map = new google.maps.Map(document.getElementById("map"), {
            zoom: 9,
            center: new google.maps.LatLng(52.159393,4.673784),
                
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });
        var infoWindow = new google.maps.InfoWindow();
        var marker, i;
   ...

CSS

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
#map {
    height: 500px;
    width: 500px;
    margin: 0 auto;
}