// JavaScript Document

function googleMap(element_id, lat, lng, zoom, shop) {
	//google.load("maps", "2", {"language": "ja", "callback" : function() {
		if (!google.maps.BrowserIsCompatible()) {
			window.alert('Browser is not compatible for Google Maps');
			return;
		}
		var map_element = $("#" + element_id)[0];
		if (!map_element) {
			window.alert('Specified element[' + element_id + '] was not found.');
			return;
		}
		var map = new google.maps.Map2(map_element, {size:new GSize(670,420)});
		map.setCenter(new google.maps.LatLng(lat, lng), zoom);
		map.addControl(new GLargeMapControl3D());
		map.addControl(new GMapTypeControl());
		map.setMapType(G_NORMAL_MAP);

		// Shop Type Icon
		var icon = new GIcon();
		icon.image = "http://www.genki-do.jp/wp-content/themes/genkido/images/ico_map_icon.png";
		icon.shadow = "http://www.genki-do.jp/wp-content/themes/genkido/images/ico_map_shadow.png";
		icon.iconSize = new GSize(36, 36);
		icon.shadowSize = new GSize(42, 36);
		icon.iconAnchor = new GPoint(7, 35);
		icon.infoWindowAnchor = new GPoint(18, 11);
		
		// 
		var point = new GPoint(lng, lat);
		var marker = new GMarker(point, icon);
		map.addOverlay(marker);
		
		var offset = new GSize(0, -20);
		var textnode = '<div>' + shop + '</div>';
		marker.openInfoWindowHtml(textnode);
		GEvent.addListener(map, "click", function(marker){
			marker.openInfoWindowHtml(textnode);
		});
		
		$(window).unload = google.maps.Unload;
	//}});
}

