var GoogleMap;
var GoogleMapMarker;

//表示用
function GoogleMapSetup(MapName,Ido,Keido,MarkerIdo,MarkerKeido,Scale,Comment){
  if(GBrowserIsCompatible()){
    GoogleMap=new GMap2(document.getElementById(MapName));
	GoogleMap.addControl(new GMapTypeControl());
	GoogleMap.addControl(new GSmallMapControl());
    GoogleMap.setCenter(new GLatLng(Ido,Keido),Scale);	//中心の緯度,経度

	GoogleMapMarker=new GMarker(new GLatLng(MarkerIdo,MarkerKeido));	//マーカーの緯度,経度
    GoogleMapMarker.CommentText=Comment;
	GEvent.addListener(GoogleMapMarker,"mousedown",function(){
		if(GoogleMapMarker){
		    GoogleMapMarker.openInfoWindowHtml(GoogleMapMarker.CommentText);	//コメント
		}
	});

	GoogleMap.addOverlay(GoogleMapMarker);
  }
}

//設定用。Hiddenにカレントの緯度経度を設定するためにコールバックルーチンを必要とする
function GoogleMapSetup2(MapName,Ido,Keido,MarkerIdo,MarkerKeido,Scale,Comment,SetMarkerPoint){
  if(GBrowserIsCompatible()){
    GoogleMap=new GMap2(document.getElementById(MapName));
	GoogleMap.addControl(new GMapTypeControl());
	GoogleMap.addControl(new GSmallMapControl());
    GoogleMap.setCenter(new GLatLng(Ido,Keido),Scale);	//中心の緯度,経度

	GoogleMapMarker=new GMarker(new GLatLng(MarkerIdo,MarkerKeido));	//マーカーの緯度,経度
    GoogleMapMarker.CommentText=Comment;
    GoogleMapMarker.OnSetMarkerPoint=SetMarkerPoint;
	GEvent.addListener(GoogleMapMarker,"mousedown",function(){
		if(GoogleMapMarker){
		    GoogleMapMarker.openInfoWindowHtml(GoogleMapMarker.CommentText);	//コメント
		}
	});

	GEvent.addListener(GoogleMap,"click",function(overlay,point){
		if(GoogleMapMarker){
			if(point){
				GoogleMapMarker.setPoint(point);
				var Pos=GoogleMapMarker.getPoint();
				GoogleMapMarker.OnSetMarkerPoint(String(Pos.lat()),String(Pos.lng()));
			}
		}
	});
	GoogleMap.addOverlay(GoogleMapMarker);
	var Pos=GoogleMapMarker.getPoint();
	SetMarkerPoint(String(Pos.lat()),String(Pos.lng()));
  }
}

//設定用。GoogleMapSetup2で設定したマップに位置を再設定する。
function GoogleMapReset(Ido,Keido,MarkerIdo,MarkerKeido,Scale,Comment){
    GoogleMap.setCenter(new GLatLng(Ido,Keido),Scale);
    GoogleMapMarker.CommentText=Comment;
	GoogleMapMarker.setPoint(new GLatLng(MarkerIdo,MarkerKeido));
	GoogleMapMarker.OnSetMarkerPoint(MarkerIdo,MarkerKeido);
}