var names = ["Pools Plus - Service Dept","Pools Plus - Elizabethtown","Pools Plus - Louisville"];
var streets = ["2417 Ring Rd.","2407 Ring Road, Suite 114","8130 New LaGrange Rd."];
var streets2 = ["","",""];
var citystatezips = ["Elizabethtown, KY 42701","Elizabethtown, KY 42701","Louisville, KY 40222"];
var phones = ["(270)769-0585","(270)737-7665","(502)426-1250"];
var faxes = ["","",""];
var LatNums = [37.732255,37.732232,38.258356];
var LongNums = [-85.847488,-85.847861,-85.60431];
var centerLat = 37.992255;
var centerLong = -85.60431;
var startZoom = 8; // 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;
linkAddy = (streets[2]+"+"+citystatezips[2]).replace(/ /g,"+").replace(/,/g,"");
linkURL = "http://maps.google.com/maps?f=q&hl=en&q="+linkAddy+"&om=1";
locs[2] = ''+names[2]+''+streets[2]+'
';
if (streets2[2] != "") {locs[2] = locs[2] + streets2[2]+'
'}
locs[2] = locs[2]+citystatezips[2]+'
';
if (phones[2] != "") {locs[2] = locs[2] + 'Phone: ' + phones[2]+'
'}
if (faxes[2] != "") {locs[2] = locs[2] + 'Fax: ' + faxes[2]+'
'}
locs[2] = locs[2]+'
Get Driving Directions ';
infos[2] = new google.maps.InfoWindow({content:locs[2] });
latlngs[2] = new google.maps.LatLng(LatNums[2],LongNums[2]);
markers[2] = new google.maps.Marker({position:latlngs[2], map:map, title:names[2]});
google.maps.event.addListener(markers[2], 'click', function() {
ScrollMap(2);
});
totalMarkers = 2;
}
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]);
}
}