var map = null;
var geo = null;
var mOption = null;
var defaultZoom = null;



$(function (){
	load();
});



function showMap(cat_id2, map_id) {
	var url;
	if (cat_id2 == 'shop'){
		url = '/map/_getMap.php?is_shop=1';
	} else {
		url = '/map/_getMap.php?cat_id2='+cat_id2;
	}
	if (geo) {
		map.clearOverlays();
		map_setCenter();
		$.ajaxSetup();
	    jQuery.ajax({
			type :     "GET",
			dataType : "json",
			url :      url,
			cache :    false,
			contentType : 'application/x-www-form-urlencoded; charset=UTF-8',
			success : 
				function(myjson){
					$.each(
						myjson,
						function(j, f){
							var marker = new GMarker(new GLatLng(f.lat, f.lng));
						    GEvent.addListener(marker, 'click', function() {
								this.openInfoWindowHtml(f.message_e, mOption);
							});
							map.addOverlay(marker);
							// open
							if (map_id == f.id){
								marker.openInfoWindowHtml(f.message_e, mOption);
							}
						}
					);
				},
			error :
				function (xml, status, e){
					alert(xml);
					alert(status);
					alert(e);
				}
		});
	}
}

