﻿function initialize() {
	if (GBrowserIsCompatible()) {
		function createLengthMarker(point) {
			var marker = new GMarker(point);
			var value = polyline.getLength();
			value = value / 1000;
			var message = "つくほ治療院";
			GEvent.addListener(marker,"click", function() {
			var myHtml = message;
			map.openInfoWindowHtml(point, myHtml);
			});
			return marker;
		}

		// define the crosshair tile layer and its required functions
		var crossLayer = new GTileLayer(new GCopyrightCollection(""), 0, 15);
		crossLayer.getTileUrl =  function(tile, zoom) {
			return "./include/tile_crosshairs.png";
			}
		crossLayer.isPng = function() {return true;}

		// Create a new map type incorporating the tile layer
		var layerTerCross = [ G_PHYSICAL_MAP.getTileLayers()[0],crossLayer ];
		var mtTerCross = new GMapType(layerTerCross,G_PHYSICAL_MAP.getProjection(), "Ter+");

		var map = new GMap2(document.getElementById("map_canvas"),{ size: new GSize(760,500) } );
		map.addMapType(G_PHYSICAL_MAP);
		map.addMapType(mtTerCross);
		map.setCenter(new GLatLng(36.137349, 140.081555), 15);
		var polyOptions = {geodesic:true};
		var polyline = new GPolyline([new GLatLng(40.65642, -73.7883),new GLatLng(61.1699849, -149.944496)], "#ff0000", 10, 1, polyOptions);
	//        map.addOverlay(polyline);
		map.addOverlay(createLengthMarker(new GLatLng(36.137349, 140.081555)));

		map.addControl(new GLargeMapControl());

		var mapControl = new GHierarchicalMapTypeControl();
	        
		// Set up map type menu relationships
		mapControl.clearRelationships();
		mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
		mapControl.addRelationship(G_PHYSICAL_MAP, mtTerCross, "Crosshairs");
	  
		// Add control after you've specified the relationships
		map.addControl(mapControl);
	}
}

