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

 var gmarkers = [];
 var htmls = [];
 var to_htmls = [];
 var i=0;

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

var baseIcon = new GIcon();
baseIcon.iconSize=new GSize(26, 36);
baseIcon.shadowSize=new GSize(59, 24);
baseIcon.iconAnchor=new GPoint(25,20);
baseIcon.infoWindowAnchor=new GPoint(10,2);
		
var building = new GIcon(baseIcon, "/dsirealestate-com/assets/images/mapicon.png", null, "/dsirealestate-com/assets/images/mapicon-shadow.png");

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

// The inactive version of the direction info
   html = html + '<strong style="color:#333333;">Directions To Us - Starting Address:</strong>' +
	 '<form action="http://maps.google.com/maps" method="get" target="_blank" style="width:250px;height:1px;padding-bottom:0px;margin-bottom:0px;">' +
	 '<input type="text" name="saddr" id="saddr" value="" style="width:240px;" /><br>' +
	 '<INPUT value="Get Directions" TYPE="SUBMIT" class="input-button" style="margin-top:3px;margin-bottom:3px;">' +
	 '<input type="hidden" name="daddr" value="2800 Royal Avenue,Suite 101,Madison, WI 53713"/></form>';

   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 
 	}); 
   gmarkers[i] = marker;
   htmls[i] = html;
   i++;
   return marker;
   }

 // functions that open the directions forms
 function tohere(i) {
   gmarkers[i].openInfoWindowHtml(to_htmls[i]);
 }
// Create our "tiny" marker icon

// 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(43.043444, -89.357154), 15);

 // Set up three markers with info windows 

 var point = new GLatLng(43.043444, -89.357154);
 var marker = createMarker(point,"<p style='margin-bottom:8px;'><strong><span style='font-size:13px;color:#005663;'>DSI Real Estate Group</span></strong><br />2800 Royal Avenue, Suite 101<br />Madison, WI 53713</p><p style='margin-bottom:8px;'>Phone: 608.226.3060<br />Fax: 608.223.0668</p>",building)
 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/

