var map = null;
var geocoder = null;
var marker = null;
//<![CDATA[

//----------------------------------------------------------------
//	住所で地図を表示
//----------------------------------------------------------------
function MapLoad(addr, scale, bal) {
	if (GBrowserIsCompatible()) 
	{
		map = new GMap2(document.getElementById("map"));
		geocoder = new GClientGeocoder();
		GetShopAddr(addr, scale, bal);
	}
}

function GetShopAddr(addr, scale, bal)
{
	try {
		geocoder.getLatLng(addr,
						   function(point) 
						   {
								if (point)
								{
									map.setCenter(point, parseInt(scale));
									map.addControl(new GSmallMapControl());
									
									if(bal == null){
										bal = "";
									}
									if(bal.length > 0){
										marker = new GMarker(point);
										map.addOverlay(marker);
										marker.openInfoWindowHtml(bal);
									}
								}
						   }
		);
	}
	catch(e)
	{
	}
}

//----------------------------------------------------------------
//	緯度経度で地図を指定
//----------------------------------------------------------------
function MapLoadPos(latpos, lngpos, scale, bal) {
	if (GBrowserIsCompatible()) 
	{
		map = new GMap2(document.getElementById("map"));
		geocoder = new GClientGeocoder();
//		GetShopAddr(addr, scale, bal);
		var point = new GLatLng(latpos, lngpos);
		map.setCenter(point, parseInt(scale));
		map.addControl(new GSmallMapControl());
		if(bal == null)	bal = "";
		if(bal.length > 0){
			marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml(bal);
		}
	}
}

function MapUnLoad()  {
	if(geocoder != null)
		GUnload();
}
//]]>

