" + indirizzo + cap + " " + citta + " (" + provincia + ")" + "
"; if (tel != "" && tel != null) { html += "
Tel: " + tel; } if (fax != "" && fax != null) { html += "
Fax: " + fax; } if (email != "") { html += "
E-mail: " + email + ""; } if (web != "") { html += "
Web: " + web + ""; } return html; } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function parseXml(str) { if (window.ActiveXObject) { var doc = new ActiveXObject('Microsoft.XMLDOM'); doc.loadXML(str); return doc; } else if (window.DOMParser) { return (new DOMParser).parseFromString(str, 'text/xml'); } } function doNothing() {} $(function() { searchLocationsNear_start(); }); var map = null; var center = "45.452564, 12.351158"; var markerArray = []; var myPoints = []; function initialize() { stile_mappa = [{ "elementType": "geometry", "stylers": [{ "color": "#212121" }] }, { "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "elementType": "labels.text.stroke", "stylers": [{ "color": "#212121" }] }, { "featureType": "administrative", "elementType": "geometry", "stylers": [{ "color": "#757575" }] }, { "featureType": "administrative.country", "elementType": "labels.text.fill", "stylers": [{ "color": "#9e9e9e" }] }, { "featureType": "administrative.locality", "elementType": "labels.text.fill", "stylers": [{ "color": "#bdbdbd" }] }, { "featureType": "landscape", "stylers": [{ "color": "#484849" }] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [{ "color": "#181818" }, { "visibility": "off" } ] }, { "featureType": "poi.park", "elementType": "labels.text.fill", "stylers": [{ "color": "#616161" }] }, { "featureType": "poi.park", "elementType": "labels.text.stroke", "stylers": [{ "color": "#1b1b1b" }] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [{ "color": "#2c2c2c" }] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [{ "color": "#8a8a8a" }] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [{ "color": "#373737" }] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [{ "color": "#3c3c3c" }] }, { "featureType": "road.highway.controlled_access", "elementType": "geometry", "stylers": [{ "color": "#4e4e4e" }] }, { "featureType": "road.local", "elementType": "labels.text.fill", "stylers": [{ "color": "#616161" }] }, { "featureType": "transit", "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "featureType": "water", "elementType": "geometry", "stylers": [{ "color": "#202020" }] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [{ "color": "#3d3d3d" }] } ]; var bounds = new google.maps.LatLngBounds(); center = new google.maps.LatLng(45.452564, 12.351158); var myOptions = { zoom: 3, center: center, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, navigationControl: true, styles: stile_mappa, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_rivenditori"), myOptions); var icon = '/img/marker-moretti.png'; var mcOptions = { styles: [{ textColor: 'white', height: 90, url: icon, width: 90 }, { textColor: 'white', height: 90, url: icon, width: 90 }, { textColor: 'white', height: 90, url: icon, width: 90 }, { textColor: 'white', height: 90, url: icon, width: 90 }, { textColor: 'white', height: 90, url: icon, width: 90 } ] }; var mc = new MarkerClusterer(map, [], mcOptions); for (var i = 0; i < myPoints.length; i++) { var point = new google.maps.LatLng(myPoints[i][0], myPoints[i][1]); createMarker(point, myPoints[i][2]); bounds.extend(point); } if (myPoints.length > 0) { map.fitBounds(bounds); } else { map.panTo(center); }; mc.addMarkers(markerArray, true); var marker = new google.maps.Marker({ position: point, map: map, title: 'Carlo Moretti', icon: "/img/marker-moretti.png" }); bounds.extend(point); } var infowindow = new google.maps.InfoWindow({ size: new google.maps.Size(150, 50) }); function createMarker(latlng, html, tipologia) { if (tipologia == "0") { var versione_icona = "/img/marker-moretti.png"; } else if (tipologia == "1") { var versione_icona = "/img/marker-gold-moretti.png"; } else if (tipologia == "2") { var versione_icona = "/img/marker-white-moretti.png"; }; var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, icon: versione_icona, zIndex: Math.round(latlng.lat() * -100000) << 5 }); marker.setAnimation(google.maps.Animation.BOUNCE); setTimeout(function() { marker.setAnimation(null) }, 2300); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map, marker); }); markerArray.push(marker); }; window.onload = function() { $(".box_dealer").each(function() { var row = [$(this).data("lat"), $(this).data("lng"), $(this).data("text")]; myPoints.push(row); }); $('#myModal').on('shown.bs.modal', function() { $('#myInput').focus() }); }; $(function() { $("body").on("click", "#res-submit", function() { searchLocations(); }); $("body").on("submit", "form", function() { searchLocations(); return false; }); initialize(); });