var mapPlacesMarkers = new Array(); var infoWindow = new google.maps.InfoWindow(); jQuery(function($) { var type=" 1"; var getting=" car"; //var m=''; //alert(type); var latlng = new google.maps.LatLng(54.62466, 39.738571); mapPlaces = new google.maps.Map(document.getElementById("places-map"), { zoom: (type!=3)?8:12, center: latlng, scrollwheel: true, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU} }); $.getJSON('/ajax/places.map/', { 'nocache': Math.random(), 'id': 'show', 'type' : type,'getting':getting }, function(e){ //mapPlaces.setZoom(8); //mapPlaces.setCenter(new google.maps.LatLng(54.62466, 39.738571)); $(e).each(function(){ placesMapMarkerAdd(this.lat, this.lng, this.html,type,0 ); }); });}) function oncar(){ $("span#link1").attr("class","oth taxi-act"); $("span#link2").attr("class","oth"); sidebarMapRemovePins(); $.getJSON('/ajax/places.map/', { 'nocache': Math.random(), 'id': 'show', 'type' : 1,'getting':'car' }, function(e){ mapPlaces.setZoom(8); mapPlaces.setCenter(new google.maps.LatLng(54.62466, 39.738571)); $(e).each(function(){ placesMapMarkerAdd(this.lat, this.lng, this.html,type,0 ); }); }) return false; } function onfoot(){$("span#link2").attr("class","oth taxi-act");$("span#link1").attr("class","oth"); sidebarMapRemovePins(); $.getJSON('/ajax/places.map/', { 'nocache': Math.random(), 'id': 'show', 'type' : 1,'getting':'foot' }, function(e){ mapPlaces.setZoom(8); mapPlaces.setCenter(new google.maps.LatLng(54.62466, 39.738571)); $(e).each(function(){ placesMapMarkerAdd(this.lat, this.lng, this.html,'clear',0 ); }); }) return false; } function placesMapMarkerAdd(lat, lng, html, what, type, zindex) { if(what==3) {var t=pins['places-wifi']} else {var t=pins['places-swimming']} //var mapPlacesMarkers = new Array(); var marker = new google.maps.Marker({ position: new google.maps.LatLng(lat, lng), map: mapPlaces, icon:t, shadow: pinShadow, shape: pinShape }); google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent('
'+html+'
'); infoWindow.open(mapPlaces, marker); }); mapPlacesMarkers.push(marker); } function sidebarMapRemovePins() { infoWindow.close(); $(mapPlacesMarkers).each(function(){ this.setMap(null); }); mapPlacesMarkers = []; }