// Script add
// https://maps.googleapis.com/maps/api/js?key=AIzaSyAdgtKv7SriM13lFaja6Kg0DM4yZXkpoRA;

var locations = [
 
    ['<div class="map_lis"><h4>Ananda Care</h4><ul> <li><p>Pai Farms, 30 Next to Ashok Country Resort,</p> <p>Rajokri, Rd, D Block, Samalka, New Delhi,</p> <p>Delhi 110037</p><li class="dirct"><a clas="pop_direct" href="https:shorturl.at/dnOUV" target="_blank"><span>Get Direction</span><img src="assets/icons/rightarrow_color.png" /></a></li></ul></div>', 28.526696, 77.093467, 10, '#loc1'],
  ];
    var map_style = [
{
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#f5f5f5"
    }
  ]
},
{
    "elementType": "labels.icon",
    "stylers": [
    {
        "visibility": "off"
    }
  ]
},
{
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#616161"
    }
  ]
},
{
    "elementType": "labels.text.stroke",
    "stylers": [
    {
        "color": "#f5f5f5"
    }
  ]
},
{
    "featureType": "administrative.land_parcel",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#bdbdbd"
    }
  ]
},
{
    "featureType": "poi",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#eeeeee"
    }
  ]
},
{
    "featureType": "poi",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#757575"
    }
  ]
},
{
    "featureType": "poi.park",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#e5e5e5"
    }
  ]
},
{
    "featureType": "poi.park",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#9e9e9e"
    }
  ]
},
{
    "featureType": "road",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#ffffff"
    }
  ]
},
{
    "featureType": "road.arterial",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#757575"
    }
  ]
},
{
    "featureType": "road.highway",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#dadada"
    }
  ]
},
{
    "featureType": "road.highway",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#616161"
    }
  ]
},
{
    "featureType": "road.local",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#9e9e9e"
    }
  ]
},
{
    "featureType": "transit.line",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#e5e5e5"
    }
  ]
},
{
    "featureType": "transit.station",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#eeeeee"
    }
  ]
},
{
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
    {
        "color": "#c9c9c9"
    }
  ]
},
{
    "featureType": "water",
    "elementType": "labels.text.fill",
    "stylers": [
    {
        "color": "#9e9e9e"
    }
  ]
}
]

      var zumSet = 0;
      if ($(window).width() <= 1366) {
          zumSet = 4.7
      }
      else {
          zumSet = 10;
      }

      var map = new google.maps.Map(document.getElementById('map_2'), {
          zoom: zumSet,
          center: new google.maps.LatLng(28.526696, 77.093467),
          styles: map_style,
          streetViewControl: true,
          backgroundColor: "#222",
          mapTypeControl: false,
          disableDefaultUI: true,
          panControl: true,
          zoomControl: true,
          scrollwheel: false,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      });
      if ($(window).width() <= 1366) {
          map.panBy(100, 150);
      }
      else {
          map.panBy(120, 60);
      }

      var infowindow = new google.maps.InfoWindow();

      var marker, i;

      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: 'assets/images/pinmn.png'
          });

          google.maps.event.addListener(marker, 'click', (function (marker, i) {
            $('aside.aside-Location').removeClass('slide');
              return function () {
                  infowindow.setContent(locations[i][0]);
                  infowindow.open(map, marker);
                  $('.map_btn[data-infow-ref="' + locations[i][4] + '"]').trigger('click');
              };
          })(marker, i));
      }
      // Open Default
      infowindow.setContent(locations[0][0]);
      infowindow.open(map,marker);


      $('.map_btn').click(function () {
          map.setCenter(new google.maps.LatLng($(this).attr('data-lat'), $(this).attr('data-long')));
          map.setZoom(parseInt($(this).attr('data-zoom')));
      });


      $('[data-trig-ref]').click(function () {
          $('.map_btn[data-infow-ref="' + $(this).attr('data-trig-ref') + '"]').trigger('click');

      });

      $(function()
      {
        setTimeout(function(){
          $('.map_btn').trigger('click');
        },1000)
      })
    