var map = null;
var geocoder = null;
var directionsPanel;
var directions;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GLargeMapControl());
        map.setCenter(new GLatLng(41.957632,-88.081735), 13);
        var point = new GLatLng(41.957632,-88.081735);
        map.addOverlay(new GMarker(point));
        geocoder = new GClientGeocoder();
      }
    }

    function getDir(address) {
      if (GBrowserIsCompatible()) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found.");
            } else {
              map = new GMap2(document.getElementById("map_canvas"));
              map.addControl(new GLargeMapControl());
              map.setCenter(point, 16);
              var marker = new GMarker(point);
              document.getElementById('route').innerHTML="<div align=\"center\"><form><input type=\"button\" value=\"Printable Version\" onclick=\"window.location.href=\'http://maps.google.com/maps?f=d&hl=en&geocode=&time=&date=&ttype=&saddr=" + prepAdd(address) + "&daddr=104+W+Lake+Street,+Bloomingdale,+IL&sll=37.020098,-95.712891&sspn=32.638991,59.238281&ie=UTF8&z=14&om=1&pw=2\'\"></form></div>";
              document.getElementById('route').style.visibility="visible";
              directionsPanel = document.getElementById("route");
              directions = new GDirections(map, directionsPanel);
              directions.load(address+" to 104 West Lake Street, Bloomingdale, IL");
            }
          }
        );
      }
    }
    }

function prepAdd(address) {
temp = "" + address;
while (temp.indexOf(" ")>-1) {
  temp = temp.replace(/ /,"+");
}
return(temp);
}
