
var map;
$(document).ready(function(){

    var a=document.getElementById('map');
    map = new GMaps({el: a,
        //el: '#map',
        lat: 55.763585,
        lng: 37.560883,
        zoom: 12,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        zoomControl : true,
        zoomControlOpt: {
            style : 'SMALL',
            position: 'TOP_LEFT'
        }
    });

    var logo=$('#logo').attr('src');
    //alert(logo);
    var icon = {
        url: '/bundles/realty/map_icon.png', // url
        scaledSize: new google.maps.Size(40, 40), // scaled size
        origin: new google.maps.Point(0,0), // origin
        anchor: new google.maps.Point(0, 0) // anchor
    };
    //var icon='/bundles/realty/map_icon.png';

    var markers=$('#PagesAllGoogleMap').val();
    markers= JSON.parse(markers);

    var PagesAllGoogleMap_path=$('#PagesAllGoogleMap_path').val();

    for (var i =0; i<markers.length;i++)
    {
        if (markers[i]['city'] && markers[i]['street'] ) {
            var address=markers[i]['city']+', '+markers[i]['street']+', '+markers[i]['house'];

            var image='';
            if (markers[i]['image_path']) {
                image='<img src="/'+markers[i]['image_path']+'">';
            }

            var price='';
            if (markers[i]['price']) {
                price='<p>Price: '+markers[i]['price']+' USD</p>';
            }

            var totalArea='';
            if (markers[i]['totalArea']) {
                totalArea='<p>Total Area: '+markers[i]['totalArea']+'m2</p>';
            }

            var floor='';
            if (markers[i]['totalArea']) {
                floor='<p>Floor: '+markers[i]['numberOfFloors']+'/'+markers[i]['floor']+'</p>';
            }

            var contentHtml='<div class="bubblewrap">' +
                '<a style="display:block;text-decoration:none" href="'+PagesAllGoogleMap_path+markers[i]['path']+'">' +
                '<div class="mapContainer">' +
                '<div class="mapPhoto">' + image +
                '</div>' +
                '<div class="mapDataC">' +
                '<p><i class="fa fa-map-marker" aria-hidden="true"></i>'+address+'</p>' +
                '<p>'+totalArea+'</p>' +
                '<p>'+floor+'</p>' +
                '<p>'+price+'</p>' +
                '</div>' +
                '<div class="view_div"><i class="info_window_arrow fa fa-5x fa-angle-right"></i></div>' +
                '</div>' +
                '</a>' +
                '</div>';
            // ************************
            // grnertae makers content theme hlml css
            // ************************

            mapMake(address,icon,contentHtml);
        }

    }


    function mapMake(address, icon, contentHtml )
    


});
{
        GMaps.geocode({
            address: address,
            callback: function(results, status, html1) {
                if (status == 'OK') {
                    var latlng = results[0].geometry.location;
                    map.setCenter(latlng.lat(), latlng.lng());
                    map.addMarker({
                        lat: latlng.lat(),
                        lng: latlng.lng(),
                        //   title: 'Lima',
                        icon: icon,
                        infoWindow: {
                            content: contentHtml
                        }
                    });
                }
            }
        });
    }