// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.
// The maximum width of the info window is set to 200 pixels.
var locations = [['<div class="map-window p-3 text-center"><h3>Headquarters</h3><p>sample address <br> sample address <br> sample address</p></div>', 51.5136785,-0.1437505, '','']];
    

var obj = document.getElementById('map');
var map = null;
var cat_location = [];
var marker = [], i;
var marker_array = [];
var infowindow;
var marker1 = [];
var start = 0;
var catFlag = false;

function initMap() {
    map = new google.maps.Map(obj, {
        zoom: 12,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });
    var red_road_styles = [
        {
            featureType: "all",
            //stylers: [{saturation: -100}]
        },
        {
            featureType: "road.highway",
            //stylers: [ {hue: "#373737"}, {saturation: 10}]
        }
    ];
    map.setOptions({
        styles: red_road_styles,
		zoomControl: true,
        disableDefaultUI: true
    });

    infowindow = new google.maps.InfoWindow({
        maxWidth: 550
    });

    for (i = 0; i < locations.length; i++) {
        marker = new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][1], locations[i][2]),
            map: map,
            icon: locations[i][3]
        });

        marker_array[i] = marker;

        google.maps.event.addListener(marker, 'click', (function (marker, i) {
            return function () {
                infowindow.setContent(locations[i][0]);
                infowindow.open(map, marker);
                start = i;
				//document.getElementById('infoContent').innerHTML = locations[i][0];
            }
        })(marker, i));
    }

    map.setCenter({lat: locations[0][1], lng: locations[0][2]});
	//document.getElementById('infoContent').innerHTML = locations[0][0];
	
    google.maps.event.addListenerOnce(map, 'idle', function () {
        infowindow.setContent(locations[0][0]);
        infowindow.open(map, marker_array[0]);
    });

}
$(window).on('load', function(){ 
    if($('#map').length > 0){
        initMap();
    }
    
});

