// JScript source code

			var map;
		    var gdir;
		    var geocoder = null;
		    var addressMarker;
		    var geo;
		    
		    function initialize() {
		        if (GBrowserIsCompatible()) {
		            map = new GMap2(document.getElementById("map_canvas")); // get map from Google
		            map.addControl(new GMenuMapTypeControl()); // map type dropdown menu control
		            map.addControl(new GLargeMapControl()); // map zoom control
		            map.addControl(new GOverviewMapControl()); // map overview control
		            map.setCenter(new GLatLng(34.6766550120525, -76.9614908836287), 13);  // center map on this cooridnate
		           // map.setMapType(G_HYBRID_MAP);
		            //start place marker on Google Map
		            var marker = new GMarker(new GLatLng(34.6766550120525, -76.9614908836287)); // place marker at this coordinate
		            map.addOverlay(marker);
		            marker.openInfoWindowHtml("<div id='mapInfowindow'><table style='border:solid 1px #8CE37C; background:#ffffff; color:#0A4387;'><tr><td style='background:#8CE37C;'><b>Emerald Isle Surf Shop</b><br>3102 Emerald Drive<br>Emerald Isle, NC 28594<br>ph: 252-354-8422</td><td><img src='images/ei_shop_xxsml.png'></td></tr></table></div>");
		            GEvent.addListener(marker, "click", function() {
		            marker.openInfoWindowHtml("<div id='mapInfowindow'><table style='border:solid 1px #8CE37C; background:#ffffff; color:#0A4387;'><tr><td style='background:#8CE37C;'><b>Emerald Isle Surf Shop</b><br>3102 Emerald Drive<br>Emerald Isle, NC 28594<br>ph: 252-354-8422</td><td><img src='images/ei_shop_xxsml.png'></td></tr></table></div>");
		            });
		            return marker;
		            // end place marker on Google Map
		        }
		    }

		    function EISurfShopGmap() {
		        map = new GMap2(document.getElementById("map_canvas"));
				map.addControl(new GMenuMapTypeControl());
		        map.addControl(new GLargeMapControl());
		        document.getElementById("directions").innerHTML = "";
		        gdir = new GDirections(map, document.getElementById("directions"));
		        GEvent.addListener(gdir, "load", onGDirectionsLoad);
		        GEvent.addListener(gdir, "error", handleErrors);
		        setDirections("34.6766550120525, -76.9614908836287", "34.6766550120525, -76.9614908836287", "en_US");
		    }

		    function setDirections(fromAddress, toAddress, locale) {
		        gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
		    }

		    function handleErrors() {
		        if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		            document.getElementById("directions").innerHTML = "<strong><img src='style/exclamation.png'><font color='#F2D303'>Could not find address.  Please check spelling - or it may not be a new address.</font></strong>";
		        
		        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_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() {
		        
		    }