
    var map;
    var directionsPanel;
    var directions;
    function initialize() {
        map = new GMap2(document.getElementById("map_canvas"));
        directionsPanel = document.getElementById("route");
        directions = new GDirections(map, directionsPanel);
        GEvent.addListener(directions, "error", handleErrors);

        var mapTypeControl = new GMapTypeControl();
        var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
        var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
        map.addControl(mapTypeControl, topRight);
        GEvent.addListener(map, "dblclick", function() {
          map.removeControl(mapTypeControl);
          map.addControl(new GMapTypeControl(), bottomRight);
        });
        map.addControl(new GSmallMapControl());
        showAddress("Cheers in the Heights, 2010 N. Van Buren St., Little Rock, AR 72207")
        //map.setCenter(new GLatLng(34.864101, -92.565594), 11);
        //var point = new GLatLng(34.864101, -92.565594);
        //map.addOverlay(createMarker(point, 0))
    }

    var geocoder = new GClientGeocoder();

    function showAddress(address) {
    
        geocoder.getLatLng(
    address,
    function(point) {
        if (!point) {
            alert(address + " not found");
        } else {
            map.setCenter(point, 13);
            var marker = new GMarker(point);
            map.addOverlay(marker);
            marker.openInfoWindowHtml("<span style='font-size: 14px; color: #000;'><strong>Cheers in the Heights</strong><br>2010 N. Van Buren St.<br>Little Rock, AR 72207<br>Phone: 501-663-5937</span>");
        }
    }
  );
    }

    function createMarker(point, index) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("<span style='font-size: 14px; color: #000;'><strong>Cheers in the Heights</strong><br>2010 N. Van Buren St.<br>Little Rock, AR 72207</span>");
            });
        return marker;  
    }  
          
    function getDirections() {
        var dirFrom = document.getElementById("DirFrom").value;
        //document.getElementById("route").innerHTML = "";
        directions.load("from: " + dirFrom + " to: 2010 N. Van Buren St., Little Rock, AR 72207");
    }
          
    function handleErrors(){
	   if (directions.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: " + directions.getStatus().code);
	   else if (directions.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: " + directions.getStatus().code);
	   else if (directions.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: " + directions.getStatus().code);
	   else if (directions.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: " + directions.getStatus().code);
	   else if (directions.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + directions.getStatus().code);
	   else alert("An unknown error occurred.");
	   
	   document.getElementById("DirFrom").innerHTML = 'Enter address above to view directions';
    }
    
    //*****************************
    //**** Handle 'ENTER' Key *****
    //*****************************
	document.onkeypress = handleEvent;
	if (document.layers) document.captureEvents(Event.KEYPRESS);	function handleEvent(e) {
		var code;
	    if (!e) var e = window.event;
	    if (e.keyCode) code = e.keyCode;
	    else if (e.which) code = e.which;

		if(code == 13)
		{
		    var ele = e.target || e.srcElement;
		    if (ele == document.getElementById("DirFrom")) {
                getDirections();
	    	    return (false);
		    }
			//if (document.getElementById("enterKey").value != 'false') return(false);
		}
	}
    //*****************************
    //*****************************