function tohere(k) { infowindow.setContent(to_htmls[k]); } function fromhere(k) { infowindow.setContent(from_htmls[k]); } function AddMarker(map,lat,lon,msg,image) { var icon = new google.maps.MarkerImage(image); var point = new google.maps.LatLng(lat,lon); bounds.extend(point); map.fitBounds(bounds); var marker = new google.maps.Marker({ position: point, map: map, icon: icon }); // The info window version with the 'to here' form open if (msg) { var to_directions = '
Directions: To here -' + 'From here' + '
Start address:
' + '
' + '' + ''; // The info window version with the 'to here' form open var from_directions = '
Directions: To here - From here' + '
Start address:' + '
' + '' + ''; var inactive = '
Directions: To here - From here'; } // The inactive version of the direction info //msg = name + msg + '
Directions: To here - From here'; to_htmls[i] = msg + to_directions; from_htmls[i] = msg + from_directions; msg = msg + inactive; google.maps.event.addListener(marker, 'click', (function(marker) { return function() { infowindow.setContent(msg); infowindow.open(map, marker); } })(marker)); htmls[i] = msg; i++; return marker; }