// JavaScript Document

var map = "";

function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("top_map"));
		map.setCenter(new GLatLng(36.07748516109143, 140.11884570121765), 13);
		//print_marker();
		//load_data("all");
		var ctl = new GLargeMapControl();
		map.addControl(ctl);
		GEvent.addListener(map, "click", clickAction);
		addLine();
		addInfoWindow();
	}else{
		document.write("Google Mapsは利用できません");
	}
}

function clickAction(){
	if(map.getZoom() < 15){
		map.setCenter(new GLatLng(36.0813611252089, 140.11362075805664), 15);
	}else if(map.getZoom()  < 17){
		map.setCenter(new GLatLng(36.07748516109143, 140.11884570121765), 16);
	}
}

function addLine(){
	var points = [gp(140.12383460998535, 36.076626700242606),
					 gp(140.12057304382324, 36.081074986738784),
					 gp(140.11841654777527, 36.08006048740845),
					 gp(140.1178479194641, 36.078248229534026),
					 gp(140.1153802871704, 36.07713830935151),
					 gp(140.11770844459534, 36.07379111144742),
					 gp(140.1238453388214, 36.07659201475882)];
	map.addOverlay(new GPolygon(points, "#ff0000", 5.0, 0.5, "#00ff00"));
}

function gp(x,y) {
	return new GLatLng(y, x);
}

function addInfoWindow(){
	var latlng = gp(140.1194143295288,36.07726837893325);
	var icon = new GIcon();
	icon.image = "./images/mapimage/takezono2.png";
	var marker = new GMarker(latlng, icon);
	map.addOverlay(marker);
}
