//Find 15 POS var respContent = ""; //array of locations var locations = [ ["Need A Part", "25 Pukekiwiriki Place EAST TAMAKI", "-36.9428237", "174.8724491", "Phone : 508 633 327", "0", "", "ASP_SERVICE_CENTER", "ASP_NZ_0001", "false"], ["L T Campbell", "128 Tory Street WELLINGTON", "-41.2966501", "174.7791826", "Phone : 43 859 389", "1", "", "ASP_SERVICE_CENTER", "ASP_NZ_0012", "false"], ["Devenport Electrical", "11 Olive Street MASTERTON", "-40.9409585", "175.6560334", "Phone : 63 775 067", "2", "", "ASP_SERVICE_CENTER", "ASP_NZ_0011", "false"], ["Electronic Systems Service", "382 Palmerston Road GISBORNE", "-38.6599722", "178.0196745", "Phone : 68 678 081", "3", "", "ASP_SERVICE_CENTER", "ASP_NZ_0010", "false"], ["Complete Home Appliance Service", "2 St John Street TAURANGA", "-37.6958136", "176.1596023", "Phone : 75 784 182", "4", "", "ASP_SERVICE_CENTER", "ASP_NZ_0009", "false"], ["Kingsroy Electric", "106 Devon Street West NEW PLYMOUTH", "-39.0585089", "174.0711358", "Phone : 67 583 523", "5", "", "ASP_SERVICE_CENTER", "ASP_NZ_0008", "false"], ["Kings Radio", "36 Harwood Street HAMILTON", "-37.7806638", "175.2749444", "Phone : 78 393 912", "6", "", "ASP_SERVICE_CENTER", "ASP_NZ_0007", "false"], ["McKay Appliance Servicing", "38 Water Street WHANGEREI", "-35.7263804", "174.3172487", "Phone : 94 701 910", "7", "", "ASP_SERVICE_CENTER", "ASP_NZ_0006", "false"], ["Sharpen & Repair", "214 Dominion Road MT EDEN", "-36.8754028", "174.7513996", "Phone : 93 792 005", "8", "", "ASP_SERVICE_CENTER", "ASP_NZ_0005", "false"], ["Service House", "4 Huron Street 
0622 TAKAPUNA", "-36.7889171", "174.771424", "Phone : 094899555", "9", "info@servicehouse.co.nz", "ASP_SERVICE_CENTER", "ASP_NZ_0002", "false"], ["Electrical Service Centre", "15 New Street NELSON", "-41.2715652", "173.2852579", "Phone : 35 483 144", "10", "", "ASP_SERVICE_CENTER", "ASP_NZ_0013", "false"], ["Blenheim Electric House", "42 Main Street BLENHEIM", "-41.5135868", "173.96379", "Phone : 35 783 564", "11", "", "ASP_SERVICE_CENTER", "ASP_NZ_0014", "false"], ["Saxon Appliances", "383 Wilson Street CHRISTCHURCH", "-43.5387338", "172.505621", "Phone : 33 656 404", "12", "", "ASP_SERVICE_CENTER", "ASP_NZ_0015", "false"], ["Connor and Fitzpatrick", "35 Medway Street GORE", "-46.0990325", "168.9466781", "Phone : 32 086 741", "13", "", "ASP_SERVICE_CENTER", "ASP_NZ_0016", "false"], ["GHD Repairs", "83 Tirimoana Rd Te Atatu South", "-36.883649", "174.651992", "Phone : 98 363 335", "14", "", "ASP_SERVICE_CENTER", "ASP_NZ_0017", "false"], ]; //center pmaps var $e = $('#map-canvas') window.map = new google.maps.Map(document.getElementById('map-canvas'), { center: new google.maps.LatLng($e.data("latitude"), $e.data("longitude")),//new google.maps.LatLng(-39.40484389333333,174.40176222666668), mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: true, MapTypeControlOptions : ['ROADMAP', 'SATELLITE'] }); //create empty LatLngBounds object var bounds = new google.maps.LatLngBounds(); //set infowindow var infowindow = new google.maps.InfoWindow(); var marker, i; var markerCollection = new Array(); for (i = 0; i < locations.length; i++) { var color = "0000FF" if("ASP_SERVICE_CENTER" == locations[i][7]) { color = "FF0000" } var markerPosition = new google.maps.LatLng(locations[i][2], locations[i][3]) marker = new google.maps.Marker({ position: markerPosition, animation: google.maps.Animation.DROP, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|'+color+'|FFFFFF', map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { //gotoPoint(i); infowindow.close(); return function() { marker.setAnimation(null); //showDetails('+i+'); jQuery('.shopdetails').slideUp('fast'); content='

'+locations[i][0]+'

'; content+=locations[i][1]+'
'; content+=locations[i][4]+'
'; console.log("dqsdqsd//false"); infowindow.setContent(content); infowindow.open(map, marker); gotoPoint(i,locations[i][8]); } })(marker, i)); //extend the bounds to include each marker's position bounds.extend(marker.position); infowindow[i] = infowindow; markerCollection[i] = marker; } if('' == 'true'){ // set zoom to show the country map in case no town is selected map.setZoom(10); }else{ // fit the map to include all the markers map.fitBounds(bounds); } var mcOptions = {gridSize: 50, maxZoom: 15, minimumClusterSize: 1000}; var mc = new MarkerClusterer(map, markerCollection, mcOptions); function gotoPoint(myPoint, posName) { map.setCenter(new google.maps.LatLng(locations[myPoint][2], locations[myPoint][3])); setTimeout(function () { markerCollection[myPoint].setAnimation(null); }, '5000'); // infowindow.close(); for (j = 0; j < locations.length; j++) { markerCollection[j].setAnimation(null); } if (markerCollection[myPoint].getAnimation() != null) { markerCollection[myPoint].setAnimation(null); } else { markerCollection[myPoint].setAnimation(google.maps.Animation.BOUNCE); } showDetails(posName, false); } function showDetails(shopIndex, isRepairersPage){ var showAddASP = false; var accountFormat = false; var hideDetails = false; if ($(".detailStore").data("show-add-asp") == true) { showAddASP = true; } if ($(".detailStore").data("account-format") == true) { accountFormat = true; } if ($(".detailStore").data("hide-details") == true) { hideDetails = true; } $.ajax({ url: "/consumer-services/ajax/"+shopIndex, crossDomain: true, data: { showAddASP: showAddASP, accountFormat: accountFormat, hideDetails: hideDetails, isRepairersPage: isRepairersPage !== undefined ? isRepairersPage : false }, success: function (result) { if (!$("#ShopDetail-"+shopIndex).length) { $(".detailStore").append(result); } } }); } $(".store-list").hide(); $("#map-canvas").hide(); $("#map-canvas").show();