	var x_international = false;
	var x_cmap = false;
	var x_courier = '';
	var x_address = '';
	var map_error = new Array();
	map_error['400'] = 'A directions request could not be successfully parsed.';
	map_error['500'] = 'A directions request could not be successfully processed.';
	map_error['602'] = 'No corresponding geographic location could be found for the specified zip/postal code(s).<br><br>This may be due to the fact that the address is relatively new, or it may be incorrect.';
	map_error['603'] = 'The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.';
	map_error['604'] = 'Google Maps could not compute driving directions between the two points.<br><br>This is usually because there is no route available between the two points, or because Google does not have data for routing in that region.';
	map_error['610'] = 'The given key is either invalid or does not match the domain for which it was given.';
	map_error['620'] = 'The given key has gone over the requests limit in the 24 hour period.';
	function mapload() {
		if (GBrowserIsCompatible()) {
			try {
				var map = new GMap2(document.getElementById("map"));
				var geocoder = new GClientGeocoder();
				if ((!x_international)&(!x_cmap)) {
					document.getElementById("map_dist").innerHTML='';
					map.addMapType(G_PHYSICAL_MAP); 
					map.addControl(new GLargeMapControl());
					map.addControl(new GMapTypeControl());
					directionsPanel = document.getElementById("route");
					directionsPanel.style.top='205px';
					directionsPanel.style.left='18px';
					directionsPanel.innerHTML='';
					directions = new GDirections(map, directionsPanel);
					directions.load(y_postal1 + " to " + y_postal2);
					GEvent.addListener(directions, "load", onDirectionsLoad);
					GEvent.addListener(directions, "error", onDirectionsError);
				} else if (x_cmap) {
					//map.addMapType(G_PHYSICAL_MAP);
					map.setMapType(G_SATELLITE_MAP); 
					map.addControl(new GLargeMapControl());
					map.addControl(new GMapTypeControl());
					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('<b>'+x_courier+'</b><br />'+x_address);
							}
						});
					}
					showAddress(x_address.replace(/<br \/>/g,''));
				} else {
					document.getElementById("map_dist").innerHTML='';
					document.getElementById("map_dist").style.visibility='hidden';
					var bounds = new GLatLngBounds();
					map.setMapType(G_SATELLITE_MAP); 
					map.addControl(new GLargeMapControl());
					map.addControl(new GMapTypeControl());
					map.clearOverlays();
					var info1 = '<div style="font-family: Arial, Helvetica, sans-serif; font-size: 9pt;"><b>Origin:</b><br />' + x_pzfromtown + '<br />USA<br />' + x_flagfrom + '</div>';
					var info2 = '<div style="font-family: Arial, Helvetica, sans-serif; font-size: 9pt;"><b>Destination:</b><br />' + format_state(x_tocountry,'to') + '<br />' + x_flagto + '</div>';
					var baseIcon = new GIcon(G_DEFAULT_ICON);
					baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
					baseIcon.iconSize = new GSize(20, 34);
					baseIcon.shadowSize = new GSize(37, 34);
					baseIcon.iconAnchor = new GPoint(9, 34);
					baseIcon.infoWindowAnchor = new GPoint(9, 2);
					var letteredIcon = new GIcon(baseIcon);
					var pointA;
					var ship_distance;
		  			if (geocoder) {
						geocoder.getLatLng(y_postal1,
						function(point) {
							if (!point) {
								alert(y_postal1 + " not found");
							} else {
								pointA = point;
								letteredIcon.image = "http://www.google.com/mapfiles/marker" + String.fromCharCode("A".charCodeAt(0)) + ".png";
								markerOptions = { icon:letteredIcon };
								var marker = new GMarker(point, markerOptions);
								GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(info1); });
								map.addOverlay(marker);
								bounds.extend(point);
							}
						});
						if (x_tocountry == 'GEORGIA') {
							x_tocountry = 'Country of Georgia';
						}
						geocoder.getLatLng(x_tocountry,
						function(point) {
							if (!point) {
								alert(x_tocountry + " not found");
							} else {
								letteredIcon.image = "http://www.google.com/mapfiles/marker" + String.fromCharCode("B".charCodeAt(0)) + ".png";
								markerOptions = { icon:letteredIcon };
								var marker2 = new GMarker(point, markerOptions);
								GEvent.addListener(marker2, "click", function() { marker2.openInfoWindowHtml(info2); });
								map.addOverlay(marker2);
								bounds.extend(point);
								//map.setZoom(map.getBoundsZoomLevel(bounds));
								map.setCenter(point, 2);
								map.setCenter(bounds.getCenter());
								var polyline = new GPolyline([pointA, point],"#ff0000", 4);
								map.addOverlay(polyline);
								ship_distance = Math.round(pointA.distanceFrom(point) / 1000 / 1.6);
								document.getElementById("map_dist").innerHTML='Approximate distance: ' + ship_distance + ' miles';
							}
						});
					}
				}
			}
			catch (e) { alert(e);
			}
		}
	}
	function onDirectionsLoad() {
		ship_distance = directions.getSummaryHtml();
		ship_distance = ship_distance.replace(/mi \(/g, "miles \(");
		if (x_fromcountry == "US") {
			g_dist = ship_distance.substr(0,ship_distance.search(/mi/)-1);
		} else {
			g_dist = ship_distance.substr(0,ship_distance.search(/km/)-1);
		}
		g_dist = g_dist.replace(/,/g, "");
		g_dist = g_dist.replace(/ /g, "");
		dist_diff = (parseFloat(g_dist) / parseFloat(x_distance) * 100) - 100;
		dist_diff = Math.round(dist_diff*10)/10;
		document.getElementById("map_dist").innerHTML='Approximate driving distance: ' + ship_distance;
		//' <div style="display:inline; font-size:0.8em; color:#999999;">&nbsp;&nbsp;&nbsp;&nbsp;Code: ' + g_dist + ' ' + x_distance + '   ' + dist_diff + '</div>';
		document.getElementById("map_dist").style.visibility='visible';
	}
	function onDirectionsError() {
		document.getElementById("map").innerHTML = '<br><br><b>Map Error:</b><br><br>' + map_error[directions.getStatus().code];
	}
