//Hotel Embassy
Via Salandra, 6
00187 - '+arraycitta[id_lang]+'

'+arraybook[id_lang]+'

'; var hotels = '
Hotel Embassy
Via Salandra, 6
00187 - '+arraycitta[id_lang]+'
'; ////////////////BLOCCO HOTELS///////////////////// //Icona H-Rossa var hotIcon = new GIcon(); hotIcon.image = "../map/hrosso.png"; hotIcon.iconSize = new GSize(18, 18); hotIcon.iconAnchor = new GPoint(7, 7); hotIcon.infoWindowAnchor = new GPoint(18, 18); //Icona H-Blu var coldIcon = new GIcon(hotIcon); coldIcon.image = "../map/hblu.png"; // Funzione crea tutti gli alberghi function createMarker(i,point,name,html,category) { //alert(id_lang); var marker = new GMarker(point,coldIcon); marker.mycategory = category; marker.myname = name; //Evento Click Nuvoletta GEvent.addListener(marker, "click", function() { map.removeOverlay(cmarkers[i]); map.addOverlay(hmarkers[i]); marker.openInfoWindowHtml(hotels); }); //Quando se chiude la nuvola cambia a Blu GEvent.addListener(marker, "infowindowclose", function() { map.removeOverlay(hmarkers[i]); map.addOverlay(cmarkers[i]);}); // Switch marker mouseover e mouseout GEvent.addListener(marker, "mouseover", function() { marker.setImage("../map/hrosso.png");}); GEvent.addListener(marker, "mouseout", function() { marker.setImage("../map/hblu.png");}); gmarkers.push(marker); //salva due markers Cold e Hot //alert (i); cmarkers[i] = marker; hmarkers[i] = new GMarker(point,hotIcon); htmls[i] = html; return marker; } function showTooltip(marker) { tooltip.innerHTML = marker.tooltip; var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom()); var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom()); var anchor=marker.getIcon().iconAnchor; var width=marker.getIcon().iconSize.width; var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x-30 - anchor.x + width,- offset.y + point.y +anchor.y)); pos.apply(tooltip); tooltip.style.visibility="visible"; } ////////////////BLOCCO MONUMENTI///////////////////// //CREA ICONA MONUMENTI var url_img= "../map/sight.png"; gicons["sight"] = new GIcon(G_DEFAULT_ICON, url_img); gicons["sight"].iconSize = new GSize(15, 15); gicons["sight"].shadow = ""; gicons["sight"].iconAnchor = new GPoint(7, 7); gicons["sight"].infoWindowAnchor = new GPoint(7, 7); //FUNZIONE CREA MONUMENTI function createMarkerSight(points, monumento, descrizione, foto) { var markerSight = new GMarker(points,gicons["sight"]); markerSight.tooltip = '
'+monumento+'
'; GEvent.addListener(markerSight, "mouseover", function() { showTooltip(markerSight); }); GEvent.addListener(markerSight,"mouseout", function() { tooltip.style.visibility="hidden" }); return markerSight; } ////////////////BLOCCO AEROPORTI///////////////////// //CREA ICONA AEROPORTO var url_img= "../map/aeroporto.png"; gicons["air"] = new GIcon(G_DEFAULT_ICON, url_img); gicons["air"].iconSize = new GSize(15, 15); gicons["air"].shadow = ""; gicons["air"].iconAnchor = new GPoint(7, 7); gicons["air"].infoWindowAnchor = new GPoint(7, 7); //FUNZIONE CREA AEROPORTO function createMarkerAir(point, testohtml) { var markerAir = new GMarker(point,gicons["air"]); //alert(point); GEvent.addListener(markerAir, "click", function() { markerAir.openInfoWindowHtml(testohtml); }); return markerAir; } ////////////////BLOCCO MAPPA+XML////////////////////13/ // Crea la mappa di Roma, zoom 15, senza ombra var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GOverviewMapControl()); map.setCenter(new GLatLng(41.905642 , 12.495518), 15); map.getPane(G_MAP_FLOAT_SHADOW_PANE).style.visibility="hidden"; //MARKER HOTEL// map.openInfoWindowHtml(map.getCenter(), hotels); //MARKER AEROPORTI ROME// var point = new GLatLng(41.797987, 12.589636); map.addOverlay(createMarkerAir(point, '
'+titolo_cia[id_lang]+'

'+descrizione_cia[id_lang]+'
')); var point = new GLatLng(41.794033, 12.251048); map.addOverlay(createMarkerAir(point, '
'+titolo_fco[id_lang]+'

'+descrizione_fco[id_lang]+'
')); // ====== set up marker mouseover tooltip div ====== var tooltip = document.createElement("div"); document.getElementById("map").appendChild(tooltip); tooltip.style.visibility="hidden"; //////////HOTEL E MONUMENTI// // Legge campi da vars e crea marker Hotel var lat = 41.905642; var lng = 12.495518; var point = new GLatLng(lat,lng); var name = 'Hotel Embassy'; var html = 'Via Salandra, 6'; var category = '***'; var marker = createMarker(i,point,name,html,category); map.addOverlay(marker); // Legge i markers del file monumenti.php, crea un xml GDownloadUrl("../map/monumenti.php?id_lang="+id_lang, function(doc) { var xmlDoc = GXml.parse(doc); var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // obtain the attribues of each marker var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var points = new GLatLng(lat,lng); var monumento = markers[i].getAttribute("monumento"); var descrizione = markers[i].getAttribute("des"); var foto = markers[i].getAttribute("foto"); // manda a creare ogni marker-monumento var marker = createMarkerSight(points, monumento, descrizione, foto); map.addOverlay(marker); }}); } else { alert("Sorry, the Google Maps API is not compatible with this browser"); }