// JavaScript Document
 
   
  
 
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
  var i = 0;
 var gmarkers = [];

		
   function myclick(i) { 
   var marker = gmarkers[i];
	
	
	 if (marker.isHidden()) {
          marker.show();
        } else {
          marker.hide();
        }
      }
	  
	  
	  
	       function onoff() {
	javascript:myclick(0),myclick(1),myclick(2)
      }
	  


    function initialize() {

      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map_canvas"));
		
		map.setCenter(new GLatLng(41.887618, -87.634566), 13);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());

		
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);


  function createMarker1(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }
	  


var point = (new GLatLng(41.879691,-87.623649));  
	var marker = createMarker1(point,'<div style="width:200px"><strong>The Art Institute of Chicago</strong><br><br><img src="	/aic/gfx/map_aic_facade.jpg" width=100 height=71 align="left"> 111 South Michigan Ave., <br>Chicago IL 60603</div>')
	map.addOverlay(marker);
	
	 
marker.openInfoWindowHtml('<div style="width:200px"><strong>The Art Institute of Chicago</strong><br><br><img src="	/aic/gfx/map_aic_facade.jpg" width=100 height=71 align="left"> 111 South Michigan Ave., <br>Chicago IL 60603</div>');




function createMarkercust(point, html, i) {

  markerOptions = { icon:parkIcon }; 
  var marker = new GMarker(point, markerOptions);

  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
  });
  
  gmarkers[i] = marker;
  return marker;
}


  // Create our "tiny" marker icon3
var parkIcon = new GIcon(G_DEFAULT_ICON);
parkIcon.image = "http://www.artic.edu/aic/visitor_info/parkIcon.png";
parkIcon.iconSize = new GSize(32, 32);



var point = (new GLatLng(41.881288193158284,-87.62048363685608));
var marker = createMarkercust(point,'<strong>East Monroe Street and<br> Millennium Park garages</strong><br>Enter at Columbus Drive and Monroe Street.<br>For lot and rate information (312) 616-0600.', 0)
  
	
	
	  map.addOverlay(marker);

  // Create our "tiny" marker icon2



var point = (new GLatLng(41.87762162529229,-87.62431383132935));
var marker = createMarkercust(point,'<strong>Grant Park South Garage</strong><br>Enter at Michigan Avenue between<br>Van Buren and Adams streets.<br>For lot and rate information (312) 616-0600.', 1)
  
	
	
	  map.addOverlay(marker);
	  
	  // Create our "tiny" marker icon



var point = (new GLatLng(41.88271801772579,-87.62429237365723));
var marker = createMarkercust(point,'<strong>Grant Park North Garage</strong><br>Enter at Michigan Avenue between<br>Madison and Randolph streets.<br>For lot and rate information (312) 616-0600.', 2)
  
	
	
	  map.addOverlay(marker);





      }
    }
    function setDirections(fromAddress, toAddress, locale) {
     gdir.load("from: " + fromAddress + " to: " + toAddress,
               { "locale": locale }); 
    } 

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}

	function onGDirectionsLoad(){ 
	
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}
  
