var names = ["Knight's Mechanical of Elizabethtown","Knight's Mechanical of Glasgow"]; var streets = ["4250 Leitchfield Road","180 Beaver Trail South"]; var streets2 = ["",""]; var citystatezips = ["Cecilia, KY 42724","Glasgow, KY 42141"]; var phones = ["(270) 765-4141","(270) 678-4731"]; var faxes = ["",""]; var LatNums = [37.666769,36.989322]; var LongNums = [-85.925317,-85.912399]; var centerLat = 37.325397; var centerLong = -85.767517; var startZoom = 9; // 1-19, larger = zoomed in more var locs = []; var infos = []; var markers = []; var latlngs = []; var map; var totalMarkers; var linkAddy,linkURL = ""; function GoogleMap() { var latlng = new google.maps.LatLng(centerLat,centerLong); var myOptions = {zoom:startZoom, center:latlng, mapTypeId:google.maps.MapTypeId.ROADMAP}; map = new google.maps.Map(document.getElementById("googlemap"), myOptions); linkAddy = (streets[0]+"+"+citystatezips[0]).replace(/ /g,"+").replace(/,/g,""); linkURL = "http://maps.google.com/maps?f=q&hl=en&q="+linkAddy+"&om=1"; locs[0] = '
'+names[0]+'
'+streets[0]+'
'; if (streets2[0] != "") {locs[0] = locs[0] + streets2[0]+'
'} locs[0] = locs[0]+citystatezips[0]+'
'; if (phones[0] != "") {locs[0] = locs[0] + 'Phone: ' + phones[0]+'
'} if (faxes[0] != "") {locs[0] = locs[0] + 'Fax: ' + faxes[0]+'
'} locs[0] = locs[0]+'Get Driving Directions
'; infos[0] = new google.maps.InfoWindow({content:locs[0] }); latlngs[0] = new google.maps.LatLng(LatNums[0],LongNums[0]); markers[0] = new google.maps.Marker({position:latlngs[0], map:map, title:names[0]}); google.maps.event.addListener(markers[0], 'click', function() { ScrollMap(0); }); totalMarkers = 0; linkAddy = (streets[1]+"+"+citystatezips[1]).replace(/ /g,"+").replace(/,/g,""); linkURL = "http://maps.google.com/maps?f=q&hl=en&q="+linkAddy+"&om=1"; locs[1] = '
'+names[1]+'
'+streets[1]+'
'; if (streets2[1] != "") {locs[1] = locs[1] + streets2[1]+'
'} locs[1] = locs[1]+citystatezips[1]+'
'; if (phones[1] != "") {locs[1] = locs[1] + 'Phone: ' + phones[1]+'
'} if (faxes[1] != "") {locs[1] = locs[1] + 'Fax: ' + faxes[1]+'
'} locs[1] = locs[1]+'Get Driving Directions
'; infos[1] = new google.maps.InfoWindow({content:locs[1] }); latlngs[1] = new google.maps.LatLng(LatNums[1],LongNums[1]); markers[1] = new google.maps.Marker({position:latlngs[1], map:map, title:names[1]}); google.maps.event.addListener(markers[1], 'click', function() { ScrollMap(1); }); totalMarkers = 1; } function ScrollMap(num){ closeMarkers(); infos[num].open(map,markers[num]); } function closeMarkers(){ for (var i=0; i<=totalMarkers; i++){ infos[i].close(map,markers[i]); } }