Event.observe(window, 'load', MapLoadForStoreList, false);
Event.observe(window, 'unload', GUnload, false);
var map = "";
function MapLoadForStoreList() {
	if (GBrowserIsCompatible()) {
    	map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(36.517813,137.421997), 5);
		map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());

        var kmlURL = 'http://tower.jp/feeds/towerrecords_maps/kml/';
        var kml = new GGeoXml(kmlURL);
        map.addOverlay(kml);
        
/*
		var baseIcon = new GIcon();
		baseIcon.image = "$link.getContextPath()/images/map_icon.png";
        baseIcon.iconAnchor = new GPoint(17, 34);
        baseIcon.infoWindowAnchor = new GPoint(17, 0);
        baseIcon.infoShadowAnchor = new GPoint(20, 17);
		
		function createMarker(x, y, title, text){
		  var myIcon = new GIcon(baseIcon);
		  
		  markerOptions = {icon:myIcon};
		  var marker = new GMarker(new GLatLng(y, x), markerOptions);
		  
		  GEvent.addListener(marker, "click", function(){

		    marker.openInfoWindowHtml('<div style="font-weight: bold; font-size: medium; margin-bottom: 0em;">'+
		                               title +
		                              '</div><div id="iw_kml">' +
		                              text +
		                              '',{maxWidth:300});
		  });
		  return marker;
		}
		#foreach($area in $areas)
		#foreach($store in $area.stores)
		var str_title = "$store.nameJpn";
		var str_text  = '<ul><li>$store.shopHour</li><li>$store.holiday</li><li>$store.sanitizedAccess</li><li>$store.tel</li><li>$store.zip</li><li>$store.sanitizedAddress</li><li><a href="$link.getContextPath()/store/$store.slug">more</a></li></ul>';
		map.addOverlay(createMarker($store.lng, $store.lat, str_title, str_text));
		#end
		#end
*/
    }
}