// Close InfoWindow
function fCloseWindow(){
	map.closeInfoWindow();
	moveFlag=true;
}

// Load Point Data
function get_point_data(lon,lat,zoom,markerType,topLat,rightLng,bottomLat,leftLng,rows){
	var request= GXmlHttp.create();
	// send request by Get Method
	if(markerType!=1){
		request.open("GET","json_spot_list.html?Actniche_Longitude="+lon+"&Actniche_Latitude="+lat+"&Actniche_Radius="+zoom,true);
		
		// Call_Back_Function
		request.onreadystatechange=function(){
			if(request.readyState==4){
				eval("var spots="+request.responseText);
				for (i in spots) {
					if(markerType==1){
						add_point_markerType1(spots[i]);
					}else if(markerType==2){
						add_markerDestinationAdd(spots[i]);
					}else if(markerType==3){
						add_markerDestinationImageReplace(spots[i]);
					}else if(markerType==4){
						add_markerForAdmin(spots[i]);
					}else{
						add_spot_marker(spots[i]);
					}
				}
			}
		}
		request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
		request.send(null);
	} else {
		//request.open("GET","json_spot_list.html?Actniche_Longitude="+lon+"&Actniche_Latitude="+lat+"&Actniche_Radius="+zoom+"&Actniche_Spot_Rows="+rows,false);
		request.open("GET","json_spot_list.html?Actniche_TopLatitude="+topLat+"&Actniche_RightLongitude="+rightLng+"&Actniche_BottomLatitude="+bottomLat+"&Actniche_LeftLongitude="+leftLng+"&Actniche_Spot_Rows="+rows,false);
		request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
		request.send(null);
		eval("var spots="+request.responseText);
		for (i in spots) {
			if(markerType==1){
				add_spot_markerType1(spots[i]);
			}else if(markerType==2){
				add_markerDestinationAdd(spots[i]);
			}else if(markerType==3){
				add_markerDestinationImageReplace(spots[i]);
			}else{
				add_point_marker(spots[i]);
			}
		}
	}
}

// Set Spot Marker
function add_spot_marker(spot_data){
	var point = new GPoint(spot_data.longitude, spot_data.latitude); // Point Object
	
	var marker = new GMarker(point);
	map.addOverlay(marker); // Maker

	//On Click
	var OnClick_Function = function() {
		moveFlag=false;
//		GEvent.clearListeners(map,'infowindowclose');
		mySpotMarkerWindow(point,spot_data);
//		setTimeout(function(){ GEvent.addListener(map, 'infowindowclose',function(overlay, point){moveFlag=true;}) },3000);
	}

	// Marker Click
//	GEvent.addListener(marker, "click", OnClick_Function);
	GEvent.addListener(marker, "click", OnClick_Function);
}

// Load Route Detail Data
function get_route_detail_data(routeID){
	//create GXmlHttpObject
	var request= GXmlHttp.create();
	
	// send request by Get Method
	request.open("GET","route_detail_data.html?Actniche_RouteID="+routeID,false);
	
	// Call_Back_Function
	request.onreadystatechange=function(){
		if(request.readyState==4){
			eval("var points="+request.responseText);
			rootDetailObj=points.RootDetail;
			for(var j=0; j < rootDetailObj.length; j++){
				//Point List
				recvData=add_route_marker(rootDetailObj[j],j);
				routeData.push(recvData);
			}
		}
	}
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
}

// Open route marker (Event)
function add_route_marker(point_data,counter){
	var point=  new GPoint(point_data.Longitude, point_data.Latitude); // Point Object
	var marker = new GMarker(point);
	map.addOverlay(marker); // Maker

	//On Click
	var OnClick_Function = function() {
		moveFlag=false;
		map.centerAtLatLng(point);
		var html = "<div align='center'>"+ point_data.LocationName + "</div>";
		if(point_data.Photos.length !=0){
			for(var i=0; i < point_data.Photos.length; i++){
				photoObj=point_data.Photos[i];
				html += "<a href='#' onclick='fLargeImage(this,point)'><img src='" + photoObj.Photo_url +"&PHOTOALBUM_MODE=2&PHOTOALBUM_SIZE_W=100&PHOTOALBUM_SIZE_H=100' border='0' /><input type='hidden' name='tmp_longitude' value='"+ point_data.Longitude +"' /><input type='hidden' name='tmp_Latitude' value='"+ point_data.Latitude +"' /></a><br />";
			}
		}
		map.openInfoWindowHtml(point,html);
	}
	// Marker Click
	GEvent.addListener(marker, "click", OnClick_Function);
	
	if(naviHtml){
		descriptRoute(point_data,counter,OnClick_Function);
	}
	return point;
}

// RouteAdd
function mySpotMarkerWindow(point,spot_data,myForm){
	tmp=spot_data;
	var photo_html ='';
	var loop;
	for (i in spot_data.photos) {
		if(spot_data.photos[i].photo_id){
			if(i==0)	{ photo_html ="<table>"; }
			if(i%3==0)	{ photo_html+="<tr>"; }
			photo_html+='<td><table width="155" height="90" border="0"><tr><td align="left" width="35"><input type="radio" name="Actniche_PhotoID" value="'+spot_data.photos[i].photo_id+'" /><br /><span style="font-size:0.7em">選択</span><td align="center"><a href="#" onclick="enlargeImage(this)"><img src="'+spot_data.photos[i].photo_url+'&PHOTOALBUM_MODE=2&PHOTOALBUM_SIZE_W=100&PHOTOALBUM_SIZE_H=100" border="0" /><input type="hidden" name="tmp_longitude" value="'+ spot_data.longitude +'" /><input type="hidden" name="tmp_Latitude" value="'+ spot_data.latitude +'" /><input type="hidden" name="Actniche_PointID2" value="'+ spot_data.spot_id +'" /><input type="hidden" name="Actniche_PhotoID2" value="'+ spot_data.photos[i].photo_id +'" /></a></td></tr></table></td>';
			if(i%3==2)	{ photo_html+="</tr>"; }
		}
		loop=i;
	}
	
	//写真があれば文字列追加
	if(photo_html.length >0){
		if(loop%3==2){
			photo_html+="</table>";
		} else {
			photo_html+="</tr></table>";
		}
		photo_html+="  この写真を経路として追加しますか?<br />";
	}
	
	var html=	 '<div id="title_1" align="center" style="color:#000000">';
		if(spot_data.area_name || spot_data.url){
			html+="<a href='#' onclick='window.open(\"spotcomment_view.html?Actniche_SpotID="+spot_data.spot_id+"\",\"\",\"width=340,height=225,resizable=yes,scrollbars=yes\")'>"+spot_data.spot_name+"</a><br />";
		} else {
			html+=spot_data.spot_name + '<br />';
		}
	
		html+='<form>'
				+'<input type="hidden" name="Actniche_SpotID" value="'+spot_data.spot_id+'" />'
				+'<input type="hidden" name="Actniche_Longitude" value="'+spot_data.longitude+'" />'
				+'<input type="hidden" name="Actniche_Latitude" value="'+spot_data.latitude+'" />'
				+'<input type="hidden" name="Actniche_Spot_Name" value="'+spot_data.spot_name+'" />'
				+ photo_html
				+'  <button type="button" name="addRootForm" style="font-size:8px" onclick="SP_Add_RouteDetail(null,null,this.form); fCloseWindow()">経路に追加する</button>&nbsp;<button type="button" name="closeButton" style="font-size:8px" onclick="fCloseWindow()">閉じる</button>';
				+'&nbsp;&nbsp;<span style="font-size:0.8em"><a href="#" onclick="modifyWin=window.open(\'\',\'new_point\',\'width=540,height=360,resizable=yes,scrollbars=yes\'); modifyWin.location=\'spot_modify_form.html?func=get_point_data&Actniche_SpotID='+spot_data.spot_id+'\'">編集</a></span>';
			html+='<br /><span style="font-size:0.8em">この地点の作成者: <a href="mypage.html?Login_UID='+ spot_data.userID +'" target="_blank">' + spot_data.userName + '</a></span>';
			html+='</form></div>';
	
	if(myForm){
		var infoSpot= new GPoint(myForm.tmp_Longitude.value, myForm.tmp_Latitude.value); 
		map.openInfoWindowHtml(infoSpot,html);
	} else {
		map.openInfoWindowHtml(point,html);
	}
	return point;
}

// Set Point Marker
function add_spot_markerType1(spot_data){
	var spot = new GPoint(spot_data.longitude, spot_data.latitude); // Point Object
	var marker = new GMarker(spot,globalSpotIcon);
	markerArray.push(marker);
	map.addOverlay(marker); // Maker

	//On Click
	var OnClick_Function = function() {
		moveFlag=false;
//		GEvent.clearListeners(map,'infowindowclose');
		mySpotMarkerView(spot,spot_data);
//		setTimeout(function(){ GEvent.addListener(map, 'infowindowclose',function(overlay, point){moveFlag=true;}) },3000);
		//comment list
//		var commentParamObj={};
//		commentParamObj.tableName	="Spot";
//		commentParamObj.spotID		=spot_data.spot_id;
//		commentParamObj.siteName	=spot_data.spot_name;
//		commentList(commentParamObj);
		
		//comment setting
//		var bbsTableNameNode	=document.getElementById("bbsTableName");
//		var bbsSubjectNode		=document.getElementById("bbsSubject");
//		var bbsParentIDNode		=document.getElementById("bbsParentID");
//		
//		bbsTableNameNode.value	="Spot";
//		bbsSubjectNode.value	="";
//		bbsParentIDNode.value	=spot_data.spot_id;
		
		//right menu spotdetail and comment
//		viewSpotDetail(spot_data.spot_id);
//		commentView(spot_data.spot_id,0);
	}
	
	var OnMouseOver_Function = function(){
		MapSearchSearchKeyWord_Show(marker,spot_data);
	}
	
	var OnMouseOut_Function = function(){
		MapSearchSearchKeyWord_Close(marker);
	}
	
	// Marker Mouse click
	GEvent.addListener(marker, "click", OnClick_Function);
	
	// Marker Mouse Over
	GEvent.addListener(marker, "mouseover", OnMouseOver_Function);
	
	// Marker Mouse Out
	GEvent.addListener(marker, "mouseout", OnMouseOut_Function);
}

// Marker Destination Add Type 2
function add_markerDestinationAdd(point_data){
	var point = new GPoint(point_data.longitude, point_data.latitude); // Point Object
	var marker = new GMarker(point);
	map.addOverlay(marker); // Maker

	//On Click
	var OnClick_Function = function() {
		moveFlag=false;
		openWindowOfDestinationAdd(point,point_data);
	}
	// Event Listener
	GEvent.addListener(marker, "click", OnClick_Function);
}

// Marker Destination Add Type 3
function add_markerDestinationImageReplace(point_data){
	var point = new GPoint(point_data.longitude, point_data.latitude); // Point Object
	var marker = new GMarker(point);
	map.addOverlay(marker); // Maker

	//On Click
	var OnClick_Function = function() {
		map.centerAtLatLng(point);
		var photo_html ='';
		var loop;
		for (i in point_data.photos) {
			if(point_data.photos[i].photo_id){
				if(i==0)	{ photo_html ="<table>"; }
				if(i%3==0)	{ photo_html+="<tr>"; }
				photo_html+='<td><table width="155" height="90" border="0"><tr><td align="left" width="35"><input type="radio" name="Actniche_PhotoID" value="'+point_data.photos[i].photo_id+'" /><br /><span style="font-size:0.7em">選択</span></td><td align="center"><a href="#" onclick="enlargeImage(this)"><img src="'+point_data.photos[i].photo_url+'&PHOTOALBUM_MODE=2&PHOTOALBUM_SIZE_W=100&PHOTOALBUM_SIZE_H=100" border="0" /><input type="hidden" name="tmp_longitude" value="'+ point_data.longitude +'" /><input type="hidden" name="tmp_Latitude" value="'+ point_data.latitude +'" /><input type="hidden" name="Actniche_PointID" value="'+ point_data.point_id +'" /><input type="hidden" name="Actniche_PhotoID2" value="'+ point_data.photos[i].photo_id +'" /></a></td></tr></table></td>';
				if(i%3==2)	{ photo_html+="</tr>"; }
			}
			loop=i;
		}
		
		if(photo_html.length >0){
			if(loop%3==2){
				photo_html+="</table>";
			} else {
				photo_html+="</tr></table>";
			}
		} else {
			photo_html ='';
		}
		
		var html 						 ='<div id="title_1" style="text-align:center; color:#000000">'+point_data.point_name+'<br />';
		if(photo_html.length >0){html	+='差替える画像を選択してください。</div>';}
		html							+='<form style="text-align:center">';
		html							+=photo_html;
		if(photo_html.length >0){html	+='<button type="button" name="destinationAdd" style="font-size:8px" onclick="fModifyDestinationImage(this.form)">登録</button>&nbsp;<button type="button" name="closeButton" style="font-size:8px" onclick="fCloseWindow()">閉じる</button>';}
		html							+='</form>';
		
		map.openInfoWindowHtml(point,html);
	}

	// Event Listener
	GEvent.addListener(marker, "click", OnClick_Function);
}

function mySpotMarkerView(spot,spot_data,myForm,retFunc){
	if(retFunc==1){
		var func='moveToSpotByClick'
	} else {
		var func='dragAndZoomView1';
	}
	tmp=spot_data;
	var photo_html ='';
	moveFlag=false;
	var loop;
	
	
		var html="";
	if( spot_data.mapSearch_target==1 ){
		html+=spot_data.spot_name +"<br>"
		html+="("+spot_data.area_name+")";
	} else if( spot_data.mapSearch_target==2) {
		html+=spot_data.spot_name;
	} else {
		html+=spot_data.area_name;
	}
	
	var html ='<div id="title_1" align="center" style="width: 280px;">'; 
			if( spot_data.mapSearch_target==1 ){
				html+=spot_data.spot_name +"<br>"
				html+="("+spot_data.area_name+")";
			} else if( spot_data.mapSearch_target==2) {
				html+=spot_data.spot_name;
			} else {
				html+=spot_data.area_name;
			}
			html+='<form action="picturemailsend_form.html" onsubmit="window.open(\'\',\'new_spot\',\'width=640,height=360,resizable=yes,scrollbars=yes\')" target="new_spot" method="post">'
				+'<input type="hidden" name="Actniche_SpotID" value="'+spot_data.spot_id+'" />'
				+'<input type="hidden" name="Actniche_Longitude" value="'+spot_data.longitude+'" />'
				+'<input type="hidden" name="Actniche_Latitude" value="'+spot_data.latitude+'" />'
				+'<input type="hidden" name="Actniche_Spot_Name" value="'+spot_data.spot_name+'" />'
		html+='</form>';
		html+='<br>';
		html+='<form action="mapsearch_othersite.html" target="_blank" method="Post" name="mapsearchToOtherSiteFrm">';
		html+='<input type="hidden" name="mapsearch_keyWord" value="'+ spot_data.spot_name +'">';
		html+='<input type="hidden" name="mapsearch_keyDistrict" value="'+ spot_data.area_name +'">';
		html+='<input type="hidden" name="mapsearch_Target" value="'+ spot_data.mapSearch_target +'">';
		html+='<input type="hidden" name="mapsearch_site" value="google">';
		html+='<div style="text-align:center">';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'google\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="google"><img src="img/i_90s.gif" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'googleImage\'; document.mapsearchToOtherSiteFrm.submit(); return false" style="text-decoration:none" title="google images"><img src="img/i_90s.gif" border="0" width="16px" height="16px"><span style="font-size:0.7em; vertical-align:top">(images)</span></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'flicker\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="flickr"><img src="img/flickr.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'jalan\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="jalan"><img src="img/jalan.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'gnavi\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="ぐるなぴ" ><img src="img/gnavi.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'yahoo\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="yahoo"><img src="img/yahoo.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'yahooMap\'; document.mapsearchToOtherSiteFrm.submit(); return false" style="text-decoration:none" title="Yahoo地図"><img src="img/yahoo.ico" border="0" width="16px" height="16px"><span style="font-size:0.7em; vertical-align:top">(地図)</span></a><br>';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'googleMaps\'; document.mapsearchToOtherSiteFrm.submit(); return false" style="text-decoration:none" title="Google Maps"><img src="img/i_90s.gif" border="0" width="16px" height="16px"><span style="font-size:0.7em; vertical-align:top">(maps)</span></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'wikipedia\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="wikipedia"><img src="img/wiki.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'nifty\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="@nifty地図"><img src="img/nifty.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'youtube\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="youtube"><img src="img/youtube.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'mapFan\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="マップファン"><img src="img/mapfan.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'livedoor\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="livedoor地図"><img src="img/livedoor.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='<a href="mapsearch_othersite.html" onclick="document.mapsearchToOtherSiteFrm.mapsearch_site.value=\'navitime\'; document.mapsearchToOtherSiteFrm.submit(); return false" title="navitime"><img src="img/navitime.ico" border="0" width="16px" height="16px"></a>&nbsp;';
		html+='</div>';
		html+='</form>';
		html+='<br>';
		html+='<form>';
		html+='<a href="#" onclick="YahooLocalSearch_SpotModify_Open(' + spot_data.spot_id + ',' + spot_data.latitude+ ','+ spot_data.longitude+'); return false">再検索</a>&nbsp;&nbsp;<a href="#" onclick="YahooLocalSearch_SpotDelete_Open(' + spot_data.spot_id + ',' + spot_data.latitude+ ','+ spot_data.longitude+',\'' + spot_data.spot_name + '\');">検索削除</a>&nbsp;&nbsp;';
		html+='</form>';
		
		html+='</div>';
	
	if(myForm){
		//var infoSpot= new GPoint(myForm.tmp_Longitude.value, myForm.tmp_Latitude.value); 
		var infoSpot= new GLatLng(myForm.tmp_Latitude.value,myForm.tmp_Longitude.value); 
		map.openInfoWindowHtml(infoSpot,html);
	} else {
		//map.openInfoWindowHtml(spot,html);
		var tempLatLng= new GLatLng(spot.y,spot.x);
		map.openInfoWindowHtml(tempLatLng,html);
	}
	
}

function trigger_get_point_data(){
	point=map.getCenterLatLng();
	var spanLatLng=map.getSpanLatLng();
	var zoomLevel=map.getZoomLevel();
	if(zoomLevel < 2){
		get_point_data(point.x,point.y,parseFloat(spanLatLng.width));
	}
}

function enlargeImage(theNode){
	var imageURL 	=theNode.getElementsByTagName("img")[0].src;
	imageURLStart=imageURL.indexOf("photo_view.html");
	imageURLEnd=imageURL.indexOf("PHOTOALBUM_MODE");
	var adjustURL=imageURL.substring(imageURLStart,imageURLEnd-1);
	var longitude 	=theNode.getElementsByTagName("input")[0].value;
	var latitude	=theNode.getElementsByTagName("input")[1].value;
	var pointID		=theNode.getElementsByTagName("input")[2].value;
	var photoID		=theNode.getElementsByTagName("input")[3].value;
	
	enlargeDisplay=window.open("","enlargeDisplay","width=640,height=360,resizable=yes,scrollbars=yes");
	var ua=navigator.userAgent;
	if(ua.indexOf("MSIE")>-1){
		enlargeDisplay.document.open();
		enlargeDisplay.document.write("<img src='"+ adjustURL +"'>");
		enlargeDisplay.document.close();
		var loadFlag=true;
		while(loadFlag){
			if(enlargeDisplay.document.images[0].readyState=="complete"){
				var imageWidth=	enlargeDisplay.document.images[0].width;
				var imageHeight	=enlargeDisplay.document.images[0].height;
				enlargeDisplay.resizeTo(imageWidth+35,imageHeight+65);
				loadFlag=false;
			}
		}
	} else {
		enlargeDisplay.fenlargeImage=function(theNode){
			var imageWidth	=theNode.width;
			var imageHeight	=theNode.height;
			/* FireBug */ if(window.console){console.debug("imageWidth : "+imageWidth);}
			/* FireBug */ if(window.console){console.debug("imageHeight : "+imageHeight);}
			enlargeDisplay.resizeTo(imageWidth+35,imageHeight+65);
		}
		enlargeDisplay.document.open();
		enlargeDisplay.document.write("<img src='"+ adjustURL +"' onload='fenlargeImage(this)'>");
		enlargeDisplay.document.close();
	}
}

function Area_enlargeImage(thePhotoID){
	//エリア写真拡大表示
	
	var url ="area_enlaregeimage_view.html";
		url+="?ActnicheCommunity_AreaPhotoID="+thePhotoID;
	
	var enlargeDisplay=window.open(url,"enlargeDisplay","width=640,height=360,resizable=yes,scrollbars=yes");

}
function moveToSpotByClick(theSpotID,theANode,retFunc){
	if(theANode){
		//メニューバックグラウンドハイライト
		Hightlight_Down();
		
		//メニュー選択部ハイライト
		var trNode=theANode.parentNode.parentNode.parentNode;
		var tdNodes=trNode.getElementsByTagName('td');
		for(var i=0,n=tdNodes.length; i<n; i++){
			tdNodes[i].style.backgroundColor="#ffffcc";
		}
	}
	
	var request= GXmlHttp.create();
	var url="json_spot_view.html?Actniche_SpotID=" + theSpotID;
	request.open("GET",url,true);
	request.onreadystatechange=function(){
		if(request.readyState==4){
			eval("var spotObj="+request.responseText);
			if(spotObj.NODATA){
				document.getElementById("popup").style.visibility="visible";
				window.setTimeout('popup_close()',2500);
				return;
			}
			var point =new GPoint(spotObj.longitude, spotObj.latitude);
			moveFlag=true;
			var zoomLevel=map.getZoomLevel();
			map.centerAndZoom(point,zoomLevel);
			
			//commentList
//			var commentParamObj={};
//			commentParamObj.tableName	="Spot";
//			commentParamObj.spotID		=spotObj.spot_id;
//			commentParamObj.siteName	=spotObj.spot_name;
//			commentList(commentParamObj);

			//comment setting
//			var bbsTableNameNode	=document.getElementById("bbsTableName");
//			var bbsSubjectNode		=document.getElementById("bbsSubject");
//			var bbsParentIDNode		=document.getElementById("bbsParentID");
//			
//			bbsTableNameNode.value	="Spot";
//			bbsSubjectNode.value	="";
//			bbsParentIDNode.value	=spotObj.spot_id;
			
			moveFlag=false;
			if(retFunc==1){
				mySpotMarkerView(point,spotObj,null,1);
			} else {
				mySpotMarkerView(point,spotObj);
			}
		}
	}
	request.send(null);
}

function commentView(theSpotID,thePage){
	//thePage
	if(thePage){
		var page=thePage
	} else {
		var page=0;
	}
	
	var request= GXmlHttp.create();
	var url="inner_comment_view.html?listFlag=True&BBS_Message_ID="+encodeURIComponent(theSpotID) +"&BBS_Page="+encodeURIComponent(page);
	request.open("GET",url,true);
	request.onreadystatechange=function(){
		if(request.readyState==4){
			var rightMenuHeader=document.getElementById("rightMenuHeader");
	//		rightMenuHeader.innerHTML="";
			
			var rightMenuBody=document.getElementById("rightMenuBody");
			rightMenuBody.innerHTML=request.responseText;
		}
	}
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
}
function commentAddByXH(theForm){
	var postdata ="From_Page="		+encodeURIComponent(theForm.From_Page.value);
		postdata+="&BBS_TableName="	+encodeURIComponent(theForm.BBS_TableName.value);
		postdata+="&BBS_Subject="	+encodeURIComponent(theForm.BBS_Subject.value);
		postdata+="&BBS_Message_ID="+encodeURIComponent(theForm.BBS_Message_ID.value);
		postdata+="&BBS_Body="		+encodeURIComponent(theForm.BBS_Body.value);
		postdata+="&commentAddSubmit="+encodeURIComponent(theForm.commentAddSubmit.value);
	
		var request= GXmlHttp.create();
		request.open("POST","inner_comment_add.html",true);
		request.setRequestHeader("content-type","application/x-www-form-urlencoded");
		
		request.onreadystatechange=function(){
			if(request.readyState==4){
				var rightMenuBody=document.getElementById("rightMenuBody");
				rightMenuBody.innerHTML=request.responseText;
			}
		}
		request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
		request.send(postdata);
}
function moveToRouteAddForm(){
	if(window.map){
		var latlng=map.getCenter();
		var	zoomlevel=map.getZoomLevel();
		document.MoveRouteAddForm.lon.value=latlng.lng();
		document.MoveRouteAddForm.lat.value=latlng.lat();
		document.MoveRouteAddForm.zoom.value=zoomlevel;
		document.MoveRouteAddForm.submit();
//		window.open('route_add_form.html?lon='+latlng.lng()+'&lat='+latlng.lat()+'&zoom='+zoomlevel);
//		location.replace('route_add_form.html?lon='+latlng.lng()+'&lat='+latlng.lat()+'&zoom='+zoomlevel);
//		window.location='route_add_form.html?lon='+latlng.lng()+'&lat='+latlng.lat()+'&zoom='+zoomlevel;
	} else {
//		window.location='route_add_form.html';
	}
}

function SpotBlogTagOutput(theSpotID){
	var zoomLevel=map.getZoomLevel();
	var url ="blog_parts_output_site.html?";
		url+="zoom="+zoomLevel;
		url+="&spotID="+theSpotID;
		popWin=window.open(url,"popWin","width=450,height=800,resizable=yes");
}

function mapZoomByZkeyDown(){
	document.onkeydown=function(e){
		var shift, ctrl; 

		// Mozilla(Firefox, NN) and Opera 
		if (e != null) { 
			keycode = e.which; 
			ctrl = typeof e.modifiers == 'undefined' ? e.ctrlKey : e.modifiers & Event.CONTROL_MASK; 
			shift = typeof e.modifiers == 'undefined' ? e.shiftKey : e.modifiers & Event.SHIFT_MASK; 
			// イベントの上位伝播を防止 
		//	e.preventDefault(); 
			e.stopPropagation(); 
		// Internet Explorer 
		} else { 
			keycode = event.keyCode; 
			ctrl = event.ctrlKey; 
			shift = event.shiftKey; 
			// イベントの上位伝播を防止 
		//	event.returnValue = false; 
			event.cancelBubble = true; 
		}
		// キーコードの文字を取得 
		keychar = String.fromCharCode(keycode).toUpperCase(); 
		if(keycode==18){
			isZoom=true;
		}
	}
	
	document.onkeyup=function(e){
		isZoom=false;
	}
}
function routeAddByXH(theForm){
	var postdata=encodeURIComponent("Actniche_Route_Name")			+"="	+encodeURIComponent(theForm.Actniche_Route_Name.value);
	for(var i=0; i<theForm.elements['Actniche_TagNameArea1[]'].length; i++){
		if(theForm.elements['Actniche_TagNameArea1[]'][i].selected){
			postdata+= "&" + encodeURIComponent("Actniche_TagNameArea1[]") + "=" + encodeURIComponent(theForm.elements['Actniche_TagNameArea1[]'][i].value);
		}
	}
	postdata+="&"+encodeURIComponent("Actniche_TagNameArea2")		+"="	+encodeURIComponent(theForm.Actniche_TagNameArea2.value);
	for(var i=0, n=theForm.elements["Actniche_Latitude[]"].length; i<n; i++){
		postdata+="&"+encodeURIComponent("Actniche_SpotID[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_SpotID[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Latitude[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_Latitude[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Longitude[]")	+"="	+encodeURIComponent(theForm.elements["Actniche_Longitude[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Explanation[]")	+"="	+encodeURIComponent(theForm.elements["Actniche_Explanation[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_PhotoID[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_PhotoID[]"][i].value);
	}
	postdata+="&"+encodeURIComponent("routeDetailAddForm")		+"="	+encodeURIComponent(theForm.routeDetailAddForm.value);
	var request= GXmlHttp.create();
	request.open("POST","inner_route_add.html",true);
	request.setRequestHeader("content-type","application/x-www-form-urlencoded");
		
	request.onreadystatechange=function(){
		if(request.readyState==4){
			var topHeader=document.getElementById("topHeader");
			topHeader.innerHTML=request.responseText;
		}
	}
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(postdata);
}

function routeModifyByXH(theForm){
	var postdata =    encodeURIComponent("Actniche_RouteID")			+"="	+encodeURIComponent(theForm.Actniche_RouteID.value);
		postdata+="&"+encodeURIComponent("Actniche_Route_Name")			+"="	+encodeURIComponent(theForm.Actniche_Route_Name.value);
		postdata+="&"+encodeURIComponent("Actniche_Route_Visible")		+"="	+encodeURIComponent(theForm.Actniche_Route_Visible.value);
		postdata+="&"+encodeURIComponent("Actniche_RouteDetail_Visible")+"="	+encodeURIComponent(theForm.Actniche_RouteDetail_Visible.value);
		for(var i=0; i<theForm.elements['Actniche_TagNameArea1[]'].length; i++){
			if(theForm.elements['Actniche_TagNameArea1[]'][i].selected){
				postdata+= "&" + encodeURIComponent("Actniche_TagNameArea1[]") + "=" + encodeURIComponent(theForm.elements['Actniche_TagNameArea1[]'][i].value);
			}
		}
		postdata+="&"+encodeURIComponent("Actniche_TagNameArea2")		+"="	+encodeURIComponent(theForm.Actniche_TagNameArea2.value);

	for(var i=0, n=theForm.elements["Actniche_Latitude[]"].length; i<n; i++){
		postdata+="&"+encodeURIComponent("Actniche_SpotID[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_SpotID[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Latitude[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_Latitude[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Longitude[]")	+"="	+encodeURIComponent(theForm.elements["Actniche_Longitude[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_Explanation[]")	+"="	+encodeURIComponent(theForm.elements["Actniche_Explanation[]"][i].value);
		postdata+="&"+encodeURIComponent("Actniche_PhotoID[]")		+"="	+encodeURIComponent(theForm.elements["Actniche_PhotoID[]"][i].value);
	}

	postdata+="&"+encodeURIComponent("routeDetailModifyForm")		+"="	+encodeURIComponent(theForm.routeDetailModifyForm.value);

	var request= GXmlHttp.create();
	request.open("POST","inner_route_modify.html",true);
	request.setRequestHeader("content-type","application/x-www-form-urlencoded");
		
	request.onreadystatechange=function(){
		if(request.readyState==4){
			var topHeader=document.getElementById("topHeader");
			topHeader.innerHTML=request.responseText;
		}
	}
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(postdata);
}

function MapSearchSearchKeyWord_Show(marker,spot_data){
	
	var html="";
	if( spot_data.mapSearch_target==1 ){
		html+=spot_data.spot_name +"<br>"
		html+="("+spot_data.area_name+")";
	} else if( spot_data.mapSearch_target==2) {
		html+=spot_data.spot_name;
	} else {
		html+=spot_data.area_name;
	}
	marker.openInfoWindowHtml(html);
}

function MapSearchSearchKeyWord_Close(marker){
	marker.closeInfoWindow();
}

