amitabhaghosh197
1/5/2015 - 12:17 PM

Google multiple map

Google multiple map

 <script type="text/javascript">

 function initialize() {

    var locations = [

        ['<strong>Laser Battle IPOH</strong> <br/>' +'Lot T18,IPOH Parade<br/>'+'105, Jalan Sultan Abdul Jalil105, Jalan Sultan Abdul Jalil<br/>'+'31400 Ipoh, Perak, Malaysia<br/>'+ 'PH: 052559887 ', 4.595640,101.090215, 3],

        ['<strong>Laser Battle (JOHOR)</strong> <br/>'+'MS 11 & 12, 4th Floor, Johor Bahru City Square <br/>'+'108, Jalan Wong Ah Fook <br/>'+'80000 Johor Bahru<br/>' + 'PH: 072070179', 1.492659,103.741359, 2],
        
		['<strong>Laser Battle (Penang)</strong> <br/>'+'3rd Floor Queensbay Mall,  <br/>'+'100 Persiaran Bayan Indah <br/>' +'14300, Penang, Malaysia<br/>'+ 'PH: 0122653249', 5.334683,100.306608, 1],
		
		['<strong>Laser Battle (Kuala Lumpur)</strong> <br/>'+'Lot 07-90A, 7th Floor, Berjaya Times Square <br/>' +'1, Jalan Imbi, <br/>' + '55100 Kuala Lumpur, Malaysia<br/>' + 'PH: 0321105125', 3.141687,101.709987, 4],
        

    ];



    window.map = new google.maps.Map(document.getElementById('map'), {

        mapTypeId: google.maps.MapTypeId.ROADMAP

    });



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



    var bounds = new google.maps.LatLngBounds();



    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,

			title : 'Click Here'

        });



        bounds.extend(marker.position);



        google.maps.event.addListener(marker, 'click', (function (marker, i) {

            return function () {

                infowindow.setContent(locations[i][0]);

                infowindow.open(map, marker);

            }

        })(marker, i));

    }



    map.fitBounds(bounds);



    var listener = google.maps.event.addListener(map, "idle", function () {

        map.setZoom(5);

        google.maps.event.removeListener(listener);

    });

}



function loadScript() {

    var script = document.createElement('script');

    script.type = 'text/javascript';

    script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' + 'callback=initialize';

    document.body.appendChild(script);

}



window.onload = loadScript;

  

  </script>