// Check to see if this browser can run the Google API
if (GBrowserIsCompatible()) {

 var trucktrailer="<p style='margin-top:0px;margin-bottom:6px;padding-bottom:6px;border-bottom:solid 1px #DEDEDE;'><img src='/fagantrucktrailer-com/assets/images/fagan-logo-google.gif' width='102' height='46' style='float:right;margin-left:0px;margin-bottom:0px;'>" +
 "<strong style='color:#005998;'>Chevy/Cadillac</strong><br />3601 E. Milwaukee St.<br />Janesville, WI, USA<br />Phone: 608.752.1331 or<br />800.236.3221</p>" +
 "<p style='margin-top:6px;margin-bottom:6px;clear:both;'><img src='/fagantrucktrailer-com/assets/images/fagantt-logo-google.gif' width='102' height='46' style='float:right;margin-left:0px;margin-bottom:0px;'>" +
 "<strong style='color:#005998;'>Truck & Trailer</strong><br />608.752.8282 or<br />800.236.0000</p>" +
 "<strong style='color:#005998;'>Directions To Us - Starting Address:</strong><br />" +
 "<form action='http://maps.google.com/maps' method='get' target='_blank' style='padding:0px;margin:0px;'>" +
 "<input type='text' name='saddr' id='saddr' value='' style='width:215px;' /><br />" +
 "<INPUT value='Get Directions' TYPE='SUBMIT' class='input-button' style='margin-top:3px;margin-bottom:3px;'><input type='hidden' name='daddr' value='3601 E. Milwaukee St.,Janesville, WI'/>" +
 "</form>";

 var milton="<p style='margin-top:0px;margin-bottom:6px;'><img src='http://www.fagantrucktrailer.com/fagantrucktrailer-com/assets/images/fagantt-milton.gif' width='102' height='46' style='float:right;margin-left:0px;margin-bottom:0px;'>" +
 "4952 N. WI-26<br />Janesville, WI, USA<br />608.868.4334</p>" +
 "<strong style='color:#005998;'>Directions To Us - Starting Address:</strong><br />" +
 "<form action='http://maps.google.com/maps' method='get' target='_blank' style='padding:0px;margin:0px;height:auto;'>" +
 "<input type='text' name='saddr' id='saddr' value='' style='width:215px;' /><br />" +
 "<INPUT value='Get Directions' TYPE='SUBMIT' class='input-button' style='margin-top:3px;margin-bottom:3px;'><input type='hidden' name='daddr' value='4952 N WI-26,Janesville, WI'/>" +
 "</form>";


// A function to create the marker and set up the event window
   var previousCenterPoint ; 
   var previousZoom ;

function createMarker(point,html) {
   var marker = new GMarker(point);

	GEvent.addListener(marker, "click", function() {
	previousCenterPoint = map.getCenter() ; 
	previousZoom = map.getZoom() ; 
	marker.openInfoWindowHtml(html);
	});
	GEvent.addListener(map, "infowindowclose", function() { 
     map.setCenter(previousCenterPoint,previousZoom); 
	// add your code to inform user here 
	}); 
   return marker;

}

 // functions that open the directions forms
 // Display the map, with some controls and set the initial location 
 var map = new GMap2(document.getElementById("map"));
 map.addControl(new GLargeMapControl());
 map.addControl(new GMapTypeControl());
 map.setCenter(new GLatLng(42.72590000, -88.9600000), 12);

 // Set up three markers with info windows 

 var point = new GLatLng(42.70010000, -88.97349900);
 var marker = createMarker(point,"<div style='font: 11px/13px Arial, Helvetica, sans-serif;padding:0px;margin:0px;width:225px;height:auto;'>" + trucktrailer + "</div>")
 map.addOverlay(marker);

 var point = new GLatLng(42.74237784, -88.97119160);
 var marker = createMarker(point,"<div style='font: 11px/13px Arial, Helvetica, sans-serif;padding:0px;margin:0px;width:225px;height:auto;'>" + milton + "</div>")
 map.addOverlay(marker);


}


// display a warning if the browser was not compatible
else {
 alert("Sorry, the Google Maps API is not compatible with this browser");
}

// This Javascript is based on code provided by the
// Blackpool Community Church Javascript Team
// http://www.commchurch.freeserve.co.uk/   
// http://www.econym.demon.co.uk/googlemaps/
