Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (75 sloc) 3.35 KB
<style>
#mapCanvas {
width: 480px;
height: 500px;
float: left;
}
#mapList div {
width: 50%;
float: left;
}
#content {
display: inline-block;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&.js"></script>
<script type="text/javascript">
var map;
var global_markers = [];
var markers = [
[32.86776, -97.42665, 'Eagle Ranch Familty Medicine Center', '7235 Boat Club Road', 'Eagle Mountain, TX 76179'],
[32.75053, -97.36925, 'Patient Care Center', '855 Montgomergy Street', 'Fort Worth, TX 76107'],
[32.68498, -97.30897, 'Seminary Drive Family Medicine Clinic', '1305 E Seminary Drive', 'Fort Worth, TX 76115'],
[32.75054, -97.37043, 'Sleep Medicine Lab', '363632 Modlin Avenue', 'Fort Worth, TX 76107'],
[32.74954, -97.36903, 'UNTHSC Main Campus', '3500 Camp Bowie Blvd', 'Fort Worth, TX 76107'],
[32.95705, -97.28171, 'UNT Health at Alliance', '12650 N Beach St', 'Fort Worth, TX 76244'],
[32.73593, -97.33893, 'Bone and Joint Institute at Ben Hogan Center', '800 5th Avenue', 'Fort Worth, TX 76104'],
[32.73573, -97.33984, 'OB/Gyn Klabzuba Tower at Harris Methodist Hospital', '1300 W. Terrell', 'Fort Worth, TX 76104'],
[32.75053, -97.36925, 'Physical Therapy at PCC', '855 Montgomery', '855 Montgomery', 'Fort Worth, TX 76107'],
[32.72878, -97.32930, 'Business Services Office', '1412 May Street', 'Fort Worth, TX 76104']
];
var infowindow = new google.maps.InfoWindow({});
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(32.75549, -97.33077);
var myOptions = {
zoom:10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("mapCanvas"), myOptions);
google.maps.event.addListener(map, 'click', function(){
infowindow.close();
});
addMarker();
}
function addMarker() {
for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var lat = parseFloat(markers[i][0]);
var lng = parseFloat(markers[i][1]);
var clinicName = markers[i][2];
var clinicAdd = markers[i][3];
var clinicAddTwo = markers[i][4];
var myLatlng = new google.maps.LatLng(lat, lng);
var stringS = '<div><p><strong><a onclick="myClick(' + i + ');">' + clinicName + '</strong><br>' + clinicAdd + '<br>' + clinicAddTwo + '</p></div>';
var contentString = '<html><body>' + stringS + '<p><a href="https://maps.google.com/maps/ms?msid=209425398144392039059.0004dcc83333ea9002e62&amp;msa=0&amp;ll=32.72361,-97.351398&amp;spn=0.125209,0.253544&amp;dg=feature" target="_blank">Click here to open in GoogleMaps</a></p></body></html>';
document.getElementById('mapList').innerHTML += stringS;
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: clinicName + "<br />" + clinicAdd + "<br />" + clinicAddTwo
});
marker['infowindow'] = contentString;
global_markers[i] = marker;
google.maps.event.addListener(global_markers[i], 'click', function () {
infowindow.setContent(this['infowindow']);
infowindow.open(map, this);
});
}
}
function myClick(id) {
google.maps.event.trigger(global_markers[id], 'click');
}
window.onload = initialize;
</script>