// if ( BrowserIsGMapsCompatible() ) { var gmaps_marker = []; var gmaps_marker_shadow = []; var gmaps_marker_main = []; var gmaps_marker_infowindow = []; var gmaps_marker_is_hovering = []; function gmaps_marker_mouseover(count,image_hover,html,tooltip_xoffset,tooltip_yoffset) { // switch icon image for hover image on marker mouseover and display the tooltip if ( ! gmaps_marker_is_hovering[count] ) { gmaps_marker_is_hovering[count] = 1; gmaps_marker_main[count].setIcon( image_hover ); if (html) { // show tooltip var tooltipContentString = '
'+html+'
'; gmaps_marker_infowindow[count] = new google.maps.InfoWindow({ content: tooltipContentString, // maxWidth: 400, pixelOffset: new google.maps.Size(tooltip_xoffset,tooltip_yoffset) }); gmaps_marker_infowindow[count].open(map, gmaps_marker_main[count]); } } return true; } function gmaps_marker_mouseout(count,image_main) { // switch hover image for main image on marker mouseout and hide the tooltip if ( gmaps_marker_is_hovering[count] ) { gmaps_marker_is_hovering[count] = 0; gmaps_marker_main[count].setIcon( image_main ); if ( gmaps_marker_infowindow[count] ) { // hide tooltip gmaps_marker_infowindow[count].close(); } } return true; } // function to create the marker and set up the event window function createMarker(map,lat_lng,html,count,thing_id) { var detail_url = ''; // extract required info associated with the particular thing_id if ( thing_id == 355 ) { var image_shadow = { url: 'https://www.top10fresh.com/produce/reviews/skins/default/images/misc/gmaps_shadow_1.png', // This shadow marker is normally 71 pixels wide by 40 pixels high. size: new google.maps.Size(71, 40), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base normally at (43, 40). anchor: new google.maps.Point(43, 40) }; gmaps_marker_shadow[count] = new google.maps.Marker({ position: lat_lng, map: map, icon: image_shadow, zIndex: 1 }); var image_main = { url: 'https://www.top10fresh.com/produce/reviews/google/icons/main/1/1.png', // This marker is normally 50 pixels wide by 40 pixels high. size: new google.maps.Size(50, 50), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base at (43, 40). anchor: new google.maps.Point(43, 40) }; // Shapes define the clickable region of the icon. The type defines an HTML // rect: coords is [x1,y1,x2,y2] where x1,y1 are the coordinates of the upper-left corner // of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle. var shape = { coords: [ 25, 0, 50, 50 ], type: 'rect' }; gmaps_marker_main[count] = new google.maps.Marker({ position: lat_lng, map: map, icon: image_main, shape: shape, title: 'Locale Salinas Valley Strawberries (Pallet)', zIndex: 100 }); var image_hover = { url: 'https://www.top10fresh.com/produce/reviews/google/icons/hover/1/1.png', // This marker is normally 50 pixels wide by 40 pixels high. size: new google.maps.Size(50, 50), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base normally at (43, 40). anchor: new google.maps.Point(43, 40) }; gmaps_marker_is_hovering[count] = 0; detail_url = 'https://www.top10fresh.com/reviews/items/Nova-Scotia/sbr/date_desc/355/locale-salinas-valley-strawberries-pallet.htm'; if (detail_url) { // clicking on the marker will open the detail page for the thing; hovering will show the tooltip var clickURL = detail_url; var target = '_self'; gmaps_marker_main[count].addListener('click', function() { window.open(clickURL, target); }); } // switch icon image for hover image on marker mouseover and mouseout gmaps_marker_main[count].addListener( 'mouseover', function() { gmaps_marker_mouseover(count,image_hover,html,15,0) }); gmaps_marker_main[count].addListener( 'mouseout', function() { gmaps_marker_mouseout(count,image_main) }); // add listeners to allow the tooltips to be invoked when // mousing over the known_as links in the thing listing var link_id = 'known_as_link_355'; var link_elem = document.getElementById(link_id); if (window.addEventListener) // Mozilla, Netscape, Firefox { link_elem.addEventListener( 'mouseover', function() { gmaps_marker_mouseover(count,image_hover,html,15,0); }, false ); link_elem.addEventListener( 'mouseout', function() { gmaps_marker_mouseout(count,image_main); }, false ); } else // IE { link_elem.attachEvent( 'onmouseover', function() { gmaps_marker_mouseover(count,image_hover,html,15,0); } ); link_elem.attachEvent( 'onmouseout', function() { gmaps_marker_mouseout(count,image_main); } ); } } } let map; async function initMap() { // create a map object with some controls const { Map } = await google.maps.importLibrary("maps"); map = new google.maps.Map(document.getElementById('map'), { mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, // HORIZONTAL_BAR | DROPDOWN_MENU, mapTypeIds: ['roadmap','satellite','terrain','hybrid'] }, scaleControl: true, zoomControl: true, fullscreenControl: true, streetViewControl: true }); // for each point found, extent the bounds to include it var center_latitude = 36.87571; var center_longitude = -121.713707; // draw the map at specified location + zoom level var point_1 = new google.maps.LatLng(center_latitude,center_longitude); map.setCenter( point_1 ); map.setZoom( 7 ); // add markers with infos window. wrap the text in each window. var tooltip_html_1 = '' +'' +'' +'' +' ' +' ' +' ' +' ' +' ' +'' +' ' +'' +'' +'
' +' ' +' Locale Salinas Valley Strawberries (Pallet)' +'
(CA0018 Locale Brand)' +'

' +' Royal Oaks,' +' CA 95076' +'
' +' ' +'' +'
' +''; createMarker( map, point_1, tooltip_html_1, 1, 355 ); } initMap(); } //