var points = []; var markers = []; var counter = 0; var sidebar_html = ""; var marker_html = []; var to_htmls = []; var from_htmls = []; var map = null; if (GBrowserIsCompatible()) { // Display the map, with some controls var map = new GMap(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(40.75604, -73.986941), 12); // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there var side_bar_html = ""; var gmarkers = []; var htmls = []; var i = 0; // This function picks up the click and opens the corresponding info window function myclick(i) { gmarkers[i].openInfoWindowHtml(htmls[i]); } // A function to create the marker and set up the event window function createMarker(point,name,price,bedrooms,bathrooms,thumb,html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html + '
'); }); // save the info we need to use later for the side_bar gmarkers[i] = marker; htmls[i] = html; // add a line to the side_bar html side_bar_html += '
  • '; // Do we need the image tag? if (thumb != null) { // Yup, we have an image; side_bar_html += '
    '; } // Rest of the info; side_bar_html += '

    ' + name + '

    ' + price + bedrooms + bathrooms + '
  • '; //sidebar_html += '
  • ' + name + '
  • '; i++; return marker; } // ================================================================ // === Define the function thats going to process the JSON file === process_it = function(doc) { // === Parse the JSON document === var jsonData = eval('(' + doc + ')'); // Data before the loop; side_bar_html += '