//" + html + "<\/div>"; // Switch icon on marker mouseover and mouseout GEvent.addListener(marker, "mouseover", function() { marker.setImage(iconos2[marker.mycategory]); }); GEvent.addListener(marker, "mouseout", function() { marker.setImage(iconos[marker.mycategory]); }); // === Store the category and name info as a marker properties === marker.mycategory = category; marker.myname = name; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); gmarkers.push(marker); return marker; } // == shows all markers of a particular category, and ensures the checkbox is checked == function show(category) { for (var i=0; i' + gmarkers[i].myname + ''; } } html += ''; document.getElementById("side_bar").innerHTML = html; } // create the map var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GOverviewMapControl(new GSize(150,120))); map.setCenter(new GLatLng(19.432454,-99.154648), 18); map.setMapType(G_SATELLITE_MAP); // === Define the function thats going to process the text file === process_it = function(doc) { // === split the document into lines === lines = doc.split("\n"); for (var i=0; i 1) { // === split each line into parts separated by "|" and use the contents === parts = lines[i].split("|"); var lat = parseFloat(parts[3]); var lng = parseFloat(parts[4]); var address = parts[2]; var name = parts[1]; var category = parts[0]; var html = ""+name+"

"+address; var point = new GLatLng(lat,lng); // create the marker var marker = createMarker(point,name,html,category); map.addOverlay(marker); } } // == show or hide the categories initially == show("curiosite"); hide("info"); hide("hotel"); // == create the initial sidebar == makeSidebar(); } GDownloadUrl("mexico.txt", process_it); } else { alert("Sorry, the Google Maps API is not compatible with this browser"); } // This Javascript is based on code provided by the // Blackpool Community Church Javascript Team // http://www.commchurch.freeserve.co.uk/ // http://econym.googlepages.com/index.htm //]]>