function getGeocode(theAddress){
	var geocorder = new GClientGeocoder();
	geocorder.getLatLng(theAddress, getGeoResult);
	
	function getGeoResult(latlng){
		var topHeader=document.getElementById("topHeader");
		if(latlng){
			//make query
			var postdata =encodeURIComponent("Longitude")		+"="	+encodeURIComponent(latlng.lng());
				postdata+="&"+encodeURIComponent("Latitude")	+"="	+encodeURIComponent(latlng.lat());
				postdata+="&"+encodeURIComponent("theAddress")	+"="	+encodeURIComponent(theAddress);
			
			//infowindow open
			addressmap_view(latlng.lng(),latlng.lat());
		} else {
			//make query
			var postdata =encodeURIComponent("theAddress")		+"="	+encodeURIComponent(theAddress);
			
		}
		innerHTML_Update_Post('topHeader','inner_search_address.html',postdata);
	}
}

function spotSearch(theSearchWord,thePage){
	var	queryString='';
	if(theSearchWord){
		queryString+=encodeURIComponent("Actniche_All_Search")	+"="	+encodeURIComponent(theSearchWord);
	}	
	if(thePage){
		queryString+="&"+encodeURIComponent("Actniche_Spot_Page")	+"="	+encodeURIComponent(thePage);
	}
		
	//ファイル取得
	innerHTML_getWithMultiQuery('topHeader','inner_spot_search.html',queryString);
}

function search_List(){
	//検索
	
	map.closeInfoWindow();
	
	//tabControl
	tabControl=3;
	
	//tagID 
	tagid_push(0);
	
	var allSearch = document.getElementById('AllSearch');
	if(allSearch.value.length){
		if(document.actnicheSearchForm.SearchItem[0].checked){
			//住所
			
			//checkbox
//			document.getElementById('polygonHomeBase').style.display="inline";
			document.DataShowControlForm.DataShow[0].style.display="inline";
			document.DataShowControlForm.DataShow[0].checked=true;
	
//			document.getElementById('polygonCommunity').style.display="inline";
			document.DataShowControlForm.DataShow[1].style.display="inline";
			document.DataShowControlForm.DataShow[1].checked=true;
			
			getGeocode(allSearch.value);
			
			//cummunity create button
			button_make('Community_Create','dummy');
			
		} else if(document.actnicheSearchForm.SearchItem[1].checked){
			//ホームベース
			
			//checkBox
//			document.getElementById('polygonHomeBase').style.display="inline";
			document.DataShowControlForm.DataShow[0].style.display="inline";
			document.DataShowControlForm.DataShow[0].checked=true;
	
//			document.getElementById('polygonCommunity').style.display="inline";
			document.DataShowControlForm.DataShow[1].style.display="inline";
			document.DataShowControlForm.DataShow[1].checked=false;
			
			homebase_list(allSearch.value,'homebase');
			
			//first item select
			var leftmenuBody=document.getElementById('leftmenuBody');
			if(leftmenuBody){
				var tds=leftmenuBody.getElementsByTagName('td')
				if(tds.length>0){
					var spans=tds[1].getElementsByTagName('span');
					if(spans.length){
						spans[0].onclick();
						map.zoomTo(5);
					}
				}
			}
			
		} else if(document.actnicheSearchForm.SearchItem[2].checked){
			//コミュニティ
			
			//checkBox
//			document.getElementById('polygonHomeBase').style.display="inline";
			document.DataShowControlForm.DataShow[0].style.display="inline";
			document.DataShowControlForm.DataShow[0].checked=false;
	
//			document.getElementById('polygonCommunity').style.display="inline";
			document.DataShowControlForm.DataShow[1].style.display="inline";
			document.DataShowControlForm.DataShow[1].checked=true;
			
			community_Search(allSearch.value);
			
			//first item select
			var leftmenuBody=document.getElementById('leftmenuBody');
			if(leftmenuBody){
				var tds=leftmenuBody.getElementsByTagName('td')
				if(tds.length>0){
					var spans=tds[1].getElementsByTagName('span');
					if(spans.length){
						spans[0].onclick();
						map.zoomTo(5);
					}
				}
			}
			
		} else if(document.actnicheSearchForm.SearchItem[3].checked){
			//プロフィール
			
			//checkBox
//			document.getElementById('polygonHomeBase').style.display="inline";
			document.DataShowControlForm.DataShow[0].style.display="inline";
			document.DataShowControlForm.DataShow[0].checked=true;
	
//			document.getElementById('polygonCommunity').style.display="inline";
			document.DataShowControlForm.DataShow[1].style.display="inline";
			document.DataShowControlForm.DataShow[1].checked=false;
			
			document.DataShowControlForm.DataShow[2].checked=true;
			
			homebase_list(allSearch.value,'profile');
			
			//first item select
			var leftmenuBody=document.getElementById('leftmenuBody');
			if(leftmenuBody){
				var tds=leftmenuBody.getElementsByTagName('td')
				if(tds.length>0){
					var spans=tds[1].getElementsByTagName('span');
					if(spans.length){
						spans[0].onclick();
						map.zoomTo(5);
					}
				}
			}
			
		} else if(document.actnicheSearchForm.SearchItem[4].checked){
			//スポット
			document.DataShowControlForm.DataShow[3].checked=true;
			
			spotSearch(allSearch.value);
			
			//first item select
			var leftmenuBody=document.getElementById('leftmenuBody');
			if(leftmenuBody){
				var tds=leftmenuBody.getElementsByTagName('td')
				if(tds.length>0){
					var spans=tds[1].getElementsByTagName('span');
					if(spans.length){
						spans[0].onclick();
						map.zoomTo(5);
					}
				}
			}
		}
	} else {
		//検索ワードがないとき
		innerHTML_get('topHeader','inner_no_searchword.html');
	}
	
	//右メニュー
	var rightMenu=document.getElementById('rightMenu');
	rightMenu.innerHTML="";

}

function addressmap_view(theLongitude,theLatitude){
	var zlevel=map.getZoomLevel();
	zlevel=(zlevel > 9) ? 9 : zlevel;
	var geopoint=new GPoint(theLongitude,theLatitude);
	map.centerAndZoom(geopoint, zlevel);
	OpenWindowOfSpotMake(geopoint,"dragAndZoomView_one");
}

function Login_User(theForm){
	//ユーザーログイン
	
	//make query
	var postdata =encodeURIComponent("Login_EMAIL")		+"="	+encodeURIComponent(theForm.Login_EMAIL.value);
		postdata+="&"+encodeURIComponent("Login_PASSWORD")	+"="	+encodeURIComponent(theForm.Login_PASSWORD.value);
		postdata+="&"+encodeURIComponent("Login_Check")		+"="	+encodeURIComponent('dummy');
		if(theForm.autoLogin.checked){
			postdata+="&"+encodeURIComponent("autoLogin")+"="	+encodeURIComponent('auto');
		}
	
	var jsonData=json_postWithQueryString('json_login.html',postdata);
	
	var errorMessage='';
	
	if(jsonData.EmailError){
		errorMessage=jsonData.EmailError;
	} else if(jsonData.PasswordError){
		errorMessage=jsonData.PasswordError;
	} else if(jsonData.AuthError){
		errorMessage=jsonData.AuthError;
	} else if(jsonData.AuthErrorAdmin){
		errorMessage=jsonData.AuthErrorAdmin;
	} else if(jsonData.AuthSuccess){
		//success
		
	} else {
		errorMessage='ログインに失敗しました。';
	}
	
	var message;
	message=(errorMessage.length>0) ? errorMessage : 'ログインしました。';
	
	var loginMessageNode=document.getElementById('loginMessage');
	loginMessageNode.innerHTML=message;
	loginMessageNode.style.display="block";
	
	if( !(errorMessage.length>0) ){
		//loginmenu
		var loginHeadermenu=document.getElementById("loginHeadermenu");
		var html='&nbsp;';
		loginHeadermenu.innerHTML=html;
		
		// headermenu
		var undefHeadermenu=document.getElementById("undefHeadermenu");
		var html= jsonData.UserName+' さん&nbsp;&nbsp;'
				 +'<a href="index.html" onclick="UserRegist_Move()">トップページ</a>&nbsp;&nbsp;'
				 +'<a href="map_oneline.html" onclick="UserRegist_Move()">マップ</a>&nbsp;&nbsp;'
				 +'<a href="#" onclick="Logout_User()">ログアウト</a>&nbsp;&nbsp;';
		undefHeadermenu.innerHTML=html;
		
		//homebase button
//		if(tabControl==0){
		var buttonArea=document.getElementById('buttonArea');
		if(buttonArea){
			button_make('HomeBase_Create','dummy');
		}
//		} else if(tabControl==1 || tabControl==2){
//			button_make('Community_Create','dummy');
//		}
		
		//マイページ表示
		var thePathName=window.location.pathname;
		var regexp=/map_oneline/;
		if(regexp.test(thePathName)){
			// no process
		} else {
			innerHTML_get('communityInfo','inner_mypage_bottom.html');
		}
	}
	

	
	Login_KeepConnection();
	setTimeout(loginMessageClose,2500);
	

}

function Logout_User(){
	var jsonData=json_get('json_logout.html');
	
	var errorMessage='';
	
	if(jsonData.Error){
		errorMessage=jsonData.Error;
	}
	var message;
	message=(errorMessage.length >0) ? errorMessage : 'ログアウトしました。';
	
	var loginMessageNode=document.getElementById('loginMessage');
	loginMessageNode.innerHTML=message;
	loginMessageNode.style.display="block";
	
	if( !(errorMessage.length>0) ){
		// window.location.replace('index.html');
		var loginInputFormhtml='<form name="Login_Form" style="display:inline"  onsubmit="Login_User(this); return false">'
									+'<input type="hidden" name="Login_Check" value="dummy">'
									+'<table style="text-align:right; font-size:0.8em">'
										+'<tbody>'
											+'<tr>'
												+'<td style="width:*">e-mail</td>'
												+'<td style="width:175px; text-align:left">'
													+'<input type="text" name="Login_EMAIL" size="24">'
												+'</td>'
											+'</tr>'
											+'<tr>'
												+'<td style="width:*">Password</td>'
												+'<td style="width:175px; text-align:left">'
													+'<input type="password" name="Login_PASSWORD" size="12">'
													+'<input type="submit" name="Login_Check" value="ログイン">'
												+'</td>'
											+'</tr>'
											+'<tr>'
												+'<td colspan="2" style="text-align:left">'
													+'<input type="checkbox" name="autoLogin" value="auto" onclick="AutoLogin_Confirm(this)">次回から自動的にログインする'
												+'</td>'
											+'</tr>'
										+'</tbody>'
									+'</table>'
								+'</form>';
		var loginHeadermenu=document.getElementById("loginHeadermenu");
		loginHeadermenu.innerHTML=loginInputFormhtml;
		
		var undefMessage='ようこそゲスト さん&nbsp;&nbsp;'
						+'<a href="index.html" onclick="UserRegist_Move()">トップページ</a>&nbsp;&nbsp;'
						+'<a href="reminder.html" onclick="UserRegist_Move(); window.open(\'reminder.html\',\'\',\'width=640,height=480,resizable=yes,scrollbars=yes\'); return false">パスワードを忘れた方</a>&nbsp;&nbsp;'
						+'<a href="regist_mail.html" onclick="UserRegist_Move(); window.open(\'regist_mail.html\',\'\',\'width=640,height=480,resizable=yes,scrollbars=yes\'); return false">会員登録</a>';
		var undefHeadermenu=document.getElementById("undefHeadermenu");
		undefHeadermenu.innerHTML=undefMessage;
	}
	
	//button erase
	//button_make('HomeBase_Create','dummy');
	
	window.onbeforeunload=null;
	window.location.replace('index.html?logout=true');
	
	setTimeout(loginMessageClose,2500);

}

function Login_KeepConnection(){
	//keep connection
	
	innerHTML_getAndReturn('session_keep_connection.html');
	setTimeout(Login_KeepConnection,60000*15);
}


function loginMessageClose(){
	var loginMessageNode=document.getElementById('loginMessage');
	loginMessageNode.style.display="none";
}

function UserRegist_Move(){
	window.onbeforeunload=null;
}

function AutoLogin_Confirm(theCheckBox){
	if(theCheckBox.checked){
		theCheckBox.checked=false;
	} else {
		return;
	}
	var response=confirm('e-mailとPasswordが貴方のコンピュータに保存されますがよろしいですか？');
	if(response){
		theCheckBox.checked=true;
	} else {
		theCheckBox.checked=false;
	}
}

function viewMyPage(loginID){
	//tabControl
	tabControl=2;
	
	map.closeInfoWindow();
	
	//checkbox
//	document.getElementById('polygonHomeBase').style.display="inline";
	document.DataShowControlForm.DataShow[0].style.display="inline";
	document.DataShowControlForm.DataShow[0].checked=globalCheckBox.mypage[0];
	
//	document.getElementById('polygonCommunity').style.display="inline";
	document.DataShowControlForm.DataShow[1].style.display="inline";
	document.DataShowControlForm.DataShow[1].checked=globalCheckBox.mypage[1];
	
	document.DataShowControlForm.DataShow[2].checked=globalCheckBox.mypage[2];
	document.DataShowControlForm.DataShow[3].checked=globalCheckBox.mypage[3];
	
	//セッションチェック
	if(!(loginID)){
		var sessData=json_get('json_session_view.html');
		if( !(sessData.ASSIGN_2) ){
			innerHTML_get('topHeader','inner_nologin_view.html');
			return
		}
	}
	
	//友達履歴初期化(スタック)
	globalFriendStack=new Array();
	
	//中央下部
	var node="communityInfo";
	if(loginID && !(isNaN(loginID)) ){
		innerHTML_get(node,'inner_mypage_bottom.html','Login_UID',loginID);
	} else {
		innerHTML_get(node,'inner_mypage_bottom.html');
	}
	
	//左メニュ
	var node="topHeader";
	if(loginID && !(isNaN(loginID)) ){
		innerHTML_get(node,'inner_mypage_left_list.html','Login_UID',loginID);
	} else {
		innerHTML_get(node,'inner_mypage_left_list.html');
	}
	
	//右メニュー(友達リスト)
	var node="rightMenu";
	if(loginID && !(isNaN(loginID)) ){
		innerHTML_get(node,'inner_friend_list.html','Actniche_AddressBook_UserID',loginID);
	} else {
		innerHTML_get(node,'inner_friend_list.html');
	}
	
	//タグリスト
	document.getElementById('taglist').innerHTML="";
	tagid_push(0);
	
	//マップ
	moveView(1);
	
	//cummunity create button
	button_make('Community_Create','dummy');
	
	//マップ(本拠地)
//		if(loginID && !(isNaN(loginID)) ){
//			var jsonData=json_get('json_user_view.html','Login_UID',loginID);
//		} else {
//			var jsonData=json_get('json_user_view.html');
//		}
//		if(jsonData.INFO5){
//			var html=innerHTML_getAndReturn('inner_area_view.html','ActnicheCommunity_AreaID',jsonData.INFO5);
//			var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',jsonData.INFO5);
//			var mylatlng=new GLatLng(areaData.CenterLatitude,areaData.CenterLongitude);
//			map.openInfoWindowHtml(mylatlng,html);
//		}

}

function Profile_Friend_View(loginID,theCommunityID,theStack){
	//中央下部
	var node="communityInfo";
	if( loginID && !(isNaN(loginID)) && !(isNaN(theCommunityID)) ){
		//make query
		var postdata =encodeURIComponent('Login_UID')				+"="	+encodeURIComponent(loginID);
			postdata+="&"+encodeURIComponent('ReturnCommunityID')	+"="	+encodeURIComponent(theCommunityID);
		innerHTML_Update_Post(node,'inner_mypage_bottom.html',postdata);
	} else if(theStack && theStack=='keep'){
		//check stack exist
		var thePrevUserID=(globalFriendStack.length >0) ? globalFriendStack[globalFriendStack.length-1] : null;
		
		//make query
		var postdata =encodeURIComponent('Login_UID')			+"="	+encodeURIComponent(loginID);
		if(thePrevUserID){
			postdata+="&"+encodeURIComponent('thePrevUserID')	+"="	+encodeURIComponent('dummy');
		}
		innerHTML_Update_Post(node,'inner_mypage_bottom.html',postdata);
		
		
	} else if(loginID && !(isNaN(loginID)) ){
		innerHTML_get(node,'inner_mypage_bottom.html','Login_UID',loginID);
	} else {
		innerHTML_get(node,'inner_mypage_bottom.html');
	}
	
	//右メニュー(友達リスト)
	var node="rightMenu";
	if(loginID && !(isNaN(loginID)) ){
		innerHTML_get(node,'inner_friend_list.html','Actniche_AddressBook_UserID',loginID);
	} else {
		innerHTML_get(node,'inner_friend_list.html');
	}
	
	//友達履歴初期化(スタック)
	if(theStack && theStack=='keep'){
		// no process
	} else {
		globalFriendStack=new Array();
	}
}

function Profile_Friend_Stack_Next(thePrevUserID,theNextUserID){
	//マイページ下部友人リスト
	globalFriendStack.push(thePrevUserID);
	
	//make query
	var postdata =encodeURIComponent('Login_UID')			+"="	+encodeURIComponent(theNextUserID);
		postdata+="&"+encodeURIComponent('thePrevUserID')	+"="	+encodeURIComponent(thePrevUserID);

	//マイページ下部
	var node="communityInfo";
	innerHTML_Update_Post(node,'inner_mypage_bottom.html',postdata);
	
	//右メニュー(友達リスト)
	var node="rightMenu";
	if(theNextUserID && !(isNaN(theNextUserID)) ){
		innerHTML_get(node,'inner_friend_list.html','Actniche_AddressBook_UserID',theNextUserID);
	} else {
		innerHTML_get(node,'inner_friend_list.html');
	}
	
}

function Profile_Friend_Stack_Prev(){
	//マイページ下部友人リスト
	var theNextUserID=globalFriendStack.pop();
	var thePrevUserID=(globalFriendStack.length >0) ? globalFriendStack[globalFriendStack.length-1] : null;
	
	//make query
	var postdata =encodeURIComponent('Login_UID')			+"="	+encodeURIComponent(theNextUserID);
		if(thePrevUserID){
			postdata+="&"+encodeURIComponent('thePrevUserID')	+"="	+encodeURIComponent(thePrevUserID);
		}

	//マイページ下部
	var node="communityInfo";
	innerHTML_Update_Post(node,'inner_mypage_bottom.html',postdata);
	
	//右メニュー(友達リスト)
	var node="rightMenu";
	if(theNextUserID && !(isNaN(theNextUserID)) ){
		innerHTML_get(node,'inner_friend_list.html','Actniche_AddressBook_UserID',theNextUserID);
	} else {
		innerHTML_get(node,'inner_friend_list.html');
	}
}

function Profile_Friend_Stack_Peak(){
	//スタックを閲覧
	if(globalFriendStack.length){
		var theUserID=globalFriendStack[globalFriendStack.length-1];
		var jsonData=json_get('json_user_view.html','Login_UID',theUserID);
	}
}


function friend_add(theToUserID,theAreaID,theLongitude,theLatitude){
	//自分のアドレスリストに追加
	map.closeInfoWindow();
	
	//make query
	var postdata =encodeURIComponent('Actniche_AddressBook_ToUserID')		+"="	+encodeURIComponent(theToUserID);
	
	//post
//		innerHTML_Update_Post('communityInfo','inner_friend_add_submit.html',postdata);
	var html=innerHTML_PostAndReturn('inner_friend_add_submit.html',postdata);
	
	var mylatlng=new GLatLng(theLatitude,theLongitude);
	polygon_effect_override(null,theAreaID);
	
	map.openInfoWindowHtml(mylatlng,html);
}

function friend_delete(theAddressID,theFriendID){
	//友達削除
	
	//make query
	var postdata =encodeURIComponent("Actniche_AddressBook_AddressID")		+"="	+encodeURIComponent(theAddressID);
		postdata+="&"+encodeURIComponent("Actniche_AddressBook_FriendID")	+"="	+encodeURIComponent(theFriendID);
		postdata+="&"+encodeURIComponent("Actniche_AddressBook_Available")	+"="	+encodeURIComponent("FALSE");
	
	//post
	innerHTML_Update_Post('approvedFriendList','inner_friend_delete_action.html',postdata);
}

function profile_modify_form_show(){
	//プロフィール編集
	
	//file get
	innerHTML_get('communityInfo','inner_profile_modify_form.html');
	
	//select box Login_BIRTH_YEAR
	var jsonData=json_get('json_user_view.html');
	selectBoxSelect(document.UserModifyForm,'Login_BIRTH_YEAR',jsonData.BIRTH_YEAR);
	selectBoxSelect(document.UserModifyForm,'Login_BIRTH_MONTH',jsonData.BIRTH_MONTH);
	selectBoxSelect(document.UserModifyForm,'Login_BIRTH_DAY',jsonData.BIRTH_DAY);
	selectBoxSelect(document.UserModifyForm,'Login_ZIP',jsonData.ZIP);
	selectBoxSelect(document.UserModifyForm,'Login_ADDRESS',jsonData.ADDRESS);
	selectBoxSelect(document.UserModifyForm,'Login_BLOODTYPE',jsonData.BLOODTYPE);
	selectBoxSelect(document.UserModifyForm,'Login_INFO3',jsonData.INFO3);
}

function profile_modify_submit(theForm){
	//プロフィール編集 サブミット
	//input value check
	
	//section
	if(theForm.Login_SECTION[0].checked){
		var sectionValue=theForm.Login_SECTION[0].value;
	} else {
		var sectionValue=theForm.Login_SECTION[1].value;
	}
	
	//Login_Actniche_BIRTHDAYPublic
	if(theForm.Login_Actniche_BIRTHDAYPublic[0].checked){
		var birthdayPublic=theForm.Login_Actniche_BIRTHDAYPublic[0].value;
	} else {
		var birthdayPublic=theForm.Login_Actniche_BIRTHDAYPublic[1].value;
	}
	
	//Login_Actniche_ZIPPublic
	var zipPublic=theForm.Login_Actniche_ZIPPublic[0].checked ? theForm.Login_Actniche_ZIPPublic[0].value : theForm.Login_Actniche_ZIPPublic[1].value;
	
	//Login_Actniche_ADDRESSPublic
	var addressPublic=theForm.Login_Actniche_ADDRESSPublic[0].checked ? theForm.Login_Actniche_ADDRESSPublic[0].value : theForm.Login_Actniche_ADDRESSPublic[1].value;
	
	//Login_Actniche_HobbyPublic
	var hobbyPublic=theForm.Login_Actniche_HobbyPublic[0].checked ? theForm.Login_Actniche_HobbyPublic[0].value : theForm.Login_Actniche_HobbyPublic[1].value;
	
	//Login_Actniche_ConstellationPublic
	var constellationPublic=theForm.Login_Actniche_ConstellationPublic[0].checked ? theForm.Login_Actniche_ConstellationPublic[0].value : theForm.Login_Actniche_ConstellationPublic[1].value;
	
	//Login_Actniche_BLOODTYPEPublic
	var bloodtypePublic=theForm.Login_Actniche_BLOODTYPEPublic[0].checked ? theForm.Login_Actniche_BLOODTYPEPublic[0].value : theForm.Login_Actniche_BLOODTYPEPublic[1].value;
	
	//Login_Actniche_COMPANYPublic
	var companyPublic=theForm.Login_Actniche_COMPANYPublic[0].checked ? theForm.Login_Actniche_COMPANYPublic[0].value : theForm.Login_Actniche_COMPANYPublic[1].value;
	
	//Login_Actniche_SelfIntrodutionPublic
	//var selfIntrodutionPublic=theForm.Login_Actniche_SelfIntrodutionPublic[0].checked ? theForm.Login_Actniche_SelfIntrodutionPublic[0].value : theForm.Login_Actniche_SelfIntrodutionPublic[1].value;
	
	//Login_Actniche_GenderPublic
	var genderPublic=theForm.Login_Actniche_GenderPublic[0].checked ? theForm.Login_Actniche_GenderPublic[0].value : theForm.Login_Actniche_GenderPublic[1].value;
	
	//make query
	var postdata =encodeURIComponent("Login_NAME")				+"="	+encodeURIComponent(theForm.Login_NAME.value);
//			postdata+="&"+encodeURIComponent("Login_INFO1")			+"="	+encodeURIComponent(theForm.Login_INFO1.value);
		postdata+="&"+encodeURIComponent("Login_BIRTH_YEAR")	+"="	+encodeURIComponent(theForm.Login_BIRTH_YEAR.options[theForm.Login_BIRTH_YEAR.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_BIRTH_MONTH")	+"="	+encodeURIComponent(theForm.Login_BIRTH_MONTH.options[theForm.Login_BIRTH_MONTH.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_BIRTH_DAY")		+"="	+encodeURIComponent(theForm.Login_BIRTH_DAY.options[theForm.Login_BIRTH_DAY.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_SECTION")		+"="	+encodeURIComponent(sectionValue);
		postdata+="&"+encodeURIComponent("Login_ZIP")			+"="	+encodeURIComponent(theForm.Login_ZIP.options[theForm.Login_ZIP.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_ADDRESS")		+"="	+encodeURIComponent(theForm.Login_ADDRESS.options[theForm.Login_ADDRESS.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_INFO2")			+"="	+encodeURIComponent(theForm.Login_INFO2.value);
		postdata+="&"+encodeURIComponent("Login_INFO3")			+"="	+encodeURIComponent(theForm.Login_INFO3.options[theForm.Login_INFO3.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_BLOODTYPE")		+"="	+encodeURIComponent(theForm.Login_BLOODTYPE.options[theForm.Login_BLOODTYPE.selectedIndex].value);
		postdata+="&"+encodeURIComponent("Login_COMPANY")		+"="	+encodeURIComponent(theForm.Login_COMPANY.value);
		postdata+="&"+encodeURIComponent("Login_INFO4")			+"="	+encodeURIComponent(theForm.Login_INFO4.value);
		postdata+="&"+encodeURIComponent("Login_PASS1")			+"="	+encodeURIComponent(theForm.Login_PASS1.value);
		postdata+="&"+encodeURIComponent("Login_PASS2")			+"="	+encodeURIComponent(theForm.Login_PASS2.value);
		postdata+="&"+encodeURIComponent("Login_PASS2")			+"="	+encodeURIComponent(theForm.Login_PASS2.value);
		postdata+="&"+encodeURIComponent("Login_Actniche_BIRTHDAYPublic")	+"="	+encodeURIComponent(birthdayPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_ZIPPublic")		+"="	+encodeURIComponent(zipPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_ADDRESSPublic")	+"="	+encodeURIComponent(addressPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_HobbyPublic")		+"="	+encodeURIComponent(hobbyPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_ConstellationPublic")	+"="	+encodeURIComponent(constellationPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_BLOODTYPEPublic")	+"="	+encodeURIComponent(bloodtypePublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_COMPANYPublic")	+"="	+encodeURIComponent(companyPublic);
//			postdata+="&"+encodeURIComponent("Login_Actniche_SelfIntrodutionPublic")	+"="	+encodeURIComponent(selfIntrodutionPublic);
		postdata+="&"+encodeURIComponent("Login_Actniche_GenderPublic")		+"="	+encodeURIComponent(genderPublic);
		postdata+="&"+encodeURIComponent("profilemodify_form")	+"="	+encodeURIComponent(theForm.profilemodify_form.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);
		
	//check
	var jsonData=json_postWithQueryString('json_profile_modify_check.html',postdata);
	
	//error check
	var errorMessage='';
	errorMessage+=jsonData.Message_01 ? jsonData.Message_01 + '<br>' :'';
	errorMessage+=jsonData.Message_02 ? jsonData.Message_02 + '<br>' :'';
	errorMessage+=jsonData.Message_03 ? jsonData.Message_03 + '<br>' :'';
	errorMessage+=jsonData.Message_04 ? jsonData.Message_04 + '<br>' :'';
	errorMessage+=jsonData.Message_05 ? jsonData.Message_05 + '<br>' :'';
	errorMessage+=jsonData.Message_06 ? jsonData.Message_06 + '<br>' :'';
	errorMessage+=jsonData.Message_07 ? jsonData.Message_07 + '<br>' :'';
	errorMessage+=jsonData.Message_08 ? jsonData.Message_08 + '<br>' :'';
	errorMessage+=jsonData.Message_09 ? jsonData.Message_09 + '<br>' :'';
	errorMessage+=jsonData.Message_10 ? jsonData.Message_10 + '<br>' :'';
	errorMessage+=jsonData.Message_11 ? jsonData.Message_11 + '<br>' :'';
	errorMessage+=jsonData.Message_12 ? jsonData.Message_12 + '<br>' :'';
	errorMessage+=jsonData.Message_13 ? jsonData.Message_13 + '<br>' :'';
	
	if(errorMessage.length >0){
		var profileModifyMessage=document.getElementById('profileModifyMessage');
		profileModifyMessage.style.display='block';
		profileModifyMessage.innerHTML=errorMessage;
		setTimeout(profile_modify_submit_Close,2500);
	} else {
		//result display
		innerHTML_Update_Post('communityInfo','inner_profile_modify_form.html',postdata);
	}
}
function  profile_modify_submit_Close(){
	parts_close('profileModifyMessage');
}

function selectBoxSelect(theForm,selectNode,targetValue){
	for( i = 0 ; i < theForm.elements[selectNode].length ; i ++ ){
		if( theForm.elements[selectNode][i].value == targetValue ){
			theForm.elements[selectNode].selectedIndex = i ;
			break;
		}
	}
}

function addEventListener_ForTop(){
	GEvent.addListener(map, 'moveend',function(){
			/* FireBug */ if(window.console){console.debug("moveEnd_T1420");}
			if(moveFlag==true){
				moveView(1);
			}
			if(theLeftMenuChangeFlag==true){
				leftmenu_change();
				Highlight_Leftmenu_Continue();
			}
//			theLeftMenuChangeFlag=true;
		}
	);
	
	
	GEvent.addListener(map, 'dragend',function(){
			moveFlag=true;
			//moveView(1);
			//leftmenu_change();
			/* FireBug */ if(window.console){console.debug("dragend_T1420");}
			
			//Highlight_Leftmenu_Continue();
		}
	);
	
	GEvent.addListener(map, 'zoomend',function(){
			moveFlag=true;
			//moveView(1);
			//leftmenu_change();
			/* FireBug */ if(window.console){console.debug("zoomend_T1420");}
			
			//Highlight_Leftmenu_Continue();
		}
	);
	
	GEvent.addListener(map,'click',function(overlay,latlng){
		if(overlay){		//no overlay
			//no process
		} else {
			map.closeInfoWindow();
		}
		
	});
	
//		GEvent.addListener(map, 'dragend',function(){
//				/* FireBug */ if(window.console){console.debug("moveFlag: "+ moveFlag);}
//				if(moveFlag==false){
//					moveView(1);
//					/* FireBug */ if(window.console){console.debug("move by drag ");}
//				}
//			}
//		);
	
	
//		GEvent.addListener(map, 'zoomend',function(oldZoomLevel,newZoomLevel){
//				if(moveFlag==false){
//					/* FireBug */ if(window.console){console.debug("move by zoom level");}
//					moveView(1);
//				}
//			}
//		);
	
	GEvent.addListener(map, "dblclick", function (overlay, point) {
//			if(returnFunc=="dragAndZoomView_one"){
//				GEvent.clearListeners(map,'moveend');
//			}
		OpenWindowOfSpotMake(point,'dragAndZoomView_one');
//			map.centerAtLatLng(point);
	});
	
//		event_mapDblClick("dragAndZoomView_one");
}

function addEventListener_ForArea(theReturnType){
	globalReturnType=theReturnType;
	
	//disable doubleClickZoom()
	map.disableDoubleClickZoom();
	
	GEvent.addListener(map,"click",function(overlay,latlng){
		if(overlay){
			if(overlay.getVertexCount){
				//alert(overlay.getVertexCount()-1);
				var verexLatlng=overlay.getVertex(overlay.getVertexCount()-1);
				++clickCount;
				globalLat=verexLatlng.lat();
				globalLng=verexLatlng.lng();
				overlay=null;
			}
			//for( var one in overlay){
			//	alert(one);
			//}
			
			// no process
		}else{
			++clickCount;
			globalLat=latlng.lat();
			globalLng=latlng.lng();
		}
		if(timerID){
			clearTimeout(timerID);
		}
		timerID=setTimeout(clickFunction,400);
		
		moveFlag=false;
		function clickFunction(){
			if(overlay){
				// no process
			}else{
				if(clickCount==1){
					//single click
					line_draw(overlay,new GLatLng(globalLat,globalLng),theReturnType);
					clickCount=0;
					timerID=null;
				} else if(clickCount>1){
					//double click
					line_draw(overlay,new GLatLng(globalLat,globalLng),theReturnType);
					line_draw(overlay,globalLatlngArray[0],theReturnType);
					AreaTemporayAdd_form(theReturnType);
					clickCount=0;
					timerID=null;
				} else {
					clickCount=0;
					timerID=null;
				}
			}
			moveFlag=true;
		}
	});
	
	
	// kill double click
	GEvent.addListener(map, "movestart", function () {
		center = map.getCenter();
	});

	GEvent.addListener(map, "dblclick", function (a,point) {
		if (point) {map.setCenter(center);}
		clickCount=2;
	});
	
	//event for new line
	GEvent.addListener(map,'mousemove',function(theLatlng){
		next_line_preview(theLatlng,theReturnType);
	});
	
	zoomLevelInfoNode=document.getElementById("zoomLevelInfo");
	
	//stop data getii
	
	
	// Map Event Listener Move
//		GEvent.addListener(map, 'moveend', function(){
//			// Marker
//			if(moveFlag){
//				point=map.getCenterLatLng();
//				map.clearOverlays();
//				var spanLatLng=map.getSpanLatLng();
//				var zoomLevel=map.getZoomLevel();
//				if(zoomLevel < 2){
//					get_point_data(point.x,point.y,parseFloat(spanLatLng.width),4);
//					if(zoomLevelInfoNode){
//						zoomLevelInfoNode.style.display="none";
//					}
//				} else {
//					if(zoomLevelInfoNode){
//						zoomLevelInfoNode.style.display="block";
//						zoomLevelInfoNode.innerHTML="Map上のマーカーを表示するには地図をもっとズームアップしてください。";
//					}
//				}
//				SP_View_Polygon();
//			}
//		});
	
}

function line_draw(overlay,latlng,theReturnType){
	if(overlay){
		var mylatlng=overlay.getPoint();
	} else {
		
		//icon common setting
		myIconSise	=new GSize(11,11);
		myShadowSize=new GSize(15,15);
		myIconAnchor=new GPoint(5,10);
		
		//homebase icon
		var homeBaseIcon=new GIcon(G_DEFAULT_ICON,'img/square.gif');
		homeBaseIcon.iconSize=myIconSise;
		homeBaseIcon.shadowSize=myShadowSize;
		homeBaseIcon.iconAnchor=myIconAnchor;
		
		
		//marker
		var mylatlng=new GLatLng(latlng.lat(),latlng.lng());
		var marker=new GMarker(mylatlng,homeBaseIcon);
		globalMarkerForPolyine.push(marker);
		GEvent.addListener(marker,'click',function(){
			erasePolyline_confirm(marker,theReturnType);
		});
		map.addOverlay(marker);
	}
	globalLatlngArray.push(mylatlng);
	
	line_view(theReturnType);

}

function next_line_preview(theLatlng,theReturnType){
	if(globalLatlngArray.length >0){
		var newLatLngArray=new Array();
		newLatLngArray.push(globalLatlngArray[globalLatlngArray.length-1]);
		newLatLngArray.push(new GLatLng(theLatlng.lat(),theLatlng.lng()));
		
		//line
		if(previousNewPolyline){
			map.removeOverlay(previousNewPolyline);
			previousNewPolyline=false;
		}
		var theColor =theReturnType=='Community_Create' ? '#66ff66' : '#ff66ff';
		var newPolyline=new GPolyline(newLatLngArray,theColor,2,.5);
		previousNewPolyline=newPolyline;
		map.addOverlay(newPolyline);
	}
}

function line_view(theReturnType){
	//erase polyline
	if(globalPolyline){
		map.removeOverlay(globalPolyline);
		globalPolyline=false;
	}
	
	//line decoration
	if(theReturnType=='Community_Create'){
		var theColor	='#66ff66';
		var theWeight	=2;
		var theOpacity	=1;
	} else {
		var theColor	='#ff66ff';
		var theWeight	=2;
		var theOpacity	=1;
	}
	
	//draw line
	if(globalLatlngArray.length >1){
		globalPolyline=new GPolyline(globalLatlngArray,theColor,theWeight,theOpacity);
		map.addOverlay(globalPolyline);
	}
}

function erasePolyline_confirm(theMarker,theReturnType){
	map.closeInfoWindow();
	
	var markerLatLng=theMarker.getPoint();
	if(globalLatlngArray.length >1){
		var j=0;
		for(var i=0,n=globalLatlngArray.length; i<n; i++){
			if(markerLatLng.equals(globalLatlngArray[i])){
				break;
			}
			j++;
		}
		
		line_draw(theMarker,null,theReturnType);
		if(j==0){
			//inital marker click
			AreaTemporayAdd_form(globalReturnType);
			clickCount=0;
			timerID=null;
			moveFlag=true;
			
			return;
		} else if(j<globalLatlngArray.length){
			var html ="<div style='padding:0.5em'>このポイントを削除しますか?</div>";
				html+="<div style='text-align:center'>";
				html+="<button name='yesButton' value='yes' onclick='erasePolyline_action("+theMarker+","+j+")'>はい</button>";
				html+="&nbsp;&nbsp;<button name='noButton' value='no' onclick='map.closeInfoWindow()'>いいえ</button>";
				html+="</div>";
				
			var route=document.createElement("div");
			var div=document.createElement("div");
			div.style.padding="0.5em";
			var divText=document.createTextNode("このポイントを削除しますか?");
			div.appendChild(divText);
			
			var div2=document.createElement("div");
			div2.style.textAlign="center";
			var button1=document.createElement("button");
			button1.name='yesButton';
			//button1.value='yes';
			button1.style.marginRight='1em';
			button1.onclick=function(){
				erasePolyline_action(theMarker,theReturnType);
			};
			button1Text=document.createTextNode("はい");
			button1.appendChild(button1Text);
			
			div2.appendChild(button1);
			
			var button2=document.createElement("button");
			button2.name='noButton';
			//button2.value='no';
			button2.onclick=function(){
				map.closeInfoWindow();
			}
			button2Text=document.createTextNode("いいえ");
			button2.appendChild(button2Text);
			
			div2.appendChild(button2);
			
			route.appendChild(div);
			route.appendChild(div2);
			theMarker.openInfoWindowHtml(route);
		}
	}
}

function erasePolyline_action(theMarker,theReturnType){
	map.removeOverlay(theMarker);
	
	// delete same lat lng as  marker
	var markerLatLng=theMarker.getPoint();
	for(var i=0,n=globalLatlngArray.length; i<n; i++){
		if(markerLatLng.equals(globalLatlngArray[i])){
			globalLatlngArray.splice(i,1);
			i--;
		}
	}
	
	line_view(theReturnType);
	map.closeInfoWindow();
}

function LineMarker_All_Delete(latlngDelete){
	//polyline
	if(globalPolyline){
		map.removeOverlay(globalPolyline);
		globalPolyline=false;
	}
	
	// preview line
	if(previousNewPolyline){
		map.removeOverlay(previousNewPolyline);
		previousNewPolyline=false;
	}
	
	//marker
	for(var i=0,n=globalMarkerForPolyine.length; i<n; i++){
		map.removeOverlay(globalMarkerForPolyine[i]);
	}
	
	//latlng
	if(latlngDelete){
		globalLatlngArray=new Array()
	}
}

function clearEventListener(){
	GEvent.clearListeners(map,"movestart");
//		GEvent.clearListeners(map,"moveend");
//		GEvent.clearListeners(map,"dragend");
//		GEvent.clearListeners(map,"zoomend");
	GEvent.clearListeners(map,"zoom");
	GEvent.clearListeners(map,"click");
	GEvent.clearListeners(map,"dblclick");
	GEvent.clearListeners(map,"mousemove");
}

function init_RouteAdd(){
	map.clearOverlays();
	map.closeInfoWindow();
	var request=GXmlHttp.create();
	request.open("GET","inner_route_add_form.html",true);
	request.onreadystatechange=function(){
		if(request.readyState==4){
			var topBody=document.getElementById("topBody");
			topBody.innerHTML="";
			var topFooter=document.getElementById("topFooter");
			topFooter.innerHTML="";
			var headNode=document.getElementById("topHeader");
			headNode.innerHTML=request.responseText;
		}
	}
	
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	//Event Listener
	addEventListener_ForRoute();

}

function addEventListener_ForRoute(){
	//clear Event Listener
	
	//attach Event Listener
	GEvent.addListener(map,"click",function(ov,latlng){
		if(ov){
			// no process
		}else{
			++clickCount;
			globalLat=latlng.lat();
			globalLng=latlng.lng();
		}
		if(timerID){
			clearTimeout(timerID);
		}
		timerID=setTimeout(clickFunction,500);
		
		moveFlag=false;
		function clickFunction(){
			if(ov){
				// no process
			}else{
				if(clickCount==1){
					SP_Add_RouteDetail(globalLat,globalLng);
					SP_View_PolyLine();
					SP_ControlSubmitButton();
					clickCount=0;
					timerID=null;
				} else if(clickCount>1){
					OpenWindowOfSpotMaking(globalLat,globalLng);
					clickCount=0;
					timerID=null;
				}
			}
		}
	});
	
	GEvent.addListener(map, "movestart", function () {
		center = map.getCenter();
	});

	GEvent.addListener(map, "dblclick", function (a,point) {
		if (point) {map.setCenter(center);}
		clickCount=2;
	});
	
	zoomLevelInfoNode=document.getElementById("zoomLevelInfo");
	
	// Map Event Listener Move
	GEvent.addListener(map, 'moveend', function(){
		// Marker
		if(moveFlag){
			point=map.getCenterLatLng();
			var spanLatLng=map.getSpanLatLng();
			var zoomLevel=map.getZoomLevel();
			if(zoomLevel < 2){
				map.clearOverlays();
				get_point_data(point.x,point.y,parseFloat(spanLatLng.width));
				SP_View_PolyLine();
				zoomLevelInfoNode.style.display="none";
			} else {
				zoomLevelInfoNode.style.display="block";
				zoomLevelInfoNode.innerHTML="Map上のマーカーを表示するには地図をもっとズームアップしてください。";
			}
		}
	});
	
	//Zoom change
	GEvent.addListener(map, 'zoom', function(oldZoomLevel,newZoomLevel){
		if(oldZoomLevel < 2 && newZoomLevel>=2){
			SP_View_PolyLine();
		}
	});
	
	// Default Marker
	trigger_get_point_data();
}

function viewCommunity(pages,listFlag){
	if(listFlag =="True"){
		var query="?listFlag=True&Actniche_Community_Page="+encodeURIComponent(pages);
	} else {
		var query="?listFlag=False";
	}
	
	var request= GXmlHttp.create();
	request.open("GET","inner_community_view.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var topBody=document.getElementById("topBody");
		topBody.innerHTML="";
		var topFooter=document.getElementById("topFooter");
		topFooter.innerHTML="";
		var headNode=document.getElementById("topHeader");
		headNode.innerHTML=request.responseText;
	}
}

function viewRouteModifyForm(routeID){
	
	var query="?Actniche_RouteID="+encodeURIComponent(routeID);
	var request= GXmlHttp.create();
	request.open("GET","inner_route_modify_form.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var topBody=document.getElementById("topBody");
		topBody.innerHTML="";
		var topFooter=document.getElementById("topFooter");
		topFooter.innerHTML="";
		var headNode=document.getElementById("topHeader");
		headNode.innerHTML=request.responseText;
		
	}
	


}

function viewRouteModify(routeID){
	var query="?Actniche_RouteID="+encodeURIComponent(routeID);
	var request= GXmlHttp.create();
	request.open("GET","json_routedetail_view.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		eval("var routeObj="+request.responseText);
		var routeDetail=routeObj.RootDetail;
		for(var i=0,n=routeDetail.length; i<n; i++){
			if(i==0){
				var zlevel=map.getZoomLevel();
				var geopoint=new GPoint(routeDetail[i].Longitude,routeDetail[i].Latitude);
				map.centerAndZoom(geopoint, zlevel);
			}
			if(routeDetail[i].SpotID && routeDetail[i].Photos[0]){
				var spotForm={
					"Actniche_SpotID"		:{"value":routeDetail[i].SpotID},
					"Actniche_Explanation"	:{"value":routeDetail[i].Explanation},
					"Actniche_Longitude"	:{"value":routeDetail[i].Longitude},
					"Actniche_Latitude"		:{"value":routeDetail[i].Latitude},
					"Actniche_Spot_Name"	:{"value":routeDetail[i].SpotName},
					"Actniche_PhotoID"		:[{"value":routeDetail[i].Photos[0].Photo_id, "checked":true}]
				};
				SP_Add_RouteDetail(null,null,spotForm);
			} else if(routeDetail[i].SpotID){
				var spotForm={
					"Actniche_SpotID"		:{"value":routeDetail[i].SpotID},
					"Actniche_Explanation"	:{"value":routeDetail[i].Explanation},
					"Actniche_Longitude"	:{"value":routeDetail[i].Longitude},
					"Actniche_Latitude"		:{"value":routeDetail[i].Latitude},
					"Actniche_Spot_Name"	:{"value":routeDetail[i].SpotName}
				};
				SP_Add_RouteDetail(null,null,spotForm);
			} else {
				SP_Add_RouteDetail(routeDetail[i].Latitude,routeDetail[i].Longitude,null,routeDetail[i].Explanation);
			}
		}
		SP_View_PolyLine();
		SP_ControlSubmitButton();
		addEventListener_ForRoute();
	}
}

function clearPoly_closeWindow(){
	if(polyLineArray){
		map.removeOverlay(polyLineArray);
	}
	if(gPolyObj){
		map.removeOverlay(gPolyObj);
	}
	map.closeInfoWindow();
}

function IsRouteName(myForm){
	if(myForm.Actniche_Route_Name.value.length==0){
		alert("ルート名が未入力です。");
		return false;
	} else {
//			locationNodesLength=myForm.elements['Actniche_Location_Name[]'].length;
//			for(var i=0; i <locationNodesLength; i++){
//				var node=myForm.elements['Actniche_Location_Name[]'][i];
//				if(node.value.length==0){
//					alert("名称が未入力です。");
//					return false;
//				}
//			}
	}
	
	if(myForm.Route_User_Delete && myForm.Route_User_Delete.checked){
		myForm.Actniche_Route_Visible.value="FALSE";
		myForm.Actniche_RouteDetail_Visible.value="FALSE";
	}
	return true;
}

function viewSpotDetail(theSpotID){
	var query="?Actniche_SpotID="+encodeURIComponent(theSpotID);
	
	var request= GXmlHttp.create();
	request.open("GET","inner_spotdetail_view.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var rightMenuHeader=document.getElementById("rightMenuHeader");
		rightMenuHeader.innerHTML=request.responseText;
	}
}

function selectFormalTag(theRouteID){
	var query="?Actniche_RouteID="+encodeURIComponent(theRouteID);
	var request= GXmlHttp.create();
	request.open("GET","json_selectformaltag.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		eval("var myfunc="+request.responseText);
		if(myfunc.selectFunc){
			myfunc.selectFunc();
		}
	}
}

//	function communityAddForm_move(theForm){
//		var query="?ActnicheCommunity_SpotID="+encodeURIComponent(theForm.ActnicheCommunity_SpotID.value);
//		var request=GXmlHttp.create();
//		request.open("GET","inner_community_add_form.html"+query,false);
//		request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
//		request.send(null);
//		
//		if(request.readyState==4){
//			var rightMenuHeader=document.getElementById("rightMenuHeader");
//			rightMenuHeader.innerHTML=request.responseText;
//		}
//	
//	}

function community_init(){
	//コミュニティ初期化
	
	//tabControl
	tabControl=1;
	
	map.closeInfoWindow();
	
	//checkbox
//	document.getElementById('polygonHomeBase').style.display="inline";
	document.DataShowControlForm.DataShow[0].style.display="inline";
	document.DataShowControlForm.DataShow[0].checked=globalCheckBox.community[0];
	
//	document.getElementById('polygonCommunity').style.display="inline";
	document.DataShowControlForm.DataShow[1].style.display="inline";
	document.DataShowControlForm.DataShow[1].checked=globalCheckBox.community[1];
	
	document.DataShowControlForm.DataShow[2].checked=globalCheckBox.community[2];
	document.DataShowControlForm.DataShow[3].checked=globalCheckBox.community[3];
	
	//clear 
	document.getElementById('communityInfo').innerHTML='';
	//taglist
	innerHTML_get('taglist','inner_tag_list.html','Actniche_TagListType','Community');
	
	//tagID 
	tagid_push(0);
	
	//左メニュー一覧
	community_list();
	
	//button
	button_make('Community_Create','dummy');
	
	//マップ
	moveView(1);
	
	//右メニュー
	var rightMenu=document.getElementById('rightMenu');
	rightMenu.innerHTML="";
}

function communityAdd_Submit(theForm){
	var postdata =encodeURIComponent("ActnicheCommunity_AreaID")			+"="	+encodeURIComponent(theForm.ActnicheCommunity_AreaID.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_CommunityName")	+"="	+encodeURIComponent(theForm.ActnicheCommunity_CommunityName.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_URL")			+"="	+encodeURIComponent(theForm.ActnicheCommunity_URL.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_Introduction")	+"="	+encodeURIComponent(theForm.ActnicheCommunity_Introduction.value);
		postdata+="&"+encodeURIComponent("communityadd")					+"="	+encodeURIComponent(theForm.communityadd.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);

	var html=innerHTML_PostAndReturn('inner_community_add.html',postdata);
	
	var mylatlng=new GLatLng(theForm.Latitude.value,theForm.Longitude.value);
	map.openInfoWindowHtml(mylatlng,html);
}

function communityModify_Submit(theForm){
	var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")		+"="	+encodeURIComponent(theForm.ActnicheCommunity_CommunityID.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_CommunityName")	+"="	+encodeURIComponent(theForm.ActnicheCommunity_CommunityName.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_URL")			+"="	+encodeURIComponent(theForm.ActnicheCommunity_URL.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_Introduction")	+"="	+encodeURIComponent(theForm.ActnicheCommunity_Introduction.value);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_Available")		+"="	+encodeURIComponent(theForm.ActnicheCommunity_Available.value);
		postdata+="&"+encodeURIComponent("communityModify")					+"="	+encodeURIComponent(theForm.communityModify.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);

	var html=innerHTML_PostAndReturn('inner_community_modify.html',postdata);
	
	var mylatlng=new GLatLng(theForm.Latitude.value,theForm.Longitude.value);
	map.openInfoWindowHtml(mylatlng,html);
}

function communityAddForm_show(theAreaID){
	//get form
	var html=innerHTML_getAndReturn('inner_community_add_form.html','ActnicheCommunity_AreaID',theAreaID);
	
	//get center lat lng
	var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	var mylatlng=new GLatLng(areaData.CenterLatitude,areaData.CenterLongitude);
	map.openInfoWindowHtml(mylatlng,html);
}

function communiyModifyForm_show(theCommunityID){
	//コミュニティ編集
	
	map.closeInfoWindow();
	
	//get center lat lng
	var communityInfo=json_get("json_communityinfo_view.html","ActnicheCommunity_CommunityID",theCommunityID);
	var latlng=new GLatLng(communityInfo.CenterLatitude,communityInfo.CenterLongitude);
	
	//get form
	var html=innerHTML_getAndReturn('inner_community_modify_form.html','ActnicheCommunity_CommunityID',theCommunityID);
	map.openInfoWindowHtml(latlng,html);
}

function communityInfo_view(theCommunityID){
	var query="?ActnicheCommunity_CommunityID="+encodeURIComponent(theCommunityID);
	var request=GXmlHttp.create();
	request.open("GET","inner_communityinfo_view.html"+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var topHeader=document.getElementById("topHeader");
		topHeader.innerHTML=request.responseText;
	} 

}

function community_join(theCommunityID){
	//コミュニティに参加
	
	//infowindow close
	map.closeInfoWindow();
	
	var communityInfo=json_get("json_communityinfo_view.html","ActnicheCommunity_CommunityID",theCommunityID);
	
	var latlng=new GLatLng(communityInfo.CenterLatitude,communityInfo.CenterLongitude);
	
	//make query
	var queryString ="ActnicheCommunity_CommunityID="+encodeURIComponent(theCommunityID);
		queryString+="&memberAdd="+encodeURIComponent(theCommunityID);
	
	//member add
	var html=innerHTML_PostAndReturn('inner_communitymember_join.html',queryString);
	
	map.openInfoWindowHtml(latlng,html);
	
	//ハイライトポリゴン
	polygon_effect_override(null,communityInfo.AreaID);

	
	//result display
//		var popup=document.getElementById("popup");
//		popup.innerHTML=html;
//		popup.style.display="block";

	
	
	//右メニューにメンバー一覧を表示
	innerHTML_get('rightMenu','inner_communitymember_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	//下部にコミュニティBBS等を表示
	innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
//		window.setTimeout('popup_close()',2500);
}

function community_left(theCommunityID){
	//コミュニティから退会
	
	//infowindow close
	map.closeInfoWindow();
	
	var communityInfo=json_get("json_communityinfo_view.html","ActnicheCommunity_CommunityID",theCommunityID);
	var latlng=new GLatLng(communityInfo.CenterLatitude,communityInfo.CenterLongitude);
	
	//make query
	var queryString ="ActnicheCommunity_CommunityID="+encodeURIComponent(theCommunityID);
		queryString+="&memberModify="+encodeURIComponent(theCommunityID);
		queryString+="&ActnicheCommunity_MemberAvailable=False";
	
	//member add
	var html=innerHTML_PostAndReturn('inner_communitymember_left.html',queryString);
	
	map.openInfoWindowHtml(latlng,html);
	
	//ハイライトポリゴン
	polygon_effect_override(null,communityInfo.AreaID);
	
	//result display
//		var popup=document.getElementById("popup");
//		popup.innerHTML=html;
//		popup.style.display="block";
	
	//右メニューにメンバー一覧を表示
	innerHTML_get('rightMenu','inner_communitymember_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	//下部にコミュニティBBS等を表示
	innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
//		window.setTimeout('popup_close()',2500);
}

function community_list(topLat,rightLng,bottomLat,leftLng,areaRows,thePage){
	//コミュニティーリスト
	
	//innerHTML_get('topHeader','inner_community_list.html');
	
	//make query
	if(!(topLat)){
		//lat lng boundary
		var theLatLngBounds=map.getBounds();
		var northEastLatlng=theLatLngBounds.getNorthEast();
		var southWestLatlng=theLatLngBounds.getSouthWest();
		
		var topLat		=northEastLatlng.lat();
		var rightLng	=northEastLatlng.lng();
		var bottomLat	=southWestLatlng.lat();
		var leftLng		=southWestLatlng.lng();
		for(var i=0,n=document.DataShowControlForm.Actniche_DataRows.options.length; i<n; i++){
			if(document.DataShowControlForm.Actniche_DataRows.options[i].selected){
				var areaRows=document.DataShowControlForm.Actniche_DataRows.options[i].value;
				break;
			}
		}
	}
	var postdata =encodeURIComponent("ActnicheCommunity_TopLatitude")			+"="	+encodeURIComponent(topLat);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_RightLongitude")	+"="	+encodeURIComponent(rightLng);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_BottomLatitude")	+"="	+encodeURIComponent(bottomLat);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_LeftLongitude")		+"="	+encodeURIComponent(leftLng);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaRows")			+"="	+encodeURIComponent(areaRows);
		if(globalTagID !=0){
			postdata+="&"+encodeURIComponent("Actniche_TagID")					+"="	+encodeURIComponent(globalTagID);
		}
		if(thePage){
			postdata+="&"+encodeURIComponent("ActnicheCommunity_InfoPage")					+"="	+encodeURIComponent(thePage);
		}
	
	innerHTML_Update_Post('topHeader','inner_community_list.html',postdata);
}

function community_window_open(theCommunityID,theNode,communityCount,returnUserID){
	//コミュニティのインフォウィンドウを開く
	//infowindow close
	map.closeInfoWindow();
	
	var communityInfo=json_get("json_communityinfo_view.html","ActnicheCommunity_CommunityID",theCommunityID);
	
	var latlng=new GLatLng(communityInfo.CenterLatitude,communityInfo.CenterLongitude);
	
	var html=innerHTML_getAndReturn('inner_communityinfowindow_view.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	map.openInfoWindowHtml(latlng,html);
	
	//右メニューにメンバー一覧を表示
	innerHTML_get('rightMenu','inner_communitymember_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	//下部にコミュニティBBS等を表示
	if(returnUserID){
		var queryString =encodeURIComponent("ActnicheCommunity_CommunityID")	+"="	+encodeURIComponent(theCommunityID);
		queryString+="&"+encodeURIComponent("ActnicheCommunity_ReturnUserID")	+"="	+encodeURIComponent(returnUserID);
	
		innerHTML_getWithMultiQuery('communityInfo','inner_communitybbs_list.html',queryString);
	} else {
		innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	}
	
	//ハイライトダウン
	Hightlight_Down();
	
	if(theNode){
		//メニュー選択部ハイライト
		var trNode=theNode.parentNode.parentNode.parentNode;
		var tdNodes=trNode.getElementsByTagName('td');
		for(var i=0,n=tdNodes.length; i<n; i++){
			tdNodes[i].style.backgroundColor="#bbffbb";
		}
	} else {
		//コミュニティ
		var retFlg=MarkerClick_Highlight_Leftmenu(theCommunityID,'community',communityCount);
		
		//参加コミュニティ
		if( !(retFlg) ){
			var retValue=MarkerClick_Highlight_Leftmenu(theCommunityID,'communityjoin');
		}
	}
	
	//ハイライトポリゴン
	polygon_effect_override(null,communityInfo.AreaID);
}

function community_window_simple_open(theCommunityID,fullText){
	//infowindow close
	map.closeInfoWindow();
	
	var communityInfo=json_get("json_communityinfo_view.html","ActnicheCommunity_CommunityID",theCommunityID);
	var latlng=new GLatLng(communityInfo.CenterLatitude,communityInfo.CenterLongitude);
	
	var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")	+"="	+encodeURIComponent(theCommunityID);
		if(fullText && fullText=='true'){
			postdata+="&"+encodeURIComponent("FullText")				+"="	+encodeURIComponent(fullText);
		}
	
//		var html=innerHTML_getAndReturn('inner_communityinfowindow_view.html','ActnicheCommunity_CommunityID',theCommunityID);
	var html=innerHTML_PostAndReturn('inner_communityinfowindow_view.html',postdata);
	
	map.openInfoWindowHtml(latlng,html);
	
	//ハイライトポリゴン
	polygon_effect_override(null,communityInfo.AreaID);
}

function community_static_information_view(theCommunityID){
	//コミュニティ静的情報表示
	
	//1.初期情報表示
	innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	//2.静的情報表示
	innerHTML_get('communityStaticInformation','inner_community_static_information_view.html','ActnicheCommunity_CommunityID',theCommunityID);
}

function community_delete(theCommunityID,theCommunityName,theLongitude,theLatitude,theAreaID){
	//コミュニティ削除(コミュニティおよびエリアの削除)
	
	map.closeInfoWindow();
	
	var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")		+"="	+encodeURIComponent(theCommunityID);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_CommunityName")	+"="	+encodeURIComponent(theCommunityName);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_Available")		+"="	+encodeURIComponent("False");
		postdata+="&"+encodeURIComponent("communityModify")					+"="	+encodeURIComponent("value");
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaName")		+"="	+encodeURIComponent("Community");
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaID_For_Photo")		+"="	+encodeURIComponent(theAreaID);

	var html=innerHTML_PostAndReturn('inner_community_modify.html',postdata);
	
	var mylatlng=new GLatLng(theLatitude,theLongitude);
	map.openInfoWindowHtml(mylatlng,html);
	
	//スポット,エリア取得
	moveView(1);
	
	//レフトメニュー変更
	leftmenu_change();
}

function communityDetail_show(theCommunityID){
	//tabControl
	tabControl=4;
	//コミュニティ詳細表示
	
	//左メニューに詳細表示
	innerHTML_get('topHeader','inner_communitydetail_view.html','ActnicheCommunity_CommunityID',theCommunityID);
	
	//コミュニティ情報を表示(メンバー等)
	community_window_open(theCommunityID);
	
	//button
	button_make('Community_Create','dummy');
	
	//checkbox
	document.getElementById('polygonLabel').innerHTML="ｺﾐｭﾆﾃｨ";
	document.DataShowControlForm.DataShow[0].value="Community";
	document.DataShowControlForm.DataShow[1].style.display="none";
//	document.getElementById('profileLabel').style.display="none";

}

function community_Search(theSearchWord,thePage){
	if(theSearchWord.length){
		var	queryString =encodeURIComponent("ActnicheCommunity_Info_Search")	+"="	+encodeURIComponent(theSearchWord);
		if(thePage){
			queryString+="&"+encodeURIComponent("ActnicheCommunity_InfoPage")	+"="	+encodeURIComponent(thePage);
		}
		
		//ファイル取得
		innerHTML_getWithMultiQuery('topHeader','inner_community_list.html',queryString);
		
		//htmlハイライト
		var communityListTbody_Top=document.getElementById('communityListTbody_Top');
		var theBackgroundColor="#bbffbb";
		communityListTbody_Top.style.backgroundColor=theBackgroundColor;
		var buttons=communityListTbody_Top.getElementsByTagName('button');
		for(var i=0, n=buttons.length; i<n; i++){
			buttons[i].style.backgroundColor=theBackgroundColor;
		}
		document.getElementById('SearchTitle').innerHTML="検索（コミュニティ）";
	}
}

function message_submit(theForm){
	//伝言書き込み
	
	var errorMessage='';
	
	//input value check
	errorMessage+=theForm.BBS_Body.value.length >0 ? '' :'伝言が未入力です。';
	
	if(errorMessage.length==0){
		//make query
		var postdata =encodeURIComponent("BBS_Message_ID")		+"="	+encodeURIComponent(theForm.BBS_Message_ID.value);
			postdata+="&"+encodeURIComponent("BBS_Body")		+"="	+encodeURIComponent(theForm.BBS_Body.value);
			postdata+="&"+encodeURIComponent("messageAddForm")	+"="	+encodeURIComponent('dummy');
		
		//request
		var jsonData=json_postWithQueryString('json_message_add.html',postdata);
		
		//error check
		errorMessage+=jsonData.Message_01 ? jsonData.Message_01 : '';
		errorMessage+=jsonData.Message_02 ? jsonData.Message_02 : '';
		errorMessage+=jsonData.Message_03 ? jsonData.Message_03 : '';
	}
	
	//view
	var messageAddMessage=document.getElementById('messageAddMessage');
	if(errorMessage.length>0){
		messageAddMessage.style.display='block';
		messageAddMessage.innerHTML=errorMessage;
	} else if(jsonData.Success){
		//update mypage button
		Profile_Friend_View(theForm.BBS_Message_ID.value);
		var messageAddMessage=document.getElementById('messageAddMessage');
		messageAddMessage.style.display='block';
		messageAddMessage.innerHTML=jsonData.Success;
	} else {
		messageAddMessage.innerHTML='Error';
	}
	
	setTimeout(messageAddMessageClose,2500);

}

function messageAddMessageClose(){
	parts_close('messageAddMessage');
}

function message_read_more(theParentMessageID,thePage){
	///伝言 もっと読む
	
	//make query
	var postdata =encodeURIComponent("Login_UID")		+"="	+encodeURIComponent(theParentMessageID);
		postdata+="&"+encodeURIComponent("BBS_Page")	+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_message_read_more.html',postdata);

}

function mypage_community_read_more(theLoginID,thePage){
	//マイページコミュニティ もっと読む
	
	//make query
	var postdata =encodeURIComponent("Login_UID")		+"="	+encodeURIComponent(theLoginID);
		postdata+="&"+encodeURIComponent("BBS_Page")	+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_mypage_community_read_more.html',postdata);
}

function community_thread_add(theForm){
	//コミュニティトピック追加
	
	var errorMessage='';
	
	//input value check
	
	errorMessage+=(theForm.BBS_Subject.value.length > 0) ? '': 'タイトルが未入力です。';
	errorMessage+=(theForm.BBS_Body.value.length > 0) ? '': '本文が未入力です。';
	
	if(errorMessage.length==0){
		//make query
		var postdata =encodeURIComponent("BBS_Message_ID")		+"="	+encodeURIComponent(theForm.BBS_Message_ID.value);
			postdata+="&"+encodeURIComponent("BBS_Subject")		+"="	+encodeURIComponent(theForm.BBS_Subject.value);
			postdata+="&"+encodeURIComponent("BBS_Body")		+"="	+encodeURIComponent(theForm.BBS_Body.value);
			postdata+="&"+encodeURIComponent("threadAddForm")	+"="	+encodeURIComponent('Dummy');
		
		var jsonData=json_postWithQueryString('json_community_thread_add.html',postdata);
		
		//error check
		var errorMessage='';
		errorMessage+=jsonData.Message_01 ? jsonData.Message_01 :'';
		errorMessage+=jsonData.Message_02 ? jsonData.Message_02 :'';
		errorMessage+=jsonData.Message_03 ? jsonData.Message_03 :'';
		errorMessage+=jsonData.Message_04 ? jsonData.Message_04 :'';
		errorMessage+=jsonData.Message_05 ? jsonData.Message_05 :'';
		errorMessage+=jsonData.Message_06 ? jsonData.Message_06 :'';
		errorMessage+=jsonData.Message_07 ? jsonData.Message_07 :'';
		errorMessage+=jsonData.Message_08 ? jsonData.Message_08 :'';
	}
	
	//view
	var communityTopicAddMessage=document.getElementById('communityTopicAddMessage');
	communityTopicAddMessage.style.display='block';
	if(errorMessage.length >0){
		communityTopicAddMessage.innerHTML=errorMessage;
	} else if(jsonData.Success){
		//communityUpdate
		innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theForm.BBS_Message_ID.value);
		
		var communityTopicAddMessage=document.getElementById('communityTopicAddMessage');
		communityTopicAddMessage.style.display='block';
		communityTopicAddMessage.innerHTML=jsonData.Success;
	} else {
		communityTopicAddMessage.innerHTML='Error';
	}
	
	setTimeout(communityTopicAddMessageClose,2500);
}

function communityTopicAddMessageClose(){
	parts_close('communityTopicAddMessage');
}

function community_thread_add_form(theParentMessageID){
	//コミュニティトピック追加
	
//	var url ='community_thread_add_form.html';
//		url+='?BBS_Message_ID=' + encodeURIComponent(theParentMessageID);
//	window.open(url,'new_win','width=540,height=350,resizable=yes');

	var communityTopicAddForm=document.getElementById('communityTopicAddForm');
	if(communityTopicAddForm){
		communityTopicAddForm.style.display='block';
	}
}

function parts_open(theNodeName){
	var theNode=document.getElementById(theNodeName);
	if(theNode){
		theNode.style.display='block';
	}
}

function parts_close(theNodeName){
	//コミュニティトピック追加フォームを閉じる
	
	var theNode=document.getElementById(theNodeName);
	if(theNode){
		theNode.style.display='none';
	}
}

function community_thread_list(theCommunityID,thePage){
	//コミュニティスレッド一覧
	
	//make query
	var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")	+"="	+encodeURIComponent(theCommunityID);
		postdata+="&"+encodeURIComponent("BBS_Page")	+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_communitybbs_read_more.html',postdata);

}

function community_response_view(theCommunityID,theParentMessageID,thePage){
	//コミュニティレスポンス表示
	
	//make query
	var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")	+"="	+encodeURIComponent(theCommunityID);
		postdata+="&"+encodeURIComponent("BBS_Message_ID")				+"="	+encodeURIComponent(theParentMessageID);
		postdata+="&"+encodeURIComponent("BBS_Page")					+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_community_response_view.html',postdata);
}

function community_response_add(theForm){
	//コミュニティレスポンス投稿
	
	// error message initialize
	var errorMessage='';
	
	//input value check
	if( !(theForm.BBS_Body.value.length >0) ){
		errorMessage+='投稿内容が未入力です。';
	}
	
	var theCommunityID=theForm.ActnicheCommunity_CommunityID.value;
	// make query
	if(errorMessage.length==0){
		var postdata =encodeURIComponent("ActnicheCommunity_CommunityID")	+"="	+encodeURIComponent(theForm.ActnicheCommunity_CommunityID.value);
			postdata+="&"+encodeURIComponent("BBS_Message_ID")				+"="	+encodeURIComponent(theForm.BBS_Message_ID.value);
			postdata+="&"+encodeURIComponent("BBS_Body")					+"="	+encodeURIComponent(theForm.BBS_Body.value);
			postdata+="&"+encodeURIComponent("responseAddBtn")				+"="	+encodeURIComponent(theForm.responseAddBtn.value);
		
		//request
		var jsonData=json_postWithQueryString('json_community_response_add.html',postdata);
		
		//error check
		errorMessage+=jsonData.Message_01 ? jsonData.Message_01 : '';
		errorMessage+=jsonData.Message_02 ? jsonData.Message_02 : '';
		errorMessage+=jsonData.Message_03 ? jsonData.Message_03 : '';
		errorMessage+=jsonData.Message_04 ? jsonData.Message_04 : '';
		errorMessage+=jsonData.Message_05 ? jsonData.Message_05 : '';
	}
	
	//view
	var communityResponseAddMessage=document.getElementById('communityResponseAddMessage');
	if(errorMessage.length>0){
		communityResponseAddMessage.style.display='block';
		communityResponseAddMessage.innerHTML=errorMessage;
	} else if(jsonData.Success){
		//update mypage button
		community_response_view(theForm.ActnicheCommunity_CommunityID.value, theForm.BBS_Message_ID.value, 0);
		var communityResponseTbody=document.getElementById('communityResponseTbody');
		
		//remove
		var trs=communityResponseTbody.childNodes
		for(var i=0, n=trs.length; i<n; i++ ){
			communityResponseTbody.removeChild(trs[0]);
		}
		
		//append
		var trNode	=document.createElement('tr');
		var tdNode	=document.createElement('td');
		var divNode1=document.createElement('div');
		var divNode2=document.createElement('div');
		
		var operationHTML1=document.createTextNode('投稿しました。');
		var operationHTML2=document.createTextNode('コミュニティに戻る');
		
		divNode1.appendChild(operationHTML1);
		divNode2.appendChild(operationHTML2);
		
		tdNode.style.textAlign		="center";
		divNode1.style.marginBottom	="0.75em";
		divNode2.style.cursor		="pointer";
		divNode2.style.color		="#0000ff";
		divNode2.onclick			=function(){
			innerHTML_get('communityInfo','inner_communitybbs_list.html','ActnicheCommunity_CommunityID',theCommunityID);
		}
		
		tdNode.appendChild(divNode1);
		tdNode.appendChild(divNode2);
		
		trNode.appendChild(tdNode);
		communityResponseTbody.appendChild(trNode);
		
//		var html='<tr>'
//					+'<td style="text-align:center">'
//						+'<div style="margin-bottom:0.75em">投稿しました。</div>'
//							+'<div style="cursor:pointer; color:#0000ff" onclick="innerHTML_get(\'communityInfo\',\'inner_communitybbs_list.html\',\'ActnicheCommunity_CommunityID\','+ theForm.ActnicheCommunity_CommunityID.value +')">コミュニティに戻る</div>'
//					+'</td>'
//				+'</tr>';
//		
//		communityResponseTbody.innerHTML=html;
		
		return;
		
	} else {
		communityResponseAddMessage.innerHTML='Error';
	}
	
	setTimeout(communityResponseAddMessageClose,2500);
	
	//submit
//	innerHTML_Update_Post('communityInfo','inner_community_response_view.html',postdata);
	
}
function communityResponseAddMessageClose(){
	parts_close('communityResponseAddMessage');
}

function homebase_init(){
	//ホームベース初期化
	
	//tabControl
	tabControl=0;
	
	map.closeInfoWindow();
	
	//checkbox
//	document.getElementById('polygonCommunity').style.display="inline";
	document.DataShowControlForm.DataShow[1].style.display="inline";
	document.DataShowControlForm.DataShow[1].checked=globalCheckBox.homebase[1];
	
//	document.getElementById('polygonHomeBase').style.display="inline";
	document.DataShowControlForm.DataShow[0].style.display="inline";
	document.DataShowControlForm.DataShow[0].checked=globalCheckBox.homebase[0];
	
	document.DataShowControlForm.DataShow[2].checked=globalCheckBox.homebase[2];
	document.DataShowControlForm.DataShow[3].checked=globalCheckBox.homebase[3];
	
	//clear 
	document.getElementById('communityInfo').innerHTML='';
	
	//taglist
	innerHTML_get('taglist','inner_tag_list.html','Actniche_TagListType','HomeBase');
	
	//tagID 
	tagid_push(0);
	
	//ホームベース一覧
	homebase_list();
	
	//button
	button_make('HomeBase_Create','dummy');
	
	//マップ
	moveView(1);
	
	//右メニュー
	var rightMenu=document.getElementById('rightMenu');
	rightMenu.innerHTML="";
}

function homebase_list(theSearchWord,theSearchType,topLat,rightLng,bottomLat,leftLng,areaRows,thePage){
	//ホームベース一覧
	
	//file get
	if(theSearchWord){
		var queryString='';
		if(theSearchType=='profile'){
			queryString+=encodeURIComponent("Login_Actniche_ProfileSearch")	+"="	+encodeURIComponent(theSearchWord);
		} else {
			queryString+=encodeURIComponent("Login_Actniche_HomeBaseSearch")+"="	+encodeURIComponent(theSearchWord);
		}
		if(thePage){
			queryString+="&"+encodeURIComponent("Login_Actniche_Page")		+"="	+encodeURIComponent(thePage);
		}
		innerHTML_getWithMultiQuery('topHeader','inner_homebase_list.html',queryString);
	} else {
		//innerHTML_get('topHeader','inner_homebase_list.html');
		
		//make query
		if(!(topLat)){
			//lat lng boundary
			var theLatLngBounds=map.getBounds();
			var northEastLatlng=theLatLngBounds.getNorthEast();
			var southWestLatlng=theLatLngBounds.getSouthWest();
			
			var topLat		=northEastLatlng.lat();
			var rightLng	=northEastLatlng.lng();
			var bottomLat	=southWestLatlng.lat();
			var leftLng		=southWestLatlng.lng();
			for(var i=0,n=document.DataShowControlForm.Actniche_DataRows.options.length; i<n; i++){
				if(document.DataShowControlForm.Actniche_DataRows.options[i].selected){
					var areaRows=document.DataShowControlForm.Actniche_DataRows.options[i].value;
					break;
				}
			}
		}
		
		var postdata =encodeURIComponent("ActnicheCommunity_TopLatitude")			+"="	+encodeURIComponent(topLat);
			postdata+="&"+encodeURIComponent("ActnicheCommunity_RightLongitude")	+"="	+encodeURIComponent(rightLng);
			postdata+="&"+encodeURIComponent("ActnicheCommunity_BottomLatitude")	+"="	+encodeURIComponent(bottomLat);
			postdata+="&"+encodeURIComponent("ActnicheCommunity_LeftLongitude")		+"="	+encodeURIComponent(leftLng);
			postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaRows")			+"="	+encodeURIComponent(areaRows);
			if(globalTagID !=0){
				postdata+="&"+encodeURIComponent("Actniche_TagID")					+"="	+encodeURIComponent(globalTagID);
			}
			
			if(thePage){
				postdata+="&"+encodeURIComponent("Login_Actniche_Page")				+"="	+encodeURIComponent(thePage);
			}
		
		innerHTML_Update_Post('topHeader','inner_homebase_list.html',postdata);
	}
	
	//ハイライト
	if(theSearchWord){
//		var homebaseListHeader=document.getElementById('homebaseListHeader');
		var homeBaseTbody_Top=document.getElementById('homeBaseTbody_Top');
		var theBackgroundColor="#ffccff";
		
		homeBaseTbody_Top.style.backgroundColor=theBackgroundColor;
		
		var buttons=homeBaseTbody_Top.getElementsByTagName('button');
		for(var i=0, n=buttons.length; i<n; i++){
			buttons[i].style.backgroundColor=theBackgroundColor;
		}
		if(theSearchType=='profile'){
			document.getElementById('SearchTitle').innerHTML="検索（プロフィール）";
		} else {
//				homebaseHeaderTds[1].innerHTML="検索（ホームベース）";
			document.getElementById('SearchTitle').innerHTML="検索（ホームベース）";
		}
	}
}

function homebase_view(theUserID,theAreaID,theNode){
	//ホームベース表示
	map.closeInfoWindow();
	
	//右メニュー（友達リスト）
	innerHTML_get('rightMenu','inner_friend_list.html','Actniche_AddressBook_UserID',theUserID);
	
	//マップ(ホームベース)
	var retValue=areaMarker_click(theAreaID);

	//プロフィール
	if( document.DataShowControlForm && document.DataShowControlForm.DataShow[2].checked){
		innerHTML_get('communityInfo','inner_mypage_bottom.html','Login_UID',theUserID);
		//友達履歴初期化(スタック)
		globalFriendStack=new Array();
	}
}

function homeBaseAdd_submit(theAreaID){
	//エリアのインフォウィンドウから本拠地を追加
	
	//エリアの中心点取得
	var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	var mylatlng=new GLatLng(areaData.CenterLatitude,areaData.CenterLongitude);
	
	//セッションチェック
	var sessData=json_get('json_session_view.html');
	if( !(sessData.ASSIGN_2) ){
		var html ="<br><div style='font-size:0.8em; text-align:center;'>";
			html+=	"ログインしておりません。";
			html+="</div>";
		map.openInfoWindowHtml(mylatlng,html);
		return;
	}
	
	//make query
	var postdata =encodeURIComponent("Login_INFO5")		+"="	+encodeURIComponent(theAreaID);
	
	//submit
	var html=innerHTML_PostAndReturn('inner_homebaseadd_infowindow.html',postdata);
	
	//infowindow open
	map.openInfoWindowHtml(mylatlng,html);
}

function homeBaseDelete_submit(theAreaID,theAreaName){
	//エリアホームベースを削除
	
	//make query
	var postdata =encodeURIComponent("ActnicheCommunity_AreaID")		+"="	+encodeURIComponent(theAreaID);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaName")	+"="	+encodeURIComponent(theAreaName);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaAvailable")	+"="	+encodeURIComponent("False");
		postdata+="&"+encodeURIComponent("AreaModifyForm")					+"="	+encodeURIComponent("value");
	
	//submit 
	innerHTML_Update_Post('communityInfo','inner_homebase_delete.html',postdata);
	
	
//	//スポット,エリア取得
//	map.closeInfoWindow();
//		moveView(1);
//	
//	//レフトメニュー変更
//		leftmenu_change();
//	
//	//ホームベース作成ボタン
//	if(tabControl==0){
		button_make('HomeBase_Create','dummy');
//	}
}
function Introduction_FullText(theNode,FullTextFlg){
	var theParentNode=theNode.parentNode;
	
	if(FullTextFlg=='true'){
		var div=theParentNode.nextSibling;
		div.style.display="block";
		
	} else {
		var div=theParentNode.previousSibling;
		div.style.display="block";
	}
	theParentNode.style.display="none";
}

function friend_list_click(theUserID,theHomebaseID,theNode,theReturnUserID){
	//友達リストクリック
	map.closeInfoWindow();
	var canselLeftmenu=true;
	theLeftMenuChangeFlag=false;
	var jsonData=areaMarker_click(theHomebaseID,null,canselLeftmenu);
	
	//highLight polygon
	HomeBase_Frame_Show(jsonData);
	
	//プロフィール
	if( document.DataShowControlForm && document.DataShowControlForm.DataShow[2].checked){
		//innerHTML_get('communityInfo','inner_mypage_bottom.html','Login_UID',theUserID);
		
		//make query
		var queryString =encodeURIComponent("Login_UID")				+"="	+encodeURIComponent(theUserID);
			if(theReturnUserID && tabControl==2){
				queryString+="&"+encodeURIComponent("theReturnUserID")	+"="	+encodeURIComponent(theReturnUserID);
			}
		
		innerHTML_getWithMultiQuery('communityInfo','inner_mypage_bottom.html',queryString);
		
		//友達履歴初期化(スタック)
		globalFriendStack=new Array();
	}
	
	//ハイライトダウン
	Hightlight_Down(true);
	
	//メニュー選択部ハイライト
	var trNode=theNode.parentNode.parentNode;
	var tdNodes=trNode.getElementsByTagName('td');
	for(var i=0,n=tdNodes.length; i<n; i++){
		tdNodes[i].style.backgroundColor="#ffccff";
	}
}

function innerHTML_get(node,file,queryName,queryValue){
	//innerHTMLのファイルを取得する。
	var query="";
	if(queryName && queryValue){
		query+="?"+ encodeURIComponent(queryName) + "=" + encodeURIComponent(queryValue);
	}
	
	var request=GXmlHttp.create();
	request.open("GET",file+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var targetNode=document.getElementById(node);
		targetNode.innerHTML=request.responseText;
	}
}
function innerHTML_getAndReturn(file,queryName,queryValue){
	//innerHTMLのファイルを取得する。
	var query="";
	if(queryName && queryValue){
		query+="?"+ encodeURIComponent(queryName) + "=" + encodeURIComponent(queryValue);
	}
	
	var request=GXmlHttp.create();
	request.open("GET",file+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		return request.responseText;
	}
}

function innerHTML_getWithMultiQuery(node,file,queryString){
	//innerHTMLのファイルを取得する。
	
	var request=GXmlHttp.create();
	request.open("GET",file + '?' + queryString,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		var targetNode=document.getElementById(node);
		targetNode.innerHTML=request.responseText;
	}
}

function innerHTML_Update_Post(node,file,queryString){
	var request=GXmlHttp.create();
	request.open("POST",file,false);
	request.setRequestHeader("content-type","application/x-www-form-urlencoded");
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(queryString);
	
	if(request.readyState==4){
		var targetNode=document.getElementById(node);
		targetNode.innerHTML=request.responseText;
	}
}

function innerHTML_PostAndReturn(file,queryString){
	var request=GXmlHttp.create();
	request.open("POST",file,false);
	request.setRequestHeader("content-type","application/x-www-form-urlencoded");
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(queryString);
	
	if(request.readyState==4){
		return request.responseText;
	}
}

function innerHTML_PostAndReturn_Multipart(file,queryString){
	var request=GXmlHttp.create();
	request.open("POST",file,false);
	request.setRequestHeader("content-type","multipart/form-data");
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(queryString);
	
	if(request.readyState==4){
		return request.responseText;
	}
}

function json_get(file,queryName,queryValue){
	//jsonデータを取得し呼び出し元に返す。
	var query="";
	if(queryName && queryValue){
		query+="?"+ encodeURIComponent(queryName) + "=" + encodeURIComponent(queryValue);
	}
	
	var request=GXmlHttp.create();
	request.open("GET",file+query,false);
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(null);
	
	if(request.readyState==4){
		eval("var res="+request.responseText);
		return res;
	}
}
function json_postWithQueryString(file,queryString){
	//jsonデータを取得し呼び出し元に返す（メソッドポスト）。
	var request= GXmlHttp.create();
	request.open("POST",file,false);
	request.setRequestHeader("content-type","application/x-www-form-urlencoded");
	request.setRequestHeader("If-Modified-Since","Thu,01 Jun 1970 00:00:00 GMT");	//cache management
	request.send(queryString);	
	
	if(request.readyState==4){
		eval("var res="+request.responseText);
		return res;
	}
	
}

function button_create(displayNode,myname,myvalue,onclickFunc,theButtonName){
	//ボタンを追加
	var inputNode=document.createElement('input');
		inputNode.type="button";
		inputNode.name=myname;
		inputNode.value=myvalue;
		inputNode.onclick=function(){
			areaAdd_Stop(theButtonName);
		}
		
	var node=document.getElementById(displayNode);
	if(node.hasChildNodes()){
		for(var i=0; i<node.childNodes.length; i++){
			node.removeChild(node.childNodes[0]);
		}
	}
	node.appendChild(inputNode);
	
	return inputNode;
}

function areaAdd_Stop(theButtonName){
	//エリア作成中止ボタンクリック時
	
	
	//ボタン変更
	button_create('areaBtn_add','areaAddBtn',theButtonName,areaAddBtn_click);
	
	//ボタン消去
	var node=document.getElementById('areaBtn_clear');
	if(node.hasChildNodes()){
		for(var i=0; i<node.childNodes.length; i++){
			node.removeChild(node.childNodes[0]);
		}
	}
	
	//ポリゴン消去
	SP_Remove_Polygon();
	
	//イベント設置
	clearEventListener();
	addEventListener_ForTop();
}

function areaAddBtn_click(theButtonName){
	//エリア作成ボタンクリック時
	
	//ボタン変更
	var inputNode=button_create('areaBtn_add','areaAddStop','中止',areaAdd_Stop(theButtonName));
	inputNode.style.backgroundColor="#ddddff";
	
	//ボタン追加
	var inputNode=button_create('areaBtn_clear','areaClear','エリアクリア',SP_Remove_Polygon);
	
	//イベント設定
	clearEventListener();
	addEventListener_ForArea();
}

function Area_Add_Submit(theForm){
	moveFlag=false;
	
	//input value check
	if(theForm.ActnicheCommunity_AreaName.value==0){
		alert("エリア名が未入力です。");
		return;
	}
	
	// check ItemName and ItemValue
	var eleLen=theForm.elements['Actniche_ItemName[]'].length;
	for(var i=0; i < eleLen; i++){
		if(theForm.elements['Actniche_ItemName[]'][i].value.length==0 && theForm.elements['Actniche_ItemValue[]'][i].value.length > 0){
			alert("項目名が未入力です。");
			return false;
		} else if(theForm.elements['Actniche_ItemName[]'][i].value.length > 0 && theForm.elements['Actniche_ItemValue[]'][i].value.length == 0){
			alert("項目値が未入力です。");
			return false;
		}
	}
	
	//make queryString
	var postData =		encodeURIComponent('ActnicheCommunity_AreaName')+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaName.value);
		postData+='&' +	encodeURIComponent('ActnicheCommunity_AreaComment')+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaComment.value);
		postData+='&' +	encodeURIComponent('ActnicheCommunity_AreaURL')	+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaURL.value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][2].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][2].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][2].value);
		postData+='&' +	encodeURIComponent('AreaAddForm')				+'='+encodeURIComponent("value");
	
	for(var i=0; i<areaLatLngs.length; i++){
		postData+='&' + encodeURIComponent('ActnicheCommunity_Latitude[]') + '=' + encodeURIComponent(areaLatLngs[i].lat()) + '&' +encodeURIComponent('ActnicheCommunity_Longitude[]') + '=' + encodeURIComponent(areaLatLngs[i].lng());
	}
	
	//tag
	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);
		
	//infowindow lat lng
	var latitude =theForm.Latitude.value;
	var longitude=theForm.Longitude.value;
	var mylatlng=new GLatLng(latitude,longitude);
	
	//submit	
	var resHtml=innerHTML_PostAndReturn('inner_area_add.html',postData);
	
	//infowindow open
	map.openInfoWindowHtml(mylatlng,resHtml);
	
	//エリア作成中止
	areaAdd_Stop();
	
	// スポット エリア取得
	moveView(1);
}

function AreaList_get(topLat,rightLng,bottomLat,leftLng,rows,areaExtract){
	//make query
	var postdata =encodeURIComponent("ActnicheCommunity_TopLatitude")			+"="	+encodeURIComponent(topLat);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_RightLongitude")	+"="	+encodeURIComponent(rightLng);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_BottomLatitude")	+"="	+encodeURIComponent(bottomLat);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_LeftLongitude")		+"="	+encodeURIComponent(leftLng);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaRows")			+"="	+encodeURIComponent(rows);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaExtract")		+"="	+encodeURIComponent(areaExtract);
		if(globalTagID !=0){
			postdata+="&"+encodeURIComponent("Actniche_TagID")					+"="	+encodeURIComponent(globalTagID);
		}
	
	var areaList=json_postWithQueryString("json_area_list.html",postdata);
	
	//delete globalPolygon
	if(globalPolygon.length >0){
		for(var j=0, k=globalPolygon.length; j < k; j++){
			map.removeOverlay(globalPolygon[j]);
		}
	}
	
	//icon common setting
	myIconSise	=new GSize(9,13);
	myShadowSize=new GSize(15,15);
	myIconAnchor=new GPoint(5,10);
	
	//homebase icon
//	var homeBaseIcon=new GIcon(G_DEFAULT_ICON,'img/homebase_marker.gif');
//	homeBaseIcon.iconSize=myIconSise;
//	homeBaseIcon.shadowSize=myShadowSize;
//	homeBaseIcon.iconAnchor=myIconAnchor;
	
	//community icon
	var communityIcon=new GIcon(G_DEFAULT_ICON,'img/community_marker.gif');
	communityIcon.iconSize=myIconSise;
	communityIcon.shadowSize=myShadowSize;
	communityIcon.iconAnchor=myIconAnchor;
	
	//cler tag underline
	var tagStringArea=document.getElementById('tagStringArea');
	if(tagStringArea){
		var spans=tagStringArea.getElementsByTagName('span');
		if(spans){
			for(var i=0,n=spans.length; i<n; i++){
				spans[i].style.textDecoration	='none';
				spans[i].style.fontWeight		='normal';
			}
		}
	}
	
	// add polygon and marker
	var tagObj={};
	globalHomebase_IDCount =new Array();
	globalCommunity_IDCount=new Array();
	for(var i=0, n=areaList.length; i < n; i++){
		var areaData= new Array();
		for(var m=0, p=areaList[i].AreaLatLng.length; m<p; m++){
			var latitude	=areaList[i].AreaLatLng[m].Latitude;
			var longitude	=areaList[i].AreaLatLng[m].Longitude;
			var mylatlng=new GLatLng(latitude,longitude);
			areaData.push(mylatlng);
		}
		//first index of array
		areaData.push(areaData[0]);
		
		//homebase icon
		//man, woman,gender no public
		var imageFile='';
		if(areaList[i].Section=="男性"){
			imageFile="img/homebase_marker_man.gif";
		} else if(areaList[i].Section=="女性"){
			imageFile="img/homebase_marker_woman.gif";
		} else {
			imageFile="img/homebase_marker_nopublic.gif";
		}
		
		var homeBaseIcon=new GIcon(G_DEFAULT_ICON,imageFile);
		
		homeBaseIcon.iconSize=myIconSise;
		homeBaseIcon.shadowSize=myShadowSize;
		homeBaseIcon.iconAnchor=myIconAnchor;
		
		//marker
		if(areaList[i].AreaType=='HomeBase'){
			var inert=(tabControl==0 || tabControl==3) ? false : false;			//marker clickable control
			var mymarker= new GMarker(new GLatLng(areaList[i].CenterLatitude,areaList[i].CenterLongitude),homeBaseIcon,inert);
			markerArray.push(mymarker);
			map.addOverlay(mymarker);
			areaMakerEventAttach(areaList[i].AreaID,mymarker,areaList[i].HomeBase_Count);
			globalHomebase_IDCount.push({'ID':areaList[i].AreaID,'Count':areaList[i].HomeBase_Count});
		}
		
		if(areaList[i].AreaType=='Community'){
			var inert=(tabControl==1 || tabControl==2 || tabControl==3) ? false : false;			//marker clickable control
			var mymarker= new GMarker(new GLatLng(areaList[i].CenterLatitude,areaList[i].CenterLongitude),communityIcon,inert);
			markerArray.push(mymarker);
			map.addOverlay(mymarker);
			communityMarker_EventAttach(areaList[i].CommunityID,mymarker,areaList[i].Community_Count);
			globalCommunity_IDCount.push({'ID':areaList[i].CommunityID,'Count':areaList[i].Community_Count});
		}
		
		//polygon
//			var mypolygon=new GPolygon(areaData,"#000000",2,.5,"#000000",.5);
		var strokeColor="";
		if(areaList[i].AreaType=='HomeBase'){
			strokeColor			='#ff66ff';
			var strokeWeight	=2;
			var strokeOpacity	=1;
		} else if(areaList[i].AreaType=='Community'){
			strokeColor			='#66ff66';
			var strokeWeight	=2;
			var strokeOpacity	=1;
		}
		if(strokeColor){
			var mypolygon=new GPolygon(areaData,strokeColor,strokeWeight,strokeOpacity);
			globalPolygon.push(mypolygon);
			map.addOverlay(mypolygon);
		}
		
		//taglist
//		if(areaList[i].TagList.length >0){
//			for(var s=0, t=areaList[i].TagList.length; s<t; s++){
////				tagArray.push(areaList[i].TagList[s]);
//				if( tagObj["tagID_" + areaList[i].TagList[s]] > 0){
//					tagObj["tagID_" + areaList[i].TagList[s]]++;
//					
//				} else {
//					tagObj["tagID_" + areaList[i].TagList[s]]=1;
//				}
//			}
//		}
		
		//tag underline
//		if(areaList[i].TagList.length && globalTagID==0){
//			tag_underline(areaList[i].TagList);
//		} else {
//			var arrayTagID=[globalTagID];
//			tag_underline(arrayTagID);
//		}
	}
//	tag_underline(tagObj);
//	var html = tagArray.toString();
//	var topFooter=document.getElementById('topFooter');
//	topFooter.innerHTML=html;

//dump
/* FireBug */ if(window.console){console.debug('Homevbase_length:' + globalHomebase_IDCount.length);}
/* FireBug */ if(window.console){console.debug('Community_length:' + globalCommunity_IDCount.length);}
//	for(var i=0,n=globalHomebase_IDCount.length; i<n; i++){
//		/* FireBug */ if(window.console){console.debug('ID: '+ globalHomebase_IDCount[i].ID);}
//		/* FireBug */ if(window.console){console.debug('Count: '+ globalHomebase_IDCount[i].Count);}
//	}
}

function areaMarker_click(theAreaID,fullText,canselLeftmenu,homeBaseCount,cancelMyPageBottom,backButton){
	//infowindow close
	map.closeInfoWindow();

	var postdata =encodeURIComponent("ActnicheCommunity_AreaID")	+"="	+encodeURIComponent(theAreaID);
		if(fullText && fullText=='true'){
			postdata+="&"+encodeURIComponent("FullText")			+"="	+encodeURIComponent(fullText);
		}
		if(backButton && backButton=='true'){
			postdata+="&"+encodeURIComponent("backButton")			+"="	+encodeURIComponent(backButton);
		}
	
	//get form
	var html=innerHTML_PostAndReturn('inner_area_view.html',postdata);
	
	
	//get center lat lng
	var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	var mylatlng=new GLatLng(areaData.CenterLatitude,areaData.CenterLongitude);
	
	//highLight polygon
	var effectObj=polygon_effect_override_VTwo(areaData,null);
	
	//high lise homebase frame
	var obj=HomeBase_Frame_Show_VTwo(areaData);
	var opt={
		"onCloseFn":function(){
			ClearObjAndOneLineRestart(effectObj,obj);
			if(globalOneLineListFlg==true){
				TimerOfOneLine_Clear();
				OneLine_list();
			} else {
				globalOneLineListFlg=true;
			}
		}
	}
	map.openInfoWindowHtml(mylatlng,html,opt);
	
	
	//highLight polygon
//	polygon_effect_override(areaData,null);
//	
//	//high lise homebase frame
//	if(fullText || tabControl==1){
//		HomeBase_Frame_Show(areaData);
//	}
	
	
	//highLight lefemenu
//	if(canselLeftmenu){
//		//no process
//	} else {
//		var retValue=MarkerClick_Highlight_Leftmenu(theAreaID,'homeBase',homeBaseCount);
//	}
	
	
	//get userid
	if(cancelMyPageBottom){
		//no process
	} else {
		var josnData=json_get('json_homebase_isexist.html','ActnicheCommunity_AreaID',theAreaID);
		
		if(josnData.UserID){
			//プロフィール
			if( document.DataShowControlForm && document.DataShowControlForm.DataShow[2].checked){
				innerHTML_get('communityInfo','inner_mypage_bottom.html','Login_UID',josnData.UserID);
				//友達履歴初期化(スタック)
				globalFriendStack=new Array();
			}
			//右メニュー（友達リスト）
			if(canselLeftmenu){
				//no process
			} else {
				innerHTML_get('rightMenu','inner_friend_list.html','Actniche_AddressBook_UserID',josnData.UserID);
			}
		}
	}
	
	return areaData;
}

function ClearObjAndOneLineRestart(effectObj,MarkerFrameObj){
	//ホームベースのエフェクトを消去
	
	/* FireBug */ if(window.console){console.debug("ホームベースオブジェクト削除_V2");}
	
	//effect
	/* FireBug */ if(window.console){console.debug("塗りつぶし削除_V2");}
	map.removeOverlay(effectObj);
	
	// homebase marker
	/* FireBug */ if(window.console){console.debug("マーカー削除_V2");}
	map.removeOverlay(MarkerFrameObj.Marker);
	
	// homebase friend communitymenber
	map.removeOverlay(MarkerFrameObj.Frame);
	
	//1行コメント表示
	//OneLine_list();
}

function CommentFullText_Show(theAreaID){
	
	var postdata =encodeURIComponent("ActnicheCommunity_AreaID")			+"="	+encodeURIComponent(topLat);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_RightLongitude")	+"="	+encodeURIComponent(rightLng);
	
	var html=innerHTML_PostAndReturn('inner_area_view.html',postdata);
	var html=innerHTML_getAndReturn('inner_area_view.html','ActnicheCommunity_AreaID',theAreaID);



}

function polygon_effect_override(json_area,theAreaID){
	//ポリゴン選択時のエフェクト
	if(!(json_area) && theAreaID){
		var json_area=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	}	
	//highLight polygon
	var myAreaData=new Array();
	for(var i=0,n=json_area.AreaLatLng.length; i<n; i++){
		var latitude	=json_area.AreaLatLng[i].Latitude;
		var longitude	=json_area.AreaLatLng[i].Longitude;
		var mylatlng	=new GLatLng(latitude,longitude);
		myAreaData.push(mylatlng);
	}
	overrideArea=new GPolygon(myAreaData,"#000000",2,.0,"#000000",.2);
	map.addOverlay(overrideArea);
}

function polygon_effect_override_VTwo(json_area,theAreaID){
	//ポリゴン選択時のエフェクト
	if(!(json_area) && theAreaID){
		var json_area=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	}	
	//highLight polygon
	var myAreaData=new Array();
	for(var i=0,n=json_area.AreaLatLng.length; i<n; i++){
		var latitude	=json_area.AreaLatLng[i].Latitude;
		var longitude	=json_area.AreaLatLng[i].Longitude;
		var mylatlng	=new GLatLng(latitude,longitude);
		myAreaData.push(mylatlng);
	}
	localOverrideArea=new GPolygon(myAreaData,"#000000",2,.0,"#000000",.2);
	map.addOverlay(localOverrideArea);
	
	return localOverrideArea;
}

function HomeBase_Frame_Show(homeBaseJsonData){
	//highLight polygon
	if(tabControl==1 || tabControl==2){
		var mylatlng=new GLatLng(homeBaseJsonData.CenterLatitude,homeBaseJsonData.CenterLongitude);
		
		//icon common setting
		myIconSise	=new GSize(9,13);
		myShadowSize=new GSize(15,15);
		myIconAnchor=new GPoint(5,10);
		
		//homebase icon
			//man, woman,gender no public
		var imageFile='';
		if(homeBaseJsonData.Section=="男性"){
			imageFile="img/homebase_marker_man.gif";
		} else if(homeBaseJsonData.Section=="女性"){
			imageFile="img/homebase_marker_woman.gif";
		} else {
			imageFile="img/homebase_marker_nopublic.gif";
		}
		
		var homeBaseIcon=new GIcon(G_DEFAULT_ICON,imageFile);
		homeBaseIcon.iconSize=myIconSise;
		homeBaseIcon.shadowSize=myShadowSize;
		homeBaseIcon.iconAnchor=myIconAnchor;
		
		//marker
		globalHomeBaseMarker=new GMarker(mylatlng,homeBaseIcon,true);
		map.addOverlay(globalHomeBaseMarker);
		
		map.setCenter(mylatlng);
		
		var myAreaData=new Array();
		for(var i=0,n=homeBaseJsonData.AreaLatLng.length; i<n; i++){
			var latitude	=homeBaseJsonData.AreaLatLng[i].Latitude;
			var longitude	=homeBaseJsonData.AreaLatLng[i].Longitude;
			var mylatlng	=new GLatLng(latitude,longitude);
			myAreaData.push(mylatlng);
		}
		myAreaData.push(myAreaData[0]);
		
		var strokeColor	='#ff66ff';
		var strokeWeight=2;
		var strokeOpacity=1;
		
		globalFriendHomeBase=new GPolygon(myAreaData,strokeColor,strokeWeight,strokeOpacity);
		map.addOverlay(globalFriendHomeBase);
	}
}

function HomeBase_Frame_Show_VTwo(homeBaseJsonData){
	//highLight polygon
	var mylatlng=new GLatLng(homeBaseJsonData.CenterLatitude,homeBaseJsonData.CenterLongitude);
	
	//icon common setting
	myIconSise	=new GSize(9,13);
	myShadowSize=new GSize(15,15);
	myIconAnchor=new GPoint(5,10);
	
	//homebase icon
		//man, woman,gender no public
	var imageFile='';
	if(homeBaseJsonData.Section=="男性"){
		imageFile="img/homebase_marker_man.gif";
	} else if(homeBaseJsonData.Section=="女性"){
		imageFile="img/homebase_marker_woman.gif";
	} else {
		imageFile="img/homebase_marker_nopublic.gif";
	}
	
	var homeBaseIcon=new GIcon(G_DEFAULT_ICON,imageFile);
	homeBaseIcon.iconSize=myIconSise;
	homeBaseIcon.shadowSize=myShadowSize;
	homeBaseIcon.iconAnchor=myIconAnchor;
	
	//marker
	var localHomeBaseMarker=new GMarker(mylatlng,homeBaseIcon,true);
	map.addOverlay(localHomeBaseMarker);
	
	map.setCenter(mylatlng);
	
	var myAreaData=new Array();
	for(var i=0,n=homeBaseJsonData.AreaLatLng.length; i<n; i++){
		var latitude	=homeBaseJsonData.AreaLatLng[i].Latitude;
		var longitude	=homeBaseJsonData.AreaLatLng[i].Longitude;
		var mylatlng	=new GLatLng(latitude,longitude);
		myAreaData.push(mylatlng);
	}
	myAreaData.push(myAreaData[0]);
	
	var strokeColor	='#ff66ff';
	var strokeWeight=2;
	var strokeOpacity=1;
	
	var localFriendHomeBase=new GPolygon(myAreaData,strokeColor,strokeWeight,strokeOpacity);
	map.addOverlay(localFriendHomeBase);
	var obj={'Marker':localHomeBaseMarker, 'Frame':localFriendHomeBase}
	return obj;
}

function FrameAndMarkerAndEffect_Clear(){
	//ホームベースのエフェクトを消去
	
	/* FireBug */ if(window.console){console.debug("ホームベースオブジェクト削除");}
	
	//effect
	if(overrideArea){
		/* FireBug */ if(window.console){console.debug("塗りつぶし削除");}
		map.removeOverlay(overrideArea);
		overrideArea=null;
	}
	
	// homebase marker
	if(globalHomeBaseMarker){
		/* FireBug */ if(window.console){console.debug("マーカー削除");}
		map.removeOverlay(globalHomeBaseMarker);
		globalHomeBaseMarker=null;
	}
	
	// homebase friend communitymenber
	if(globalFriendHomeBase){
		/* FireBug */ if(window.console){console.debug("フレーム削除");}
		map.removeOverlay(globalFriendHomeBase);
		globalFriendHomeBase=null;
	}
	
	//1行コメント表示
	OneLine_list();
}

function MarkerClick_Highlight_Leftmenu(theID,theBodyType,count){
	//マーカーのクリックに合わせて左メニューをハイライト
	
	var retFlg=false;
	globalHighlightedHomebaseID=(theBodyType=='homeBase') 	? theID : null;
	globalHighlightedCommunityID=(theBodyType=='community')  ? theID : null;
	
	//leftmenu page change
	if(count){
		if(tabControl==0 && theBodyType=='homeBase'){
			
			homebase_list(null,null,null,null,null,null,null,parseInt(count/10));
		} else if(tabControl==1 && theBodyType=='community'){
//			globalHighlightedCommunityID=theID;
			community_list(null,null,null,null,null,parseInt(count/10));
		}
	}
	
	var trNode=document.getElementById(theBodyType + '_' + theID);
	if(trNode){
		retFlg=true;
		
		//ハイライトダウン
		Hightlight_Down();
		
		//coloring
		var tdNodes=trNode.getElementsByTagName("td");
		for(var i=0,n=tdNodes.length; i<n; i++){
			var myColor=(theBodyType=='homeBase') ? '#ffccff' : '#bbffbb';
			tdNodes[i].style.backgroundColor=myColor;
		}
	}
	
	return retFlg;
}

function Highlight_Leftmenu_Continue(){
	//左メニューのハイライトはドラッグ及びズームしたときでも継続
	
	//infowindow highlight
	if(globalHighlightedHomebaseID){
		/* FireBug */ if(window.console){console.debug("globalHighlightedCommunityID: " +globalHighlightedHomebaseID);}
		for(var i=0,n=globalHomebase_IDCount.length; i<n; i++){
			if(globalHomebase_IDCount[i].ID==globalHighlightedHomebaseID){
				MarkerClick_Highlight_Leftmenu(globalHomebase_IDCount[i].ID,'homeBase',globalHomebase_IDCount[i].Count)
				break;
			}
			
		}
	}
	
	if(globalHighlightedCommunityID){
		for(var i=0,n=globalCommunity_IDCount.length; i<n; i++){
			if(globalCommunity_IDCount[i].ID==globalHighlightedCommunityID){
				MarkerClick_Highlight_Leftmenu(globalCommunity_IDCount[i].ID,'community',globalCommunity_IDCount[i].Count)
				break;
			}
		}
	}
}

function Hightlight_Down(leftmenuFlg){
	//右メニューカラーリング
	var rightMenuMemberBody=document.getElementById('rightMenuMemberBody');
	if(rightMenuMemberBody){
		var tdNodes=rightMenuMemberBody.getElementsByTagName('td');
		for(var i=0,n=tdNodes.length; i<n; i++){
			tdNodes[i].style.backgroundColor="#ffffff";
		}
	}
	
	var rightMenuRequestedMember=document.getElementById('rightMenuRequestedMember');
	if(rightMenuRequestedMember){
		var tdNodes=rightMenuRequestedMember.getElementsByTagName('td');
		for(var i=0,n=tdNodes.length; i<n; i++){
			tdNodes[i].style.backgroundColor="#ffffff";
		}
	}

	if(leftmenuFlg){
		// no process
	} else {
		//左メニューカラーリング
		var leftmenuBody=document.getElementById("leftmenuBody");
		if(leftmenuBody){
			var tds=leftmenuBody.getElementsByTagName('td');
			for(var i=0,n=tds.length; i<n; i++){
				tds[i].style.backgroundColor="#f0f0f0";
			}
		}
		
		//マイページ左メニューバックグラウンドハイライト1
		var communityListTbody=document.getElementById('communityListTbody');
		if(communityListTbody){
			var tdNodes=communityListTbody.getElementsByTagName('td');
			for(var i=0,n=tdNodes.length; i<n; i++){
				tdNodes[i].style.backgroundColor="#f0f0f0";
			}
		}
		
		//マイページ左メニューバックグラウンドハイライト2
		var communityJoinBodyTbody=document.getElementById('communityJoinBodyTbody');
		if(communityJoinBodyTbody){
			var tdNodes=communityJoinBodyTbody.getElementsByTagName('td');
			for(var i=0,n=tdNodes.length; i<n; i++){
				tdNodes[i].style.backgroundColor="#f0f0f0";
			}
		}
	}
}

function areaMakerEventAttach(areaID,mymarker,homeBaseCount){
	var onclick_func=function(){
			var retValue=areaMarker_click(areaID,null,null,homeBaseCount);
	}
	GEvent.addListener(mymarker,'click',onclick_func);
}

function communityMarker_EventAttach(communityID,mymarker,communityCount){
	var onclick_func=function(){
			community_window_open(communityID,null,communityCount);
	}
	GEvent.addListener(mymarker,'click',onclick_func);
}

function areaModifyForm_show(theAreaID){
	map.closeInfoWindow();
	
	//homebase frame and effect show
	var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	
	//get form
	var html=innerHTML_getAndReturn('inner_area_modify_form.html','ActnicheCommunity_AreaID',theAreaID);
	
	//get center lat lng
	//var areaData=json_get('json_area_view.html','ActnicheCommunity_AreaID',theAreaID);
	var mylatlng=new GLatLng(areaData.CenterLatitude,areaData.CenterLongitude);
	
	
	//highLight polygon
	var effectObj=polygon_effect_override_VTwo(areaData,null);
	
	//high lise homebase frame
	var obj=HomeBase_Frame_Show_VTwo(areaData);
	var opt={
		"onCloseFn":function(){
			if(globalOneLineListFlg==true){
				ClearObjAndOneLineRestart(effectObj,obj);
				TimerOfOneLine_Clear();
				OneLine_list();
			} else {
				globalOneLineListFlg=true;
			}
		}
	}
	
	map.openInfoWindowHtml(mylatlng,html,opt);
}

function areaModifyForm_Submit(theForm){
	//エリア情報変更
	
	moveFlag=false;
	
	//input value check
	if(theForm.ActnicheCommunity_AreaName.value==0){
		alert("エリア名が未入力です。");
		return;
	}
	
	// check ItemName and ItemValue
	var eleLen=theForm.elements['Actniche_ItemName[]'].length;
	for(var i=0; i < eleLen; i++){
		if(theForm.elements['Actniche_ItemName[]'][i].value.length==0 && theForm.elements['Actniche_ItemValue[]'][i].value.length > 0){
			alert("項目名が未入力です。");
			return false;
		} else if(theForm.elements['Actniche_ItemName[]'][i].value.length > 0 && theForm.elements['Actniche_ItemValue[]'][i].value.length == 0){
			alert("項目値が未入力です。");
			return false;
		}
	}
	
	//make queryString
	var postData =		encodeURIComponent('ActnicheCommunity_AreaName')+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaName.value);
		postData+='&' +	encodeURIComponent('ActnicheCommunity_AreaID')	+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaID.value);
		postData+='&' +	encodeURIComponent('ActnicheCommunity_AreaComment')+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaComment.value);
		postData+='&' +	encodeURIComponent('ActnicheCommunity_AreaURL')	+'='+encodeURIComponent(theForm.ActnicheCommunity_AreaURL.value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][0].value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][1].value);
		postData+='&' +	encodeURIComponent('Actniche_DisplayNo[]')		+'='+encodeURIComponent(theForm.elements['Actniche_DisplayNo[]'][2].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemName[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemName[]'][2].value);
		postData+='&' +	encodeURIComponent('Actniche_ItemValue[]')		+'='+encodeURIComponent(theForm.elements['Actniche_ItemValue[]'][2].value);
		postData+='&' +	encodeURIComponent('AreaModifyForm')			+'='+encodeURIComponent("value");
	
//		for(var i=0; i<areaLatLngs.length; i++){
//			postData+='&' + encodeURIComponent('ActnicheCommunity_Latitude[]') + '=' + encodeURIComponent(areaLatLngs[i].lat()) + '&' +encodeURIComponent('ActnicheCommunity_Longitude[]') + '=' + encodeURIComponent(areaLatLngs[i].lng());
//		}
	
	//tag
	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);
		
	//infowindow lat lng
	var latitude =theForm.Latitude.value;
	var longitude=theForm.Longitude.value;
	var mylatlng=new GLatLng(latitude,longitude);
	
	//submit	
	var resHtml=innerHTML_PostAndReturn('inner_area_modify.html',postData);
	
	//infowindow open
	map.openInfoWindowHtml(mylatlng,resHtml);

}

function area_delete(theAreaID,theAreaName,theCenterLongitude,theCenterLatitude){
	//エリア情報削除
	
	map.closeInfoWindow();
	
	var postdata =encodeURIComponent("ActnicheCommunity_AreaID")		+"="	+encodeURIComponent(theAreaID);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaName")	+"="	+encodeURIComponent(theAreaName);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_AreaAvailable")	+"="	+encodeURIComponent("False");
		postdata+="&"+encodeURIComponent("AreaModifyForm")					+"="	+encodeURIComponent("value");

	var html=innerHTML_PostAndReturn('inner_area_modify.html',postdata);
	
	var mylatlng=new GLatLng(theCenterLatitude,theCenterLongitude);
	var opt={
		"onCloseFn":function(){
			if(globalOneLineListFlg==true){
				TimerOfOneLine_Clear();
				OneLine_list();
			} else {
				globalOneLineListFlg=true;
			}
		}
	}
	map.openInfoWindowHtml(mylatlng,html,opt);
	
	//スポット,エリア取得
	//moveView(1);
	
	//レフトメニュー変更
	//leftmenu_change();
	
	//ボタン
//	if(tabControl==0){
		button_make('HomeBase_Create','dummy');
//	}

	//マップBottom
	innerHTML_get('communityInfo','inner_mypage_bottom.html');
	

}

function area_picturemail_send(theForm){
	//エリア写真送付
	
	//areaPhotoID
	var areaPhotoID="";
	if(theForm.Actniche_AreaPhotoID.length){
		for(var i=0; i<theForm.Actniche_AreaPhotoID.length; i++){
			if(theForm.Actniche_AreaPhotoID[i].checked){
				areaPhotoID=theForm.Actniche_AreaPhotoID[i].value;
			}
		}
	} else {
		if(theForm.Actniche_AreaPhotoID.checked){
			areaPhotoID=theForm.Actniche_AreaPhotoID.value;
		}
	}

	
	var url ="picturemailsend_form.html";
		url+="?Actniche_PhotoID=dummy";
		url+="&Actniche_AreaPhotoID="+areaPhotoID;
	window.open(url,'new_spot','width=640,height=360,resizable=yes,scrollbars=yes');

}

function button_make(theButtonType,theReturnType){
	//ボタン作成
	
	//make query
	var postdata =encodeURIComponent("Actniche_Button")				+"="	+encodeURIComponent(theButtonType);
		postdata+="&"+encodeURIComponent("Actniche_ReturnButton")	+"="	+encodeURIComponent(theReturnType);
	
	//get file
	innerHTML_Update_Post('buttonArea','inner_polygon_create_btn.html',postdata);
	
	
	//エフェクト
	if(theButtonType=='Stop'){
		//ポリゴン作成開始
		map.closeInfoWindow();
		
		//clear overlays
		map.clearOverlays();
		
//		var point=map.getCenterLatLng();
//		var spanLatLng=map.getSpanLatLng();
//		//lat lng boundary
//		var theLatLngBounds=map.getBounds();
//		var northEastLatlng=theLatLngBounds.getNorthEast();
//		var southWestLatlng=theLatLngBounds.getSouthWest();
//		
//		var topLat		=northEastLatlng.lat();
//		var rightLng	=northEastLatlng.lng();
//		var bottomLat	=southWestLatlng.lat();
//		var leftLng		=southWestLatlng.lng();
//		
//		//spot list (chekcbox)
//		if(document.DataShowControlForm){
//			if(document.DataShowControlForm.DataShow[3].checked){
//				// limit number of spot
//				for(var i=0,n=document.DataShowControlForm.Actniche_DataRows.options.length; i<n; i++){
//					if(document.DataShowControlForm.Actniche_DataRows.options[i].selected){
//						//get spot
//						get_point_data(point.x, point.y, parseFloat(spanLatLng.width), 1, topLat,rightLng,bottomLat,leftLng,document.DataShowControlForm.Actniche_DataRows.options[i].value);
//						break;
//					}
//				}
//			}
//		}
		
		//イベント設定
//		GEvent.clearListeners(map,"moveend");
		clearEventListener();
		addEventListener_ForArea(theReturnType);
		
	} else if(theReturnType=='Cancel'){
		//ポリゴン作成中止
		
		//ポリゴン消去
		LineMarker_All_Delete(true);
		
		//イベント設置
		clearEventListener();
//		addEventListener_ForTop();
//		moveView(1);
	}
}

function tagid_push(theTagID,node){
	//タグIDをグローバル変数に登録
	globalTagID=theTagID;
	
	var tagStringArea=document.getElementById('tagStringArea');
	//no tag
	if( !(tagStringArea) ){
		return;
	}
	var spanNodes=tagStringArea.getElementsByTagName('span');
	var tagAllScreen=document.getElementById('tagAllScreen');
	
	//全表示
	if(globalTagID==0){
		//全画面文字列-非表示
		tagAllScreen.style.display="none";
		
		if(spanNodes){
			for(var i=0,n=spanNodes.length; i<n; i++){
				spanNodes[i].style.color=(tabControl==0) ? '#ff66ff' : '#006600';
				spanNodes[i].style.fontWeight="normal";
			}
		}
	} else {
		//全画面文字列-表示
		tagAllScreen.style.display="inline";
		
		//非選択タグエフェクト
		if(spanNodes){
			for(var i=0,n=spanNodes.length; i<n; i++){
				spanNodes[i].style.color="#666666";
				spanNodes[i].style.fontWeight="normal";
			}
		}
		
		//選択タグエフェクト
		node.style.color=(tabControl==0) ? '#ff66ff' : '#006600';
		node.style.fontWeight="bold";
	}
}

function tag_underline(theTagObj){
	//タグIDに基づきアンダーラインを引く
//	alert(theTagList.length);
//	if(theTagList.length){
//		for(var i=0, n=theTagList.length; i<n; i++){
//			var tagNode=document.getElementById("tagID_" + i);
//			if(tagNode){
//				if(theTagList[i] >0){
//					tagNode.style.textDecoration="none";
//					tagNode.style.fontWeight	="normal";
//				} else {
//					tagNode.style.display="none";
//				}
//			}
//		}
//	}
//	var tagFrequency=new Array();
//	for(prop in theTagObj){
//		/* FireBug */ if(window.console){console.debug(prop);}
//		tagFrequency.push(theTagObj[prop]);
//	}
//	
//	tagFrequency.sort(actniche_max);
//	var maxFrequency=tagFrequency[0];
//	
//	for(prop in theTagObj){
//		var tagNode=document.getElementById(prop);
//		if(tagNode){
//			var candicate=(theTagObj[prop]/maxFrequency)*1.5;
//			tagNode.style.fontSize=(candicate > 0.8 ? candicate : 0.8) + 'em';
//		}
//	}
}
function actniche_max(a,b){
	return b-a;
}

function profile_show_toggle(theNode){
	if(theNode.checked){
	
	} else {
		document.getElementById('communityInfo').innerHTML="";
	}
}

function spot_add_form_show(theForm){
	var url ="spot_form.html?";
		url+="func="				+	encodeURIComponent(theForm.func.value);
		url+="&Actniche_Longitude="	+	encodeURIComponent(theForm.Actniche_Longitude.value);
		url+="&Actniche_Latitude="	+	encodeURIComponent(theForm.Actniche_Latitude.value);
	window.open(url,'new_spot','width=540,height=650,resizable=yes');
}

function diary_add_submit(theForm){
	//日記(トピック)書き込み
	
	//input value check
	var errorMessage='';
	errorMessage+=theForm.BBS_Subject.value.length >0 ? '' : 'タイトルが未入力です。';
	errorMessage+=theForm.BBS_Body.value.length >0 ? '' : '本文が未入力です。';
	
	if(errorMessage.length==0){
		//make query
		var postdata =encodeURIComponent("BBS_Subject")				+"="	+encodeURIComponent(theForm.BBS_Subject.value);
			postdata+="&"+encodeURIComponent("BBS_Body")			+"="	+encodeURIComponent(theForm.BBS_Body.value);
			postdata+="&"+encodeURIComponent("diaryAddForm")		+"="	+encodeURIComponent("dummy");
		
		//request
		var jsonData=json_postWithQueryString('json_diary_add.html',postdata);
		
		//error check
		errorMessage+=jsonData.Message_01 ? jsonData.Message_01 : '';
		errorMessage+=jsonData.Message_02 ? jsonData.Message_02 : '';
		errorMessage+=jsonData.Message_03 ? jsonData.Message_03 : '';
		errorMessage+=jsonData.Message_04 ? jsonData.Message_04 : '';
		errorMessage+=jsonData.Message_05 ? jsonData.Message_05 : '';
	}
	
	//view
	var diaryAddMessage=document.getElementById('diaryAddMessage');
	if(errorMessage.length>0){
		diaryAddMessage.style.display='block';
		diaryAddMessage.innerHTML=errorMessage;
	} else if(jsonData.Success){
		//update mypage bottom
		Profile_Friend_View();
		var diaryAddMessage=document.getElementById('diaryAddMessage');
		diaryAddMessage.style.display='block';
		diaryAddMessage.innerHTML=jsonData.Success;
	} else {
		diaryAddMessage.innerHTML='Error';
	}
	
	setTimeout(diaryAddMessageClose,2500);
}

function diaryAddMessageClose(){
	parts_close('diaryAddMessage');
}

function diaryAdd_form(theUserID){
	var url="diary_add_form.html";
	window.open(url,'new_win','width=540,height=350,resizable=yes');
}
function diary_view(theMessageID,theParentMessageID,thePage){
	//日記全文表示
	
	//make query
	var postdata =encodeURIComponent("BBS_Message_ID")				+"="	+encodeURIComponent(theMessageID);
		postdata+="&"+encodeURIComponent("BBS_Parent_Message_ID")	+"="	+encodeURIComponent(theParentMessageID);
		postdata+="&"+encodeURIComponent("BBS_Page")				+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_diary_view.html',postdata);
}

function diaryResponseAdd_Submit(theForm){
	//日記コメント投稿
	
	//make query
	var postdata =encodeURIComponent("BBS_Message_ID")		+"="	+encodeURIComponent(theForm.BBS_Message_ID.value);
	 	postdata+="&"+encodeURIComponent("BBS_Parent_Message_ID")	+"="	+encodeURIComponent(theForm.BBS_Parent_Message_ID.value);
		postdata+="&"+encodeURIComponent("BBS_Subject")		+"="	+encodeURIComponent(theForm.BBS_Subject.value);
		postdata+="&"+encodeURIComponent("BBS_Body")		+"="	+encodeURIComponent(theForm.BBS_Body.value);
		postdata+="&"+encodeURIComponent("diaryAddSubmit")	+"="	+encodeURIComponent(theForm.diaryAddSubmit.value);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_diary_response_add.html',postdata);
}

function diarytopic_read_more(theParentMessageID,thePage){
	
	var postdata =encodeURIComponent("BBS_Message_ID")		+"="	+encodeURIComponent(theParentMessageID);
		postdata+="&"+encodeURIComponent("BBS_Page")		+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_diarytopic_read_more.html',postdata);
}

function closeInfowWindowfunction(){
	map.closeInfoWindow();
}

function closeInfowWindowfunction_attach(){
	var theInfoWindow=map.getInfoWindow();
	GEvent.clearListeners(theInfoWindow,'closeclick');
	GEvent.addListener(theInfoWindow,'closeclick',function(){
		map.closeInfoWindow();
	});
}

function checkboxControl(theCheckBoxNo){
	//index.html上部のチェックボックス
	
	if(tabControl==0){	//homebase tab
		globalCheckBox.homebase[theCheckBoxNo]	=document.DataShowControlForm.DataShow[theCheckBoxNo].checked;
	} else if(tabControl==1){
		globalCheckBox.community[theCheckBoxNo]	=document.DataShowControlForm.DataShow[theCheckBoxNo].checked;
	} else if(tabControl==2){
		globalCheckBox.mypage[theCheckBoxNo]	=document.DataShowControlForm.DataShow[theCheckBoxNo].checked;
	}
}

function Friend_Approve(theAddressID,approveFlag){
	//友人の承認否認
	
	var approve= approveFlag ? 2 : 1;
	
	//make query
	var postdata =encodeURIComponent("Actniche_AddressBook_AddressID")	+"="	+encodeURIComponent(theAddressID);
		postdata+="&"+encodeURIComponent("Actniche_ToUser_Status")		+"="	+encodeURIComponent(approve);
		
	//file get
	//innerHTML_Update_Post('rightMenuMiddle','inner_friend_applied_action.html',postdata);
	var html=innerHTML_PostAndReturn('inner_friend_applied_action.html',postdata);
	document.getElementById('requestedFriendList').innerHTML=html;
}
function Friend_List_Page_Change(theUserID,thePage){
	//友人ページ処理
	
	//make query
	var quarydata =encodeURIComponent("Actniche_AddressBook_UserID")	+"="	+encodeURIComponent(theUserID);
		quarydata+="&"+encodeURIComponent("Actniche_Address_Page")		+"="	+encodeURIComponent(thePage);
	
	innerHTML_getWithMultiQuery('approvedFriendList','include_friend_approved_list.html',quarydata);
}

function Friend_Requested_Page_Change(thePage){
	//友人受け取りページ処理
	innerHTML_get('requestedFriendList','include_friend_requested_list.html','Actniche_Address_Page',thePage);
}

function Friend_Requesting_Page_Change(thePage){
	//友人受け取りページ処理
	innerHTML_get('requestingFriendList','include_friend_requesting_list.html','Actniche_Address_Page',thePage);
}

function friend_mypagebottom_read_more(theUserID,thePage){
	//友人一覧(マイページ下部) ページ管理
	
	var postdata =encodeURIComponent("Actniche_AddressBook_UserID")	+"="	+encodeURIComponent(theUserID);
	postdata+="&"+encodeURIComponent("Actniche_Address_Page")		+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_friendlist_mypagebottom_read_more.html',postdata);

}

function community_host_mypagebottom_read_more(theUserID,thePage){
	//主催コミュニティ(mypage下部) ページ処理
	
	//make query
	var postdata =encodeURIComponent("Login_UID")						+"="	+encodeURIComponent(theUserID);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_InfoPage")	+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_community_host_mypagebottom_read_more.html',postdata);
}

function community_member_mypagebottom_read_more(theUserID,thePage){
	//主催コミュニティ(mypage下部) ページ処理
	
	//make query
	var postdata =encodeURIComponent("Login_UID")							+"="	+encodeURIComponent(theUserID);
		postdata+="&"+encodeURIComponent("ActnicheCommunity_MemberPage")	+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityInfo','inner_community_member_mypagebottom_read_more.html',postdata);
}

function community_host_mypageleft_read_more(theUserID,thePage){
	var postdata =encodeURIComponent("Login_UID")						+"="	+encodeURIComponent(theUserID);
	postdata+="&"+encodeURIComponent("ActnicheCommunity_InfoPage")		+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityListTbody','inner_mypage_left_community_host.html',postdata);
}

function community_member_mypageleft_read_more(theUserID,thePage){
	var postdata =encodeURIComponent("Login_UID")						+"="	+encodeURIComponent(theUserID);
	postdata+="&"+encodeURIComponent("ActnicheCommunity_MemberPage")		+"="	+encodeURIComponent(thePage);
	
	//file get
	innerHTML_Update_Post('communityJoinBodyTbody','inner_mypage_left_community_member.html',postdata);
}

