//グローバル変数として定義
var GMap_start_date , 
GMap_import_flag , 
GMap_import_count , 
GMap_focus_category , 
GMap_import_current_file , 
GMap_apiversion;
var GMap_category = {};  
var GMap_item = {};
var GMap_narrowCondition = {};  
var GMap_marker = {};  
var GMap_current_marker = {};  
var GMap_template = {};

//参照用変数
var GMap__ua			= {};		//UserAgent（ex. GMap__ua.Firefox = [true|false] ）
var GMap__title		= "";

//設定値の初期値
var GMap_import_file			= "";
var GMap_import_path			= "";
var GMap_import_cache			= 0;
var GMap_import_maxItems		= Infinity;
var GMap_import_maxCategorys	= Infinity;

var GMap_image_path		= "./img/";


var GMap_debug_mode 		= 0;

var GMap_default_lng  	= 140.163816;
var GMap_default_lat  	= 35.42237;
var GMap_default_zoom 	= 9;
var GMap_default_type		= "map";
var GMap_default_category	= "";
var GMap_default_item		= "";
var GMap_default_sort		= "";

var GMap_zmarking				= 1;
var GMap_zmarking_separate	= "<hr style=\"width:200px;\" />";

var GMap_control_zoom					= 1;
var GMap_control_type					= 0;
var GMap_control_scale				= 1;
var GMap_control_overviewMap			= 0;
var GMap_control_overviewMap_width	= 125;
var GMap_control_overviewMap_height	= 125;

var GMap_item_name		= "アイテム";

var GMap_itemNavi_page_items		= 0;
var GMap_itemNavi_countColumn		= 0;
var GMap_itemNavi_rowStrips		= 0;
var GMap_itemNavi_thirdRow		= "message";

var GMap_category_name			= "カテゴリ";
var GMap_category_autoCentering	= 0;
var GMap_category_all				= 0;
var GMap_category_all_label		= "すべて表示&nbsp;&nbsp;（若干時間がかかります） ";
var GMap_category_map				= 0;
var GMap_category_map_label		= "マップ内の%item_name%を表示";

var GMap_infoWindow_tab					= "";
var GMap_infoWindow_tab_defaultVisible	= 1;
var GMap_infoWindow_func_moveCenter		= 0;
var GMap_infoWindow_func_zoomDetail		= 0;

var GMap_html_categoryNavi					= "";
var GMap_html_itemNavi						= "";
var GMap_html_itemNavi_autoZoom				= "";
var GMap_html_googleLocal						= "";
var GMap_html_search_itemName_textField		= "";
var GMap_html_search_message					= "";
var GMap_html_mapInfo_url						= "";
var GMap_html_mapInfo_point					= "";
var GMap_html_googleMap						= "map";
var GMap_html_debug							= "";

var GMap_link_type	= 1;

var GMap_marker_key				= "icon";
var GMap_marker_center_adjust_x	= 0;
var GMap_marker_center_adjust_y	= 0;

var GMap_mapInfo_point_format					= "%lat% ／ %lng%";
var GMap_mapInfo_point_base					= 60;
var GMap_mapInfo_point_base10_decimalDigit	= 5;
var GMap_mapInfo_point_base60_decimalDigit	= 2;
var GMap_mapInfo_point_base60_language		= "jp";
var GMap_mapInfo_point_enableType				= "category,item,location";

var GMap_search_dic_synonym			= "";
var GMap_search_narrow_message		= 1;
var GMap_search_geocoding				= 1;
var GMap_search_geocoding_joinPrefix	= "";

var GMap_design_mapLiquidWidth	=    0;
var GMap_design_mapLiquidHeight	=    0;

var GMap_limit_dragging			=    0;
var GMap_limit_zoomByMouseWheel	=    0;
var GMap_limit_operateByKeyboard	=    0;
var GMap_limit_zoom_max			=   99;
var GMap_limit_zoom_min			=    0;
var GMap_limit_lng_max			=  180;
var GMap_limit_lng_min			= -180;
var GMap_limit_lat_max			=   90;
var GMap_limit_lat_min			=  -90;
var GMap_limit_urlArgument		=    0;
var GMap_limit_userMessage		=    0;

var _zMarker = "";

GMapDefine();
//--------------------------------------------------------------------------------------------------
//□定義
function GMapDefine(){
	//ユーザーエージェントを設定
	var ua = navigator.userAgent;
	if( ua.match( /Opera[\/\s]([0-9]\.[0-9]+)/ )				){ GMap__ua.Opera		= parseFloat( RegExp.$1 ); } else { GMap__ua.Opera	= 0; }
	if( ua.match( /MSIE ([0-9]\.[0-9]+)/ ) && !GMap__ua.Opera ){ GMap__ua.MSIE		= parseFloat( RegExp.$1 ); } else { GMap__ua.MSIE		= 0; }
	if( ua.match( /Firefox[\/\s]([0-9]\.[0-9]+)/ )				){ GMap__ua.Firefox	= parseFloat( RegExp.$1 ); } else { GMap__ua.Firefox	= 0; }
	if( ua.match( /Netscape[0-9]?[\/\s]([0-9]\.[0-9]+)/ )		){ GMap__ua.Netscape	= parseFloat( RegExp.$1 ); } else { GMap__ua.Netscape	= 0; }
	if( ua.match( /Safari/ )									){ GMap__ua.Safari	= 1;					   } else { GMap__ua.Safari	= 0; }
	GMap__ua.Gecko = ( ua.match( /Netscape|Firefox/ ) ? true : false );
    
	window.onload   = GMapInit;		//マップ初期化イベントの定義
}
//--------------------------------------------------------------------------------------------------
//□初期化
function GMapInit(){
	if( GMap_debug_mode ){ GMap_start_date = new Date(); }						//デバッグ：スタート時間を記録

	//APIのバージョンの取得（たぶんもっとスマートな方法があると思う）
	GMap_apiversion = ( typeof( G_NORMAL_MAP ) == "object" ? 2 : 1 );
	if( GMap_apiversion == 1 ){ return GMapCommon.Error.trigger( "本バージョンの GMap は Google Maps API Ver2 でのみ動作します。\nGoogle の APIキーを入力する所の v=1 を v=2 にして下さい。" , 0 , 3 ); }

	//HTMLの初期化処理及び、非マップ環境の場合は終了
	if( !GMap_import_flag && !GMapInit_html() ){ return; }

	//URLに引数がある場合
	if( location.search ){ GMapInit_procUrlArgument(); }

	//XMLファイルからデータをインポート（読み込みが完了するまで停止）
	if( ( GMap_import_file || GMap_import_current_file ) && !GMap_import_flag ){
		if( !GMap_import_current_file ){ GMap_import_current_file = GMap_import_file; }
		GMapCommon.XML.include( GMap_import_path + GMap_import_current_file , GMapInit_import );  return;
	}

	//カテゴリに特殊カテゴリを追加
	GMapDataCategory( "_all" , "-" );		//「すべて表示」の追加
	GMapDataCategory( "_map" , "-" );		//「マップ内のアイテムを表示」を追加

	//コールバック
	GMapEX.callback( this , arguments );

	//フォーカスカテゴリのセット
	if(      GMap_default_category && GMap_category[ GMap_default_category ] ){ GMap_focus_category = GMap_default_category; }							//通常処理
	else if( GMap_default_item     && GMap_item[     GMap_default_item     ] ){ GMap_focus_category = GMap_item[ GMap_default_item ].category; }		//デフォルトアイテム指定
	else																			{ GMap_focus_category = GMapCommon.Array.keys( GMap_category )[ 2 ]; }	//それでもダメな場合、最初のカテゴリにする（0は_all、1は_map）

	//オブジェクトを初期化
	var GMapMapInitResult = GMapMap.init();
	GMapCategoryNavi.init();
	GMapItemNavi.init();
	GMapSearch.init();
	GMapSort.init();

	//アイコンのデフォルト値が未定義の場合定義する
	if( !GMap_marker[ "_default" ] ){ GMapDataMarker( "_default" , "./img/g.png" , "img/shadow50.png" , "," ,   20 , 34   ,   37 , 34   ,    9 , 34   ,   9 , 2 ); }

	//特定マーカーアイコン棟数101～
	GMapDataMarker("A3","./img/second/company/map_icon.png","","," ,   90 , 98 , 90 , 98 , 45 , 98 , 45 , 2 ); 

	//特定マーカーアイコン棟数50～99
	GMapDataMarker("A2","./img/second/company/map_icon_2.png","","," ,   60 , 68 , 60 , 68 , 30 , 68 , 30 , 2 ); 

	//特定マーカーアイコン棟数１～49
	GMapDataMarker("A1","./img/second/company/map_icon_3.png","","," ,   40 , 48 , 40 , 48 , 20 , 48 , 20 , 2 ); 

	//センターマーカーが定義されている場合、センターマーカーを作成する
	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].marking(); }

	//マップ情報の表示
	if( GMap_html_mapInfo_point ){ GMapInfo.dispPoint( GMapMapInitResult.defaultPoint.x , GMapMapInitResult.defaultPoint.y ); }

	//特殊カテゴリのラベルを設定
	if( GMap_category_all ){ GMap_category[ "_all" ].name = GMap_category_all_label; }
	if( GMap_category_map ){ GMap_category[ "_map" ].name = GMap_category_map_label.replace( "%item_name%" , GMap_item_name ); }

	//初期カテゴリに移動	（初期のカテゴリ変更は既に移動済みの為、移動をオフにしておく
	if( !GMap_focus_category ){ GMap_focus_category = GMapInit_getDefaultCategory(); }	//初期カテゴリ取得を試みる
	if( GMap_focus_category ){ GMap_category[ GMap_focus_category ].change( "MOVE:off INIT" ); }

	//カテゴリナビゲーションの設置
	GMapCategoryNavi.create();

	//初期メッセージが存在する場合、表示させる
	var temp_message = GMapCommon.Variable.getTempValue( "urlArgumentUserMessage" );
	if( temp_message ){
		var layoutSize = GMapCommon.HTML.getLayoutSize( temp_message );
		GMapMap.gmap.openInfoWindowHtml( GMapMapInitResult.defaultPoint , "<div class=\"gmap--infoWindow-userMessage\" style=\"width: " + layoutSize.width + "px;  height: " + layoutSize.height + "px;\">" + temp_message + "</div>" );
	}

	//初期化終了処理
	GMapInit_finish();
}
//□初期化終了処理
function GMapInit_finish(){
	GMapEX.callback( this , arguments );	 //コールバック

	//初期アイテムが存在する場合、それを開く
	if( GMap_default_item ){ GMap_item[ GMap_default_item ].openInfoWindowByItemNavi(); }

	//デバッグモードの時はタイマーを切る
	if( GMap_debug_mode ){ GMapInit_debug_timer(); }
}
//□初期化 - URL引数の処理
function GMapInit_procUrlArgument(){
	if( GMap_limit_urlArgument ){ return ; }		//制限
	var urlArgumentFlag = 0;

	//URLの引数で座標が指定されている場合（ &lng=[lng]&lat=[lat] )
	if( location.search.match( /(?=.*[&\?]lng=([0-9\.-]+))(?=.*[&\?]lat=([0-9\.-]+))/ ) ){
		GMap_default_lng  = parseFloat( RegExp.$1 );
		GMap_default_lat	= parseFloat( RegExp.$2 );
		GMap_default_category = "";  GMap_default_item  = "";							//カテゴリとアイテムをキャンセル
		urlArgumentFlag = 1;
	}

	//URLの引数でカテゴリが指定されている場合（ &category=[category_id] )
	if( location.search.match( /[&\?]category=([a-zA-Z0-9_-]+)/ ) ){
		GMap_default_category = RegExp.$1;
		GMap_default_item   = "";											//アイテムが指定されていてもキャンセル
		urlArgumentFlag = 1;
	}

	//URLの引数でアイテムが指定されている場合（ &item=[item_id] )
	if( location.search.match( /[&\?]item=([a-zA-Z0-9_\.-]+)/ ) ){
		GMap_default_item   = RegExp.$1;
		GMap_default_category = ( GMap_item[ GMap_default_item ] ? GMap_item[ GMap_default_item ].category : "" );		//カテゴリは指定したアイテムのカテゴリとする
		urlArgumentFlag = 1;
	}

	//URLの引数で尺度が指定されている場合（ &zoom=[zoom level] )
	if( location.search.match( /[&\?]zoom=([0-9]{1,2})/ ) ){
		GMap_default_zoom    = parseInt( RegExp.$1 );
		urlArgumentFlag = 1;
	}

	//URLの引数でタイプが指定されている場合（ &type=satellite )
	if( location.search.match( /[&\?]type=(map|satellite|hybrid)/ ) ){
		GMap_default_type = RegExp.$1;
		urlArgumentFlag = 1;
	}

	//URLの引数でXMLファイルが指定されている場合（ &import=hogehoge.xml )
	if( location.search.match( /[&\?]import=([0-9a-zA-Z!$%&()+,;=@\[\]^_=`{}~\.-]+)/ ) ){
		GMap_import_current_file = RegExp.$1;
		urlArgumentFlag = 1;
	}

	//ユーザーメッセージが指定されている場合（ &message=hogehoge ）
	if( location.search.match( /[&\?]message=([^&\?]+)/ ) && !GMap_limit_userMessage ){
		GMapInfo.userMessageEditor.message = RegExp.$1;
		var temp_userMessage = decodeURIComponent( RegExp.$1 );
		temp_userMessage = GMapCommon.HTML.encode( temp_userMessage );			//エンコードしてタグを無効化
		temp_userMessage = temp_userMessage.replace( "|" , "<br />" );				// | を改行に変換
		GMapCommon.Variable.setTempValue( temp_userMessage , "urlArgumentUserMessage" );
	}

	//制限のチェック
	if( GMap_default_lng < GMap_limit_lng_min || GMap_default_lng > GMap_limit_lng_max || GMap_default_lat < GMap_limit_lat_min || GMap_default_lat > GMap_limit_lat_max ){	//制限のチェック
		GMap_default_lng = ( ( [ GMap_default_lng , GMap_limit_lng_min , GMap_limit_lng_max ] ).sort() )[ 1 ];
		GMap_default_lat = ( ( [ GMap_default_lat , GMap_limit_lat_min , GMap_limit_lat_max ] ).sort() )[ 1 ];
	}
	if( GMap_default_zoom < GMap_limit_zoom_min ){ GMap_default_zoom = GMap_limit_zoom_min; }
	if( GMap_default_zoom > GMap_limit_zoom_max ){ GMap_default_zoom = GMap_limit_zoom_max; }

	//指定があった場合は、このページのURL欄にそれを写す
	if( urlArgumentFlag ){ GMapInfo.setURL( "location" ); }
}
//□初期化 - インポート処理
function GMapInit_import( xmlDoc ){
	GMapDataImportXML( xmlDoc );

	//初期化を再開する
	GMap_import_flag = 1;
	GMapInit();
}
//□初期化 - HTMLの初期化
function GMapInit_html(){
	var temp_gmap	= document.getElementById( GMap_html_googleMap );
	var insertTag	= "";
	var style_displayNone = ( !GMap__ua.Opera ? "display: none;" : "visibility: hidden;" );	//Operaはdisplayが制御できない為

	//リキッドデザインの指定がある場合
	if( GMap_design_mapLiquidWidth || GMap_design_mapLiquidHeight ){
		var windowSize = GMapCommon.HTML.getWindowSize();
		if( GMap_design_mapLiquidWidth  ){ temp_gmap.style.width  = String( windowSize.width  + GMap_design_mapLiquidWidth )  + "px"; }
		if( GMap_design_mapLiquidHeight ){ temp_gmap.style.height = String( windowSize.height + GMap_design_mapLiquidHeight ) + "px"; }
	}
	//センターマーカーがある場合、2で割り切れる数にしておく
	if( GMap_marker[ "_center" ] && temp_gmap.offsetWidth  % 2 == 1 ){ temp_gmap.style.width  = String( temp_gmap.offsetWidth  - 1 ) + "px"; }
	if( GMap_marker[ "_center" ] && temp_gmap.offsetHeight % 2 == 1 ){ temp_gmap.style.height = String( temp_gmap.offsetHeight - 1 ) + "px"; }


	//マップにメッセージを表示
	if(      typeof( GBrowserIsCompatible ) == "undefined"	){ var mapMessage = "マップをご利用になるには、インターネットに接続されている必要があります。";  var r_value = false; }
	else if( !GBrowserIsCompatible()						){ var mapMessage = "ご利用のブラウザ、環境ではマップをご利用になることはできません。";  var r_value = false; }
	else													 { var mapMessage = "読み込み中...";  var r_value = true; }
	GMapCommon.HTML.write( "GMap--map-message" , mapMessage );

	//マップ外センターマーカー
	if( GMap_marker[ "_center" ] ){
		var centerMarkert_style_icon   = "position: absolute;  z-index: 101;  width: " + GMap_marker[ "_center" ].width  + "px;  height: " + GMap_marker[ "_center" ].height  + "px;  " + style_displayNone + "  ";
		var centerMarkert_style_shadow = "position: absolute;  z-index: 100;  width: " + GMap_marker[ "_center" ].swidth + "px;  height: " + GMap_marker[ "_center" ].sheight + "px;  " + style_displayNone + "  ";
		if( GMap__ua.MSIE && GMap__ua.MSIE < 7.0 ){
			centerMarkert_style_icon   += "  filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + GMap_marker[ "_center" ].iconfile     + "',sizingmethod=image);"
			centerMarkert_style_shadow += "  filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + GMap_marker[ "_center" ].gicon.shadow + "',sizingmethod=image);"
			insertTag = "<div id=\"GMap--icon-center-outer-icon\" style=\"" + centerMarkert_style_icon + "\"></div>\n";
			if( GMap_marker[ "_center" ].gicon.shadow ){ insertTag += "<div id=\"GMap--icon-center-outer-shadow\" style=\"" + centerMarkert_style_shadow + "\"></div>\n"; }
		} else {
			insertTag = "<img id=\"GMap--icon-center-outer-icon\" src=\"" + GMap_marker[ "_center" ].iconfile + "\" width=\"" + GMap_marker[ "_center" ].width + "\" height=\"" + GMap_marker[ "_center" ].height + "\" alt=\"\"  style=\"" + centerMarkert_style_icon + "\" />\n";
			if( GMap_marker[ "_center" ].gicon.shadow ){ insertTag += "<img id=\"GMap--icon-center-outer-shadow\" src=\"" + GMap_marker[ "_center" ].gicon.shadow + "\" width=\"" + GMap_marker[ "_center" ].swidth + "\" height=\"" + GMap_marker[ "_center" ].sheight + "\" alt=\"\"  style=\"" + centerMarkert_style_shadow + "\" />\n"; }
		}
	}

	//情報バー用HTML
	var temp_css = "left: " + ( temp_gmap.offsetLeft + 10 ) + "px;  top: " + ( temp_gmap.offsetHeight - 70 ) + "px;  " + style_displayNone;
	insertTag += GMapMap.infoBar.html.replace( "%css%" , temp_css );

	//サイズ測定用HTML
	insertTag += "<div id=\"GMap--common-getlayoutsize\" style=\"position: absolute;  left: -10000px;  top: -10000px;  visibility:hidden;\"></div>\n";

	//デバッグ用HTML
	if( GMap_debug_mode ){
		GMapCommon.HTML.write( GMap_html_debug , "<div id=\"GMap--debug-point\">&nbsp;</div><div id=\"GMap--debug-timer\">&nbsp;</div>" );
		GMapCommon.HTML.setDisplay( GMap_html_debug , 1 );
	}


	//HTMLの追加（マップのあるエリア）
	if( GMap__ua.MSIE ){ temp_gmap.parentElement.innerHTML = temp_gmap.parentElement.innerHTML + insertTag; }
	else				 { temp_gmap.parentNode.innerHTML    = temp_gmap.parentNode.innerHTML    + insertTag; }


	var insertTag = "";		//ここから先は、HTMLのBODY直下のHTML

	//ポップアップの影用
	insertTag += "<div id=\"GMap--common-popupShadow\" style=\"position: absolute;  display: none;\"></div>\n";


	document.getElementsByTagName( "body" )[ 0 ].innerHTML = document.getElementsByTagName( "body" )[ 0 ].innerHTML + insertTag;


	return r_value;
}
//□初期化 - ハイブリッドが利用可能かチェックする
function GMapInit_checkHybridEnable(){
	var mapTypes = GMapMap.gmap.getMapTypes();	//タイプ一覧を取得

	//ハイブリッドが含まれているかチェック
	var result = 0;
	for( var i = 0 ; i < mapTypes.length ; i++ ){ if( mapTypes[ i ] == _HYBRID_TYPE ){ result = 1 ;  break; } }

	//ハイブリッドの場合は真を返し、でない場合hはサテライトに変換し、偽を返す
	if( result ){ return true; } else { GMap_default_type = "satellite";  return false; }
}
//□初期化 - 初期カテゴリの取得（失敗することもある）
function GMapInit_getDefaultCategory(){
	var result_array = GMapCommon.Map.getNearData( GMap_category , "all" , 1 );
	if( result_array ){ var result = result_array[ 0 ]; }
	return result;
}
//□初期化 - デバッグで時間を計る
function GMapInit_debug_timer(){
	if( GMap__ua.Firefox ){
		for ( i = 0; i < document.images.length; i++ ){	//画像が読み込まれるまでループ
			if( !document.images[ i ].complete ){ setTimeout( "GMapInit_debug_timer()" , 100 );  return ; }
		}
	}

	var GMap_end_date = new Date();
	GMapCommon.HTML.write( "GMap--debug-timer" , ( ( GMap_end_date.getTime() - GMap_start_date.getTime() ) / 1000 ) + " 秒" );
}
//--------------------------------------------------------------------------------------------------
//□マップ
var GMapMap = new function(){
	this.id								= "";
	this.gmap							= {};
    this.geocoder						= null;   
	this.inited							= 0;
	this.dummyMarker					= null;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.event							= {};							//イベント
	this.event.moveCompletionID			= "";

	this.event.moveStart				= GMapMap_event_moveStart;
	this.event.moveEnd					= GMapMap_event_moveEnd;
	this.event.moveCompletion			= GMapMap_event_moveCompletion;
	this.event.resize					= GMapMap_event_resize;
	this.event.zoomEnd					= GMapMap_event_zoomEnd;
	this.event.infoWindowOpen			= GMapMap_event_infoWindowOpen;
	this.event.infoWindowClose			= GMapMap_event_infoWindowClose;
	this.event.mouseWheel				= GMapMap_event_mouseWheel;
	this.event.keyDown					= GMapMap_event_keyDown;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.infoBar						= {};							//情報バー
	this.infoBar.clear					= GMapMap_infoBar_clear;
	this.infoBar.display				= GMapMap_infoBar_display;
	this.infoBar.opacity				= 0.7;
	this.infoBar.html					= "<div id=\"GMap--map-infobar\" style=\"%css%  position: absolute;  z-index: 100;  overflow: hidden;  border: 2px solid #ffffff;  padding: 4px 6px 3px 6px;  background-color: #000000;  font-size: 14px;  color: #ffffff;  letter-spacing: 1px;  " + ( GMap__ua.MSIE ? "filter: Alpha(opacity=70);" : "-moz-opacity: 0.7;" ) + "  opacity: 0.7;\"></div>\n";
	this.infoBar.message				= {};
	// -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
	this.infoBar.message.limitPoint		= "表示範囲を超えました。これ以上、移動することはできません。";
	this.infoBar.message.limitZoomMin	= "表示範囲を超えました。これ以上、広域にズームすることはできません。";
	this.infoBar.message.limitZoomMax	= "表示範囲を超えました。これ以上、詳細にズームすることはできません。";
	this.infoBar.message.waitMarking	= "しばらくお待ち下さい。";
	this.infoBar.message.waitLoading	= "しばらくお待ち下さい。";
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.infoWindow						= {};							//情報ウィンドウ
	this.infoWindow.tabPage				= 1;
	this.infoWindow.tabLabel			= [];
	this.infoWindow.currentItemID		= "";
	this.infoWindow.currentMarker		= "";
	this.infoWindow.enabled				= true;
	this.infoWindow.iconMoveCenterFile	= "GMap_infowindow_movecenter.png";
	this.infoWindow.iconZoomDetailFile	= "GMap_infowindow_zoomdetail.png";
	this.infoWindow.open				= GMapMap_infoWindow_open;
	this.infoWindow.close				= GMapMap_infoWindow_close;
	this.infoWindow.moveCenter			= GMapMap_infoWindow_moveCenter;
	this.infoWindow.zoomDetail			= GMapMap_infoWindow_zoomDetail;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.userControl					= {};							//ユーザーコントロール
	this.userControl.marker				= new GMapMap_userControl_marker;
	this.userControl.marker.type		= "marker";
	this.userControl.centerMarker 		= new GMapMap_userControl_marker;		//マーカーと共通
	this.userControl.centerMarker.type	= "centerMarker";						//だから←で区別する
	this.userControl.mouseWheel			= {};
	this.userControl.mouseWheel.status	= 1;
	this.userControl.mouseWheel.reverse	= 0;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.zMarking						= {};							//Zマーキング
	this.zMarking.dformerDigit			= [ -1 , -2 , -1 , -1 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 ];	//尺度対小数点以下桁数
//	this.zMarking.dformerDigit			= new Array( 4 , 4 , 3 , 3 , 2 , 2 , 2 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , -1 , -1 , -2 , -2 );	//尺度対小数点以下桁数
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.init							= GMapMap_init;
}
//□マップ - 初期化
function GMapMap_init(){
	var gmapInitResult = GMapMap_init_gmap();		//Google Maps関連
	GMapMap_init_event();							//イベント
	GMapMap.inited = 1;

	//Zマーキング機能がオフの場合
	if( !GMap_zmarking ){ this.zMarking.dformerDigit = [ 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ]; }

	return gmapInitResult;
}
//□マップ - 初期化 - Google Maps関連
function GMapMap_init_gmap(){
	GMapMap.gmap = new GMap2( document.getElementById( GMap_html_googleMap ) );		//Google Maps APIのマップを定義

	//キーボード操作
//	new GKeyboardHandler( GMapMap.gmap );

	//コントロール関連
	if( GMap_control_zoom == 1 	){ GMapMap.gmap.addControl( new GLargeMapControl() );  }		//でっかいコントローラ（尺度にメモリが付いて）
	if( GMap_control_zoom == 2 	){ GMapMap.gmap.addControl( new GSmallMapControl() );  }		//小さいコントローラ（移動用矢印と+と-のみ）
	if( GMap_control_zoom == 3 	){ GMapMap.gmap.addControl( new GSmallZoomControl() ); }		//さらに小さいコントローラ（+と-のみ）
	if( GMap_control_type			){ GMapMap.gmap.addControl( new GMapTypeControl()  );  }		//マップとサテライトの切り替えのコントローラ
	if( GMap_control_scale		){ setTimeout( "GMapMap.gmap.addControl( new GScaleControl() );" ); }		//尺度の表示
	if( GMap_control_overviewMap	){ GMapMap.gmap.addControl( new GOverviewMapControl( new GSize( GMap_control_overviewMap_width , GMap_control_overviewMap_height ) ) ); }

	//初期設定
	if(      GMap_default_item						){ var defaultPoint = new GLatLng( GMap_item[ GMap_default_item ].lat			, GMap_item[ GMap_default_item ].lng		); }	//アイテム指定
	else if( GMap_default_lng && GMap_default_lat	){ var defaultPoint = new GLatLng( GMap_default_lat								, GMap_default_lng							); }	//座標指定
	else if( GMap_focus_category						){ var defaultPoint = new GLatLng( GMap_category[ GMap_focus_category ].lat		, GMap_category[ GMap_focus_category ].lng	); }	//カテゴリ指定
	else												 { var defaultPoint = new GLatLng( 35.68402											, 139.77448										); }	//その他
	GMapMap.gmap.setCenter( defaultPoint , GMap_default_zoom );		//初期座標及び尺度

	if( GMap_default_type == "hybrid" && GMapInit_checkHybridEnable()	){ GMapMap.gmap.setMapType( G_HYBRID_MAP );    }			//マップをハイブリッド（デュアル）
	if( GMap_default_type == "satellite"									){ GMapMap.gmap.setMapType( G_SATELLITE_MAP ); }			//　〃　　サテライトにする

	//制限事項
	if( GMap_limit_dragging ){ GMapMap.gmap.disableDragging(); }

	//情報ウィンドウタブ
/*
	if( GMap_infoWindow_tab ){
		GMapMap.infoWindow.tabLabel = GMap_infoWindow_tab.split( "," );
		//タブ移動時の関数
		var update_tabs = function( attr , tabPage ){
			if( attr != "page" ){ return; }
			tabPage = parseInt( tabPage );
			GMapMap.infoWindow.tabPage = tabPage;
			GMapMap.infoWindow.open( "tab" , GMapMap.infoWindow.currentItemID , GMapMap.infoWindow.currentMarker );
		}
		//タブを定義
		var infoWindow = GMapMap.gmap.getInfoWindow();
		infoWindow.addContext( "iwstate"    , update_tabs );
		infoWindow.addContext( "iwnavigate" , update_tabs );
	}
*/
	//ジオコーダーをセット
	GMapMap.geocoder = new GClientGeocoder();

	//アンロード時に、リソースを開放する
	window.onunload = GUnload;

	var gmapInitResult = {};
	gmapInitResult.defaultPoint = defaultPoint;
	return gmapInitResult;
}
//□マップ - 初期化 - イベント
function GMapMap_init_event(){
	var obj_gmap = document.getElementById( GMap_html_googleMap );

	//Google Maps API関連イベント
	GEvent.addListener( GMapMap.gmap , "movestart"		, GMapMap.event.moveStart	);
	GEvent.addListener( GMapMap.gmap , "moveend"			, GMapMap.event.moveEnd	);
	GEvent.addListener( GMapMap.gmap , "zoomend"			, GMapMap.event.zoomEnd		);
	GEvent.addListener( GMapMap.gmap , "infowindowopen" 	, GMapMap.event.infoWindowOpen  );
	GEvent.addListener( GMapMap.gmap , "infowindowclose"	, GMapMap.event.infoWindowClose );

	//ウィンドウ（リサイズ）
	if(      GMap__ua.MSIE   ){ window.attachEvent( "onresize" , GMapMap.event.resize );			}
	else if( GMap__ua.Safari ){ window.onresize = GMapMap.event.resize;								}
	else						{ window.addEventListener( "resize" , GMapMap.event.resize , false ); }

	//クリック（フォーカスを当てる）
	if(      GMap__ua.MSIE   ){ obj_gmap.attachEvent( "onclick" , function(){ obj_gmap.focus(); } ); }

	//マウスホイールのイベントをくっつける
	if(      GMap__ua.MSIE   ){ obj_gmap.attachEvent( "onmousewheel" , GMapMap.event.mouseWheel ); }
	else if( GMap__ua.Safari ){ obj_gmap.onmousewheel = GMapMap.event.mouseWheel; }
	else						{ obj_gmap.addEventListener( "DOMMouseScroll" , GMapMap.event.mouseWheel , false ); }

	//キーボード操作
//	if(      GMap__ua.MSIE   ){ obj_gmap.attachEvent( "onkeydown" , GMapMap.event.keyDown ); }
//	else						{ document.getElementById( GMap_html_search_itemName_textField ).addEventListener( "keydown" , GMapFunc_operateByKeyboard , false ); }
}
//□マップ - イベント - 移動開始
function GMapMap_event_moveStart(){
	var center = GMapMap.gmap.getCenter();
	GMapEX.callback( this , arguments , center.x , center.y );					//コールバック

	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].movestart(); } 	//センターマーカーの切り替え

	//完了イベントのタイムアウト処理
	if( GMapMap.event.moveCompletionID ){
		clearTimeout( GMapMap.event.moveCompletionID );  
		GMapMap.event.moveCompletionID = "";
	}
}
//□マップ - イベント - 移動終了
function GMapMap_event_moveEnd(){
	var center = GMapMap.gmap.getCenter();
	GMapEX.callback( this , arguments , center.x , center.y );					//コールバック

	//制限関連
	if( center.x < GMap_limit_lng_min || center.x > GMap_limit_lng_max || center.y < GMap_limit_lat_min || center.y > GMap_limit_lat_max ){
		var lng = ( ( [ center.x , GMap_limit_lng_min , GMap_limit_lng_max ] ).sort() )[ 1 ];
		var lat = ( ( [ center.y , GMap_limit_lat_min , GMap_limit_lat_max ] ).sort() )[ 1 ];	//移動先の決定
		GMapMap.gmap.panTo( new GLatLng( lat , lng ) );
		GMapMap.infoBar.display( GMapMap.infoBar.message.limitPoint , 5000 );	//情報バーにメッセージ表示
		return ;
	}

	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].marking(); }		//センターマーカーの移動
		

	//完了イベントのタイムアウト処理
	if( GMapMap.event.moveCompletionID ){ clearTimeout( GMapMap.event.moveCompletionID ); }
	GMapMap.event.moveCompletionID = setTimeout( "GMapMap.event.moveCompletion( " + center.x + " , " + center.y + " )" , 750 );
}
//□マップ - イベント - 移動完了（移動終了0.75秒後）
function GMapMap_event_moveCompletion( lng , lat ){
	GMapEX.callback( this , arguments , lng , lat );					//コールバック
	var temp = String( lng ).split( "." );  var str_lng = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , 5 );	//小数点以下5桁にする
	var temp = String( lat ).split( "." );  var str_lat = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , 5 );

	GMapInfo.setURL( "point" , str_lng , str_lat );		//「このページのURL」をセット
	if( GMap_html_mapInfo_point ){ GMapInfo.dispPoint( lng , lat ); }		//「経度／緯度」

	//常に現在地からの距離順ソートがオンの場合 もしくは マップ内のアイテム表示の場合、リマーキングする
	if( ( GMapSort.distance && GMapInfo.urlPriorityType != "item" ) || GMap_focus_category == "_map" ){
		GMap_category[ GMap_focus_category ].marking();
	}

	//自動ズーム（マップ上のアイテムをすべて表示）が有効かチェック
	if( GMap_html_itemNavi_autoZoom ){ GMapItemNavi.checkAutoZoom(); }

	//デバッグの座標
	if( GMap_debug_mode ){ GMapCommon.HTML.write( "GMap--debug-point" , ( str_lng + " , " + str_lat + "　　　　　　lng=\"" + str_lng + "\" lat=\"" + str_lat + "\"" + "　　　　　　z=" + GMapMap.gmap.getZoom() ) ); }

	//「Google ローカル」の為のコピー
	if( GMap_html_googleLocal ){ document.getElementById( GMap_html_googleLocal ).value = String( lat ) + "," + String( lng ); }

	GMapMap.event.moveCompletionID = "";
}
//□マップ - イベント - リサイズ
function GMapMap_event_resize(){
	var windowSize = GMapCommon.HTML.getWindowSize();
	GMapEX.callback( this , arguments , windowSize.width , windowSize.height );					//コールバック
	var map_width  = parseInt( document.getElementById( GMap_html_googleMap ).offsetWidth  );
	var map_height = parseInt( document.getElementById( GMap_html_googleMap ).offsetHeight );

	//リキッドデザインの指定がある場合
	if( GMap_design_mapLiquidWidth  ){ map_width  = windowSize.width  + GMap_design_mapLiquidWidth;  }
	if( GMap_design_mapLiquidHeight ){ map_height = windowSize.height + GMap_design_mapLiquidHeight; }


	//センターマーカーがある場合、2で割り切れる数にしておく
	if( GMap_marker[ "_center" ]  && map_width  % 2 == 1 ){ map_width--; }
	if( GMap_marker[ "_center" ]  && map_height % 2 == 1 ){ map_height--; }

	if( GMap_design_mapLiquidWidth  ){ document.getElementById( GMap_html_googleMap ).style.width  = String( map_width  ) + "px"; }
	if( GMap_design_mapLiquidHeight ){ document.getElementById( GMap_html_googleMap ).style.height = String( map_height ) + "px"; }

	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].movestart(); }			//センターマーカーの移動

	GMapMap.gmap.checkResize();	//Google Maps API自体を更新
}
//□マップ - イベント - ズーム
function GMapMap_event_zoomEnd( oldZoomLevel, newZoomLevel ){
	GMapEX.callback( this , arguments , oldZoomLevel, newZoomLevel );				//コールバック

	if( newZoomLevel < GMap_limit_zoom_min ){ GMapMap.gmap.setZoom( GMap_limit_zoom_min );  GMapMap.infoBar.display( GMapMap.infoBar.message.limitZoomMin , 5000 );  return ; }	//制限
	if( newZoomLevel > GMap_limit_zoom_max ){ GMapMap.gmap.setZoom( GMap_limit_zoom_max );  GMapMap.infoBar.display( GMapMap.infoBar.message.limitZoomMax , 5000 );  return ; }

	//マーキングしなおす（尺度対小数点以下桁数が異なる場合のみ）
	if( GMapMap.zMarking.dformerDigit[ oldZoomLevel ] != GMapMap.zMarking.dformerDigit[ newZoomLevel ] ){
		GMap_category[ GMap_focus_category ].marking( "" , "TYPE:zoom" );
	}
}
//□マップ - イベント - 情報ウィンドウが開く
function GMapMap_event_infoWindowOpen(){
	var temp_id = GMapMap.infoWindow.currentItemID;
	if( !temp_id ){ GMapMap.infoWindow.currentItemID = "_unknown"; }
	GMapEX.callback( this , arguments , temp_id );				//コールバック

	GMapInfo.setURL( "item" , temp_id );										//「このページのURL」をセット
	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].remove();	}	//センターマーカーを消す
}
//□マップ - イベント - 情報ウィンドウが閉じる
function GMapMap_event_infoWindowClose(){
	var temp_id = GMapMap.infoWindow.currentItemID;
	GMapEX.callback( this , arguments , temp_id );				//コールバック

	GMapMap.infoWindow.currentItemID	= "";
	GMapInfo.urlPriorityType			= "";
	if( GMap_marker[ "_center" ] ){ GMap_marker[ "_center" ].marking(); }			//センターマーカーの表示
}
//□マップ - イベント - マウスホイール
function GMapMap_event_mouseWheel( event ){
	if( GMap_limit_zoomByMouseWheel ){ return ; }						//制限
	GMapEX.callback( this , arguments );								//コールバック

	if( GMapInfo.urlPriorityType == "item" ){ return ; }				//アイテム閲覧中はキャンセル
	if( !GMapMap.userControl.mouseWheel.status ){ return ; }			//ユーザーコントロールでオフ

	//マウスホイールの上／下の取得と、スクロールのキャンセル
	if(      GMap__ua.MSIE   ){ var delta = event.wheelDelta;   event.returnValue = false; }	//IE      	±120って値を返すんだけど、120って意味が分からないので0以上で判別 
	else if( GMap__ua.Safari ){ var delta = event.wheelDelta;   event.returnValue = false; }	//Safari
	else						{ var delta = event.detail * -1;  event.preventDefault();    }	//Firefox 	こっちは、コントロールパネルのマウス、ホイールの「1度に次の票数スクロールする」の値、但しIEとプラスマイナスが逆な為に -1 を掛ける

	//逆転指定がされている場合
	if( GMapMap.userControl.mouseWheel.reverse ){ delta *= -1; }

	GMapMap.gmap.setZoom( GMapMap.gmap.getZoom() + ( delta < 0 ? -1 : 1 ) );	//ズーム処理
}
//□マップ - イベント - キー操作
function GMapMap_event_keyDown( event ){
	if( GMap_limit_operateByKeyboard ){ return ; }					//制限

	if(  GMap__ua.MSIE ){ var keyCode = event.keyCode; }
	else 				  { var keyCode = event.witch;   }
	GMapEX.callback( this , arguments , event , keyCode );			//コールバック

	if( GMapCommon.Variable.getTempValue( "temp_operatebykeyboard" , false ) == 1 ){ return GMapCommon.Event.cancel( event ); }

	if( GMapMap.infoWindow.currentItemID ){	//情報ウィンドウが開いている場合
		if( keyCode == 9 ){ GMapMap.gmap.closeInfoWindow(); }
		return true;
	}

	var lng = 0;  var lat = 0;  var wait = 0;
	var bounds = GMapMap.gmap.getBounds();	//表示範囲の座標を取得
	var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();
	var center = GMapMap.gmap.getCenter();	//中央座標取得

	switch( keyCode ){
		case 107 : GMapMap.gmap.setZoom( GMapMap.gmap.getZoom() + 1 );  break;	// +		（拡大）
		case 109 : GMapMap.gmap.setZoom( GMapMap.gmap.getZoom() - 1 );  break;	// -		（縮小）

		case  33 : lat = tempNE.y + ( ( tempNE.y - tempSW.y ) / 3 );  wait = 1000; break;		// PageUp	（大きく北へ移動）
		case  35 : lng = tempNE.x + ( ( tempNE.x - tempSW.x ) / 3 );  wait = 1000; break;		// End		（大きく東へ移動）
		case  34 : lat = tempSW.y - ( ( tempNE.y - tempSW.y ) / 3 );  wait = 1000; break;		// PageDown	（大きく南へ移動）
		case  36 : lng = tempSW.x - ( ( tempNE.x - tempSW.x ) / 3 );  wait = 1000; break;		// End		（大きく西へ移動）

		case  38 : lat = tempNE.y + ( ( tempNE.y - tempSW.y ) / 10 );    wait =  500; break;		// ↑		（北へ移動）
		case  39 : lng = tempNE.x + ( ( tempNE.x - tempSW.x ) / 10 );    wait =  500; break;		// →		（東へ移動）
		case  40 : lat = tempSW.y - ( ( tempNE.y - tempSW.y ) / 10 );    wait =  500; break;		// ↓		（南へ移動）
		case  37 : lng = tempSW.x - ( ( tempNE.x - tempSW.x ) / 10 );    wait =  500; break;		// ←		（西へ移動）

		case 9   : if( GMapItemNavi.firstID ){ document.getElementById( GMapItemNavi.firstID ).focus(); }	break;		//TAB		（アイテムナビにフォーカス）
		case 27  : GMapMap.gmap.closeInfoWindow();						  									break;		//ESC
	}

	//移動
	if( lng || lat ){
		GMapMap.gmap.panTo( new GLatLng( ( lat ? lat : center.y ) , ( lng ? lng : center.x ) ) );
		GMapCommon.Variable.setTempValue( 1 , "temp_operatebykeyboard" );
		setTimeout( "GMapCommon.Variable.clearTempValue( \"temp_operatebykeyboard\" );" , wait );
	}

	GMapCommon.Event.cancel( event );	//イベントをキャンセル
}
//□マップ - 情報バー - クリア
function GMapMap_infoBar_clear(){
	GMapEX.callback( this , arguments );								//コールバック

	if( !GMap__ua.Opera ){	//Opera以外は徐々に透明度が低くなるようにする
		var obj = document.getElementById( "GMap--map-infobar" );
		GMapMap.infoBar.opacity = ( GMapMap.infoBar.opacity >= 0.1 ? GMapMap.infoBar.opacity - 0.1 : 0.7 );
		if( GMap__ua.MSIE		){ obj.style.filter		= "Alpha(opacity=" + String( GMapMap.infoBar.opacity * 100 ) + ")"; }
		if( GMap__ua.Gecko	){ obj.style.MozOpacity	= GMapMap.infoBar.opacity; }
		if( GMap__ua.Safari	){ obj.style.opacity	= GMapMap.infoBar.opacity; }

		if( GMapMap.infoBar.opacity != 0.7 ){
			setTimeout( "GMapMap.infoBar.clear();" , 75 );
			return;
		}
	}

	GMapCommon.HTML.setDisplay( "GMap--map-infobar" , 0 );
}
//□マップ - 情報バー - 表示
function GMapMap_infoBar_display( value , msec ){
	GMapEX.callback( this , arguments );								//コールバック

	var obj_infoBar = document.getElementById( 'GMap--map-infobar' );
	obj_infoBar.style.width = String( document.getElementById( GMap_html_googleMap ).offsetWidth - 40 ) + "px";
	GMapCommon.HTML.setDisplay( "GMap--map-infobar" , 1 );
	obj_infoBar.innerHTML = value;

	if( msec ){ setTimeout( "GMapMap.infoBar.clear();" , msec ); }	//msec後に自動消去
}
//□マップ - 情報ウィンドウ - 開く
function GMapMap_infoWindow_open( type , item_id , marker ){
	if( !GMapMap.infoWindow.enabled ){ return; }

	//既に情報ウィンドウが開いている場合は閉じる
	if( GMapMap.infoWindow.currentItemID ){ GMapMap.gmap.closeInfoWindow(); }

//	var tabPage = GMapMap.infoWindow.tabPage;
//	if( tabPage == undefined ){ tabPage = 1; }							//tabPageはタブのページ
	GMapMap.infoWindow.currentItemID = item_id;
	GMapMap.infoWindow.currentMarker = marker;

	var callback_result = GMapEX.callback( this , arguments, type , item_id , marker );	//コールバック
	if( callback_result.cancelParentProcess ){ return ;	}									//コールバック戻り値の処理

	//タブの数だけ実行
	if( !GMap_infoWindow_tab ){	//通常モード
		var temp_html = GMap_item[ item_id ].getInfoWindowHTML();	//HTMLの取得
		temp_html = temp_addFunc( temp_html );						//情報ウィンドウ機能の付加
		marker.openInfoWindowHtml( temp_html );						//情報ウィンドウの表示
	} else { 	//タブモード
		var tabData = [];  var tabLabel = GMap_infoWindow_tab.split( "," );
		for( var i = 1 ; i <= 2 ; i++ ){
			GMapMap.infoWindow.tabPage = i;
			var temp_html = GMap_item[ item_id ].getInfoWindowHTML();		//HTMLの取得
			if( !temp_html ){ continue; }
			if( i == 1 ){ temp_html = temp_addFunc( temp_html ); }			//情報ウィンドウ機能の付加
			tabData.push( new GInfoWindowTab( tabLabel[ i - 1 ] , temp_html ) );
		}
		//情報ウィンドウの表示
		marker.openInfoWindowTabsHtml( tabData );	//タブで表示
	}



	//情報ウィンドウ機能の付加
	function temp_addFunc( html ){
		var func_html = "";  var func_css_left = 0;
		if( GMap_infoWindow_func_moveCenter ){ func_html += GMapCommon.HTML.makePngTag( GMap_image_path + GMapMap.infoWindow.iconMoveCenterFile , 40 , 13 , { onclick : "GMapMap.infoWindow.moveCenter( event );" , style : "position: absolute;  left: " + func_css_left + "px;  cursor: pointer;" } , "image" );  func_css_left += 42; }
		if( GMap_infoWindow_func_zoomDetail ){ func_html += GMapCommon.HTML.makePngTag( GMap_image_path + GMapMap.infoWindow.iconZoomDetailFile , 40 , 13 , { onclick : "GMapMap.infoWindow.zoomDetail( event );" , style : "position: absolute;  left: " + func_css_left + "px;  cursor: pointer;" } , "image" );  func_css_left += 42; }
		if( func_html ){ html = "<div style=\"position:relative;  left: -3px;  top: -5px;  width: " + func_css_left + "px;  height: 15px;\">" + func_html + "</div>" + html; }
		return html;
	}
}
//□マップ - 情報ウィンドウ - 閉じる（予約）
function GMapMap_infoWindow_close(){
//	GMapEX.callback( this , arguments );				//コールバック
}
//□マップ - 情報ウィンドウ - センタリング
function GMapMap_infoWindow_moveCenter( event ){
	var temp = GMap_item[ GMapMap.infoWindow.currentItemID ];
	var lng = ( temp.zCurrentPoint.lng ? temp.zCurrentPoint.lng : temp.lng ) + ( Math.random() / 100000 );
	var lat = ( temp.zCurrentPoint.lat ? temp.zCurrentPoint.lat : temp.lat ) + ( Math.random() / 100000 );
	GMapMap.gmap.closeInfoWindow();
	GMapMap.gmap.panTo( new GLatLng( lat , lng ) );	//センタリング
}
//□マップ - 情報ウィンドウ - ズーム
function GMapMap_infoWindow_zoomDetail( event ){
	var temp = GMap_item[ GMapMap.infoWindow.currentItemID ].zBrother;	//範囲はそのアイテムとZマーキングが同様のもの
	var map_point = new GMapPoint();		//マップ内にすべて納めるようにする
	for( var i = 0 ; i < temp.length ; i++ ){ map_point.addPoint( GMap_item[ temp[ i ] ].lng , GMap_item[ temp[ i ] ].lat ); }
	GMapMap.gmap.closeInfoWindow();
	map_point.moveCenterAndZoom();
}
//□マップ - ユーザーコントロール - マーカー
function GMapMap_userControl_marker(){
	this.type		= "";
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.visibility = 1;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.changeVisibility	= GMapMap_userControl_marker_changeVisibility;
}
//□マップ - ユーザーコントロール - マーカー - 表示の切り替え
function GMapMap_userControl_marker_changeVisibility( status ){
	this.visibility = status;
	GMapEX.callback( this , arguments  , status );					//コールバック

	switch( this.type ){
		case "marker"		: GMap_category[ GMap_focus_category ].marking();	break;		//マーカーを引きなおす
		case "centerMarker"	: GMap_marker[ "_center" ].marking();					break;		//センターマーカーをマーキングしなおす
	}
}
//--------------------------------------------------------------------------------------------------
//□カテゴリ
function GMapCategory( category_id , name , lng , lat , group ){
	this.id						= category_id;
	this.name					= name;
	this.lng					= parseFloat( lng );
	this.lat					= parseFloat( lat );
	this.group					= ( group != undefined ? group : "" );
	this.defaultItems			= [];
	this.searchResultItems		= [];
	this.sortCacheItems			= [];
	this.markerCount			= 0;
	this.bounds					= { minLng : 180 , maxLng : -180 , minLat : 90 , maxLat : -90 };
	if( category_id == "_map" ){
		this.cacheItems			= "";
	}

}
GMapCategory.prototype = new function(){
	this.setItem				= GMapCategory_setItem;
	this.addSearchResultItems	= GMapCategory_addSearchResultItems;
	this.change					= GMapCategory_change;
	this.clearSearchResultItems	= GMapCategory_clearSearchResultItems;
	this.clearSortCacheItems	= GMapCategory_clearSortCacheItems;
	this.getTargetItems			= GMapCategory_getTargetItems;
	this.getZMarker				= GMapCategory_getZMarker;
	this.marking				= GMapCategory_marking;
	this.sort					= GMapCategory_sort;
}
var GMapCategory_callback = new GMapCategory( "" , "" , 0 , 0 , "" );	//コールバック用
//□カテゴリ - アイテムをセット
function GMapCategory_setItem( item_id , lng , lat ){
	this.defaultItems[ this.defaultItems.length ] = item_id;	//初期アイテム一覧

	//このカテゴリの範囲を記録
	if( this.bounds.minLng > lng ){ this.bounds.minLng = lng; } 
	if( this.bounds.maxLng < lng ){ this.bounds.maxLng = lng; }
	if( this.bounds.minLat > lat ){ this.bounds.minLat = lat; }
	if( this.bounds.maxLat < lat ){ this.bounds.maxLat = lat; }
}
//□カテゴリ - 検索結果アイテムの追加
function GMapCategory_addSearchResultItems( item_id ){
	this.searchResultItems[ this.searchResultItems.length ] = item_id;
}
//□カテゴリ - 変更
function GMapCategory_change( option , tid ){		//第3引数TID
	if( option == undefined ){ option = ""; }
	if( this.id == "-" ){ return ; }
	GMapItemNavi.page.num = 1;									//ページを1にリセット
	if( !tid ){ GMapEX.callback( this , arguments ); }			//コールバック

	//ダミーマーカーがある場合、削除
	if( GMapMap.dummyMarker ){ GMapMap.gmap.removeOverlay( GMapMap.dummyMarker ); }

	//情報ウィンドウが開いている場合閉じる
	if( !option.match( /INIT/ ) ){ GMapMap.gmap.closeInfoWindow(); }

	//座標を記録する為のオブジェクト
	if( !tid ){
		var map_point = new GMapPoint();
	} else {
		var temp = GMapCommon.Variable.getTempValue( tid , false );	//一時変数から取得
		var map_point = temp.map_point;  option = temp.option;
	}

	//距離ソートの場合で、現在地と移動後が異なる場合、移動イベントでマーキングする
	if( GMapSort.distance ){
		var center = GMapMap.gmap.getCenter();
		if( this.lng != center.x || this.lat != center.y ){ option += " MARKING:off ITEMNAVI:off"; }
	}

	//マーキングする
	var result = this.marking( map_point , option , tid );
	GMap_focus_category = this.id;
	if( !result ){ return; }									//マーキング失敗（途中終了）の場合、ここでキャンセル


	//移動
	if( !option.match( /MOVE:off/ ) ){										//オプションでオフになっている場合は、移動しない
		var temp_autoCentering = GMap_category_autoCentering;
		if( option.match( /AUTOCENTERING:([0-9])/ ) ){ temp_autoCentering = parseInt( RegExp.$1 ); }	//オプションでセンターとズームがオン
		if( map_point && temp_autoCentering ){	//自動センタリング
			switch( temp_autoCentering ){
				case 1: map_point.moveCenter();  		break;	//センタリングのみ
				case 2: map_point.moveCenterAndZoom();	break;	//センタリングとズーム
			}
		} else if( this.lng && this.lat ){	//通常移動（座標が存在する場合）
			GMapMap.gmap.panTo( new GLatLng( this.lat , this.lng ) );
		}
		map_point = {};
	}

	//関連処理
	GMapInfo.setURL( "category" , this.id );	//「このページのURL」をセット

	if( GMap__ua.MSIE ){ document.getElementById( GMap_html_googleMap ).focus(); }	//フォーカスをマップにする（IE以外はなぜかエラー）
}
//□カテゴリ - 検索結果アイテムのクリア
function GMapCategory_clearSearchResultItems(){
	this.searchResultItems = [];
}
//□カテゴリ - ソートキャッシュアイテムのクリア
function GMapCategory_clearSortCacheItems(){
	this.sortCacheItems = [];
}
//□カテゴリ - アイテム一覧の取得
function GMapCategory_getTargetItems(){
	//すべてのカテゴリのアイテム一覧を取得
	var targetItems = [];

	var callback_result = GMapEX.callback( this , arguments );	//コールバック
	if( callback_result.cancelParentProcess ){						//コールバック戻り値の処理
		return callback_result.returnValue.targetItems;
	}

	//表示対象
	if( this.id == "_all" ){ 						//すべて表示
		//すべてのカテゴリから取得
		for( var category_id in GMap_category ){/*●_●*/
			if( category_id == "clear" || category_id.match( /^_/ ) ){ continue; }
			targetItems = targetItems.concat( ( !GMapSearch.status ? GMap_category[ category_id ].defaultItems : GMap_category[ category_id ].searchResultItems ) );
		}
	} else if( this.id == "_map" ){					//マップ上表示のアイテム
		var bounds = GMapMap.gmap.getBounds();
		var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();
		var bound_w = ( tempNE.x - tempSW.x ) / 2;		  var bound_h = ( tempNE.y - tempSW.y ) / 2;
//		var bound_w = ( bounds.maxX - bounds.minX ) / 2;  var bound_h = ( bounds.maxY - bounds.minY ) / 2;

		for( var category_id in GMap_category ){/*●_●*/
			if( category_id == "clear" || category_id.match( /^_/ ) ){ continue; }
			var c_bounds = GMap_category[ category_id ].bounds;
			//カテゴリ自体がマップ外の場合は、スキップ
			if( ( c_bounds.maxLng < tempSW.x - bound_w ) || ( tempNE.x + bound_w < c_bounds.minLng ) || ( c_bounds.maxLat < tempSW.y - bound_h ) || ( tempNE.y + bound_h < c_bounds.minLat ) ){ continue; }

			//マップ内（及び余白）のアイテムのみ追加
			var temp_targetItems = ( !GMapSearch.status ? GMap_category[ category_id ].defaultItems : GMap_category[ category_id ].searchResultItems );
			for( var i = 0 ; i < temp_targetItems.length ; i++ ){
				if( ( GMap_item[ temp_targetItems[ i ] ].lng < tempSW.x - bound_w ) || ( tempNE.x + bound_w < GMap_item[ temp_targetItems[ i ] ].lng ) || ( GMap_item[ temp_targetItems[ i ] ].lat < tempSW.y - bound_h ) || ( tempNE.y + bound_h < GMap_item[ temp_targetItems[ i ] ].lat ) ){ continue; }
				targetItems[ targetItems.length ] = temp_targetItems[ i ];
			}
		}
	} else {										//カテゴリ別
		targetItems = ( !GMapSearch.status ? this.defaultItems : this.searchResultItems );
	}

	//ソートもしくは距離ソート
	if( GMapSort.status || GMapSort.distance ){ targetItems = this.sort( targetItems ); }

	//ページモードの場合
	if( GMapItemNavi.page.items ){
		var page_num			= GMapItemNavi.page.num;
		var page_items			= GMapItemNavi.page.items;
		GMapItemNavi.page.qty = Math.ceil( targetItems.length / page_items );
		targetItems				= targetItems.slice( ( page_num  - 1 ) * page_items , page_num * page_items );
	}

	return targetItems;
}
//□カテゴリ - マーキング
function GMapCategory_marking( map_point , option , tid ){
	if( option == undefined ){ option = ""; }

	//マーキングが多い場合は、その旨のメッセージを表示する処理
	if( !tid ){
		var targetItems = this.getTargetItems();	//ターゲットを取得

		//Zマーカーの取得及び
		var zMarker = this.getZMarker( targetItems , map_point );

		//20件以上の場合、情報バーにメッセージ表示
		if( GMapCommon.Array.count( zMarker.zpoint ) >= 20 && GMapMap.userControl.marker.visibility && !option.match( /MARKING:off/ ) ){
			var temp = {};
			temp.targetItems = targetItems;  temp.zMarker = zMarker;  temp.map_point = map_point;  temp.option = option;
			var tid = GMapCommon.Variable.setTempValue( temp );			//一時変数にセット

			GMapMap.infoBar.display( GMapMap.infoBar.message.waitMarking , 0 );	//情報バーにメッセージ表示
			GMapItemNavi.clear();													//アイテムナビをクリア

			if( map_point ){ setTimeout( "GMap_category[ '" + this.id + "' ].change( '" + option + "' , '" + tid + "' );" , 100 ); }						//カテゴリ変更
			else           { setTimeout( "GMap_category[ '" + this.id + "' ].marking( 0 , '" + option + "' , '" + tid + "' );" , 100 ); }		//マーキングのみ

			return false;
		}
	} else {
		var temp = GMapCommon.Variable.getTempValue( tid );	//一時変数から取得
		var targetItems = temp.targetItems;  var zMarker = temp.zMarker;

		GMapMap.infoBar.clear();					//情報バーをクリア
	}

	//「マップ内のアイテムを表示」でキャッシュと同一の場合はリマーキングしない
	if( this.id == "_map" && zMarker.cacheItems == this.cacheItems ){ return ; } else if( this.id == "_map" ){ this.cacheItems = zMarker.cacheItems; }

	//ズームによる移動で、マーカーの個数が変わっていなければマーキングしない
	if( !tid && this.id != "_map" && option.match( /TYPE:zoom/ ) && this.markerCount == GMapCommon.Array.count( zMarker.zpoint ) && GMap_category_autoCentering != 2 ){ return ; }


	//一度、マーカーを消して書き直す
	for( var i = 0 ; i < GMap_current_marker.length ; i++ ){ GMapMap.gmap.removeOverlay( GMap_current_marker[ i ] ); }
	GMap_current_marker = [];


	//ズーム（尺度対小数点以下桁数）が異なる場合、ズームイベントでマーキングする
	if( map_point && ( GMap_category_autoCentering == 2 || option.match( /AUTOCENTERING:2/ ) ) && !option.match( /INIT/ ) ){
		map_point.setCenterAndZoom();
		if( GMapMap.zMarking.dformerDigit[ map_point.newZoom ] != GMapMap.zMarking.dformerDigit[ GMapMap.gmap.getZoom() ] ){ return true; }
	}

	//マーカーを付加する
	if( !option.match( /MARKING:off/ ) ){				//オプションでオフになっている場合はスキップ
		for( var zpoint in zMarker.zpoint ){
			if( zpoint == "clear" ){ continue; }
			//マーカーを付加する（zマーキングでない場合のみ）
			GMap_item[ zMarker.zpoint[ zpoint ].item_id ].addMarker( zMarker.zpoint[ zpoint ].count , ( zMarker.zpoint[ zpoint ].sumLng / zMarker.zpoint[ zpoint ].qty ) , ( zMarker.zpoint[ zpoint ].sumLat / zMarker.zpoint[ zpoint ].qty ) , zMarker.zpoint[ zpoint ].marker , zMarker.zpoint[ zpoint ].items.length );
		}
		this.markerCount = GMapCommon.Array.count( zMarker.zpoint );
	}

	//アイテムナビゲーションの作成
	if( !option.match( /ITEMNAVI:off/ ) ){				//オプションでオフになっている場合はスキップ
		for( var i = 0 ; i < targetItems.length ; i++ ){
			var item_id = targetItems[ i ];
			var zpoint  = zMarker.item2point[ item_id ];
			//　- if( this.id == "_map" && !zMarker.zpoint[ zpoint ].flagInMap ){ continue; }	//マップ内のアイテムを表示で、マップ外の場合スキップ

			GMapItemNavi.add( item_id , zMarker.zpoint[ zpoint ].count , zMarker.zpoint[ zpoint ].marker );	//各アイテムのHTML
			GMap_item[ item_id ].zBrother = zMarker.zpoint[ zpoint ].items;	//同じマーカーのを記録しておく
			GMap_item[ item_id ].zCurrentPoint = { lng : ( zMarker.zpoint[ zpoint ].sumLng / zMarker.zpoint[ zpoint ].qty ) , lat : ( zMarker.zpoint[ zpoint ].sumLat / zMarker.zpoint[ zpoint ].qty ) };		//zマーキングでの座標（アイテムナビからの表示の際に利用）
		}
		//アイテムナビゲーションの設置
		GMapItemNavi.make();
	}

	return true;
}
//□カテゴリ - Zマーカーの取得（ついでにアイテムナビのHTML追加もしている）
function GMapCategory_getZMarker( targetItems , map_point ){
	var bounds = GMapMap.gmap.getBounds();

	//アイテム毎に処理
	var count = 1;
	var zMarker			= {};  //Zマーカー変数
	zMarker.zpoint		= {};	//Zポイント
	zMarker.item2point	= {};	//item-zpoint対応配列
	zMarker.cacheItems	= "";	//
	for( var i = 0 ; i < targetItems.length ; i++ ){
		var item_id = targetItems[ i ];
		var zpoint = GMap_item[ item_id ].getZPoint();	//Zポイント取得
		var marker = ( GMap_marker_key ? GMap_item[ item_id ].data[ GMap_marker_key ] : "" );

		if( zMarker.zpoint[ zpoint ] == null  ){	//未定義カウンタ
			var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();

			//Zマーカーを定義
			zMarker.zpoint[ zpoint ] = {};
			zMarker.zpoint[ zpoint ].item_id	= item_id;
			zMarker.zpoint[ zpoint ].marker		= "";
			zMarker.zpoint[ zpoint ].qty		= 0;
			zMarker.zpoint[ zpoint ].sumLng		= 0;
			zMarker.zpoint[ zpoint ].sumLat		= 0;
			zMarker.zpoint[ zpoint ].items		= [];

			zMarker.zpoint[ zpoint ].flagInMap = ( ( GMap_item[ item_id ].lng < tempSW.x ) || ( tempNE.x < GMap_item[ item_id ].lng ) || ( GMap_item[ item_id ].lat < tempSW.y ) || ( tempNE.y < GMap_item[ item_id ].lat ) ? 0 : 1 );

			if( this.id != "_map" || zMarker.zpoint[ zpoint ].flagInMap ){	//通常モードもしくは「マップ内のアイテムを表示」でマップ内
				zMarker.zpoint[ zpoint ].count	= count;
				count++;
			} else {														//「マップ内のアイテムを表示」でマップ外
				zMarker.zpoint[ zpoint ].count	= 0;
			}
		}
		zMarker.zpoint[ zpoint ].qty++;
		zMarker.zpoint[ zpoint ].sumLng += GMap_item[ item_id ].lng;
		zMarker.zpoint[ zpoint ].sumLat += GMap_item[ item_id ].lat
		zMarker.zpoint[ zpoint ].items[ zMarker.zpoint[ zpoint ].items.length ] = item_id;

		if( GMap_marker[ marker ] ){	//アイコンキーに関する処理
			if( 	 !zMarker.zpoint[ zpoint ].marker																){ zMarker.zpoint[ zpoint ].marker = marker;		}	//未定義なら言うこと無し
			else if( GMap_marker[ marker ].priority == GMap_marker[ zMarker.zpoint[ zpoint ].marker ].priority	){  }	//同じアイコン
			else if( GMap_marker[ "_composite" ]																	){ zMarker.zpoint[ zpoint ].marker = "_composite";	}	//複合アイコンが存在する場合
			else if( GMap_marker[ marker ].priority < GMap_marker[ zMarker.zpoint[ zpoint ].marker ].priority	){ zMarker.zpoint[ zpoint ].marker = marker; }	//優先度が高い場合
		}

		zMarker.cacheItems += item_id + "-" + zMarker.zpoint[ zpoint ].count + " ";		//キャッシュ比較用
		zMarker.item2point[ item_id ] = zpoint;	//item-zpoint対応配列
		if( map_point ){ map_point.addPoint( GMap_item[ item_id ].lng , GMap_item[ item_id ].lat ); }	//座標を加える
	}

	return zMarker;
}
//□カテゴリ - ソート
function GMapCategory_sort( targetItems ){
	//キャッシュが存在する場合、そっちを使う（但し順序ソート以外）
	if( !GMapSort.distance && this.id != "_map" && GMap_category[ this.id ].sortCacheItems.length ){
		return GMap_category[ this.id ].sortCacheItems;
	}

	//距離ソートの場合、現在の座標を取得
	if( GMapSort.distance ){
		var center = GMapMap.gmap.getCenter();
		var lng = center.x;  var lat = center.y;
	}

	//ソート用配列の作成
	var search_array = {};
	for( var i = 0 ; i < targetItems.length ; i++ ){
		if( GMapSort.distance ){
			search_array[ targetItems[ i ] ] = GMap_item[ targetItems[ i ] ].getDistance( lng , lat );
		} else {
			var temp =  GMap_item[ targetItems[ i ] ].data[ GMapSort.key ];
			search_array[ targetItems[ i ] ] = ( GMapSort.type == "number" ? parseFloat( temp ) : temp );	//数値の場合は型を変換
		}
	}

	//ソート処理
	search_array = GMapCommon.Array.sort( search_array , "" , ( !GMapSort.distance && GMapSort.desc ? "desc" : "" ) );

	//戻り値を生成
	var result_array = GMapCommon.Array.keys( search_array );

	//キャッシュする（距離ソートのキャッシュもアイテムナビの並び順でも利用）
	this.sortCacheItems = result_array;

	return result_array;
}
//--------------------------------------------------------------------------------------------------
//□アイテム
function GMapItem( item_id , category_id , name , lng , lat , argJS , argXML ){
	this.id				= item_id;
	this.category		= category_id;
	this.lng			= parseFloat( lng );
	this.lat			= parseFloat( lat );
	this.name			= name;
	this.distance		= 0;
	this.zBrother		= [];
	this.zCurrentPoint	= {};

	var gData = [];
	if( argJS  ){ for( var i= 0 ; i < GMap_item_argName.length ; i++ ){ gData[ GMap_item_argName[ i ] ] = ( argJS[ i ] ? argJS[ i ] : "" ); } }	//JavaScriptデータ：連想配列の形にする
	if( argXML ){ gData = argXML; }																													//XMLデータ：になってるからそのまま
	this.data			= gData;
	this.distance		= 0;
	GMap_category[ category_id ].setItem( item_id , this.lng , this.lat );
}
GMapItem.prototype = new function(){
	this.addMarker					= GMapItem_addMarker;
	this.getDistance				= GMapItem_getDistance;
	this.getInfoWindowHTML			= GMapItem_getInfoWindowHTML;
	this.getZPoint					= GMapItem_getZPoint;
	this.makeHTML					= GMapItem_makeHTML;
	this.moveCenter					= GMapItem_moveCenter;
	this.openInfoWindowByItemNavi	= GMapItem_openInfoWindowByItemNavi;
}
//□アイテム - マーカーを追加
function GMapItem_addMarker( count , zLng , zLat , marker_id , zBrothers ){
	if( !GMapMap.userControl.marker.visibility ){ return ; }		//ユーザーが非表示にしている場合、表示しない

	//座標
	var lng = ( zLng ? zLng : this.lng );  var lat = ( zLat ? zLat : this.lat );

	//アイコン
	if( !marker_id || !GMap_marker[ marker_id ] ){ marker_id = "_default"; }
	GMap_marker[ marker_id ].gicon.image = GMap_marker[ marker_id ].iconfile.replace( "%count%" , ( GMap_marker[ marker_id ].filesuffix[ count ] ? GMap_marker[ marker_id ].filesuffix[ count ] : GMap_marker[ marker_id ].filesuffix[ 0 ] ) );
	var m = GMap_current_marker.length;
	var markerOption = {
		icon : GMap_marker[ marker_id ].gicon ,
		title : this.name + ( zBrothers >= 2 ? "　他" : ""  )
	}
	GMap_current_marker[ m ] = new GMarker( new GLatLng( lat , lng ) , markerOption );					//マーカーの作成
    GMapMap.gmap.addOverlay( GMap_current_marker[ m ] );																//マーカーのを表示

	//イベント設定
	var temp_id = this.id;
	GEvent.addListener( GMap_current_marker[ m ] , "click" , function() {								//マーカーのイベント（クリック）
		if( GMapMap.infoWindow.currentItemID == temp_id ){ GMapMap.gmap.closeInfoWindow();  return; }	//同じマーカーなら情報ウィンドウを閉じる
		GMapMap.infoWindow.open( "marker" , temp_id , GMap_current_marker[ m ] );
	} );

//	GEvent.addListener( GMap_current_marker[ m ] , 'infowindowclose' , function(){					//情報ウィンドウクローズ後の処理
//		GMapMap.infoWindow.close( "marker" , temp_id );
//	} );
}
//□アイテム - 現在地からの距離を取得
function GMapItem_getDistance( lng , lat ){
	var distance = GMapCommon.Map.convPointsToDistance( this.lng , this.lat , lng , lat );
	this.distance = distance;
	return distance;
}
//□アイテム - 情報ウィンドウに表示するHTMLを取得
function GMapItem_getInfoWindowHTML(){
	var html = "";  var tab = [ "-" , true , false ];
	var myZPoint	= this.getZPoint();	//自分のZポイントを取得
	var temp_html	= this.makeHTML();
	html = ( typeof( temp_html ) == "object" ? temp_html.html : temp_html );											//HTML

	//Zマーキングで重複するアイテム群
	var targetItems = this.zBrother;
	for( var i = 0 ; i < targetItems.length ; i++ ){
		var item_id = targetItems[ i ];
		if( item_id == this.id ){ continue; }  //自分自身はスキップ

		temp_html = GMap_item[ item_id ].makeHTML();				//セパレートとそのHTMLをくっつける
		if( !temp_html ){ continue; }

		html += GMap_zmarking_separate + ( typeof( temp_html ) == "object" ? temp_html.html : temp_html );					//HTML
	}

	if( !html ){ return ""; }

	//情報ウィンドウが大きい場合、スクロールバーを表示するようにする
	var temp_gmap = document.getElementById( GMap_html_googleMap );
	var layoutSize = GMapCommon.HTML.getLayoutSize( html );

	if( layoutSize.width >= ( temp_gmap.offsetWidth / 1.25 ) || layoutSize.height >= ( temp_gmap.offsetHeight / 2 ) ){
		if( layoutSize.height >= ( temp_gmap.offsetHeight / 2 ) ){ layoutSize.width += 20; }
		var css_w = ( layoutSize.width  >= ( temp_gmap.offsetWidth / 1.25 ) ? 1 : 0 );
		var css_h = ( layoutSize.height >= ( temp_gmap.offsetHeight / 2   ) ? 1 : 0 );

		html = "<div class=\"active\" style=\"position:relative;  left: 5px;  width:" + ( !css_w ? layoutSize.width : ( temp_gmap.offsetWidth / 1.25 ) ) + "px;  height: " + ( !css_h ? layoutSize.height : ( temp_gmap.offsetHeight / 2 ) ) + "px;  overflow: auto;  margin-top: 11px;\">" + html + "</div>";
	} else {

		html = "<div class=\"active\" id=\"gmap--infoWindow\" style=\"width:" + layoutSize.width + "px;  height:" + layoutSize.height + "px;\">" + html + "</div>";
	}

	return html;
}
//□アイテム - Zポイントを取得
function GMapItem_getZPoint(){
	var z = GMapMap.gmap.getZoom();
//	var z = 17 - GMapMap.gmap.getZoom();
	var lng = Math.round( this.lng * Math.pow( 10 , GMapMap.zMarking.dformerDigit[ z ] ) ) / Math.pow( 10 , GMapMap.zMarking.dformerDigit[ z ] );
	var lat = Math.round( this.lat * Math.pow( 10 , GMapMap.zMarking.dformerDigit[ z ] ) ) / Math.pow( 10 , GMapMap.zMarking.dformerDigit[ z ] );
	var zpoint = String( lng ) + "," + String( lat );
	return zpoint;
}
//□アイテム - HTML生成
function GMapItem_makeHTML(){
	var gData = this.data;
	var iData = [];
	for( var i in gData ){ iData[ i ] = gData[ i ]; }		//値だけをコピー

	if( typeof( user_GMapItem_makeHTML ) == "function" ){		//ユーザー関数がある場合、そちらで処理する
		var html = user_GMapItem_makeHTML( iData );
	} else if( GMap_template[ "undefined" ] ){				//テンプレートファイルがある場合
		var html = GMapCommon.Data.convTemplate( iData );
	} else {													//無い場合はデフォルト処理
		if( typeof( iData[ "value" ] ) == "undefined" ){ iData[ "value" ] = ""; }
		if( typeof( iData[ "_html" ] ) == "undefined" ){ iData[ "_html" ]  = ""; }
		var html = "<div><strong>" + iData[ "name" ] + "</strong><br>" + iData[ "value" ] + iData[ "_html" ] + "</div>";
	}

	return html;
}
//□アイテム - センターに移動
function GMapItem_moveCenter(){
	GMapMap.gmap.closeInfoWindow();
	GMapMap.gmap.panTo( new GLatLng( this.lat , this.lng ) );	//センタリング
}
//□アイテム - 情報ウィンドウを開く（アイテムナビから）
function GMapItem_openInfoWindowByItemNavi( count , option ){
	if( option == undefined ){ option = ""; }
	var lng = ( this.zCurrentPoint.lng ? this.zCurrentPoint.lng : this.lng );
	var lat = ( this.zCurrentPoint.lat ? this.zCurrentPoint.lat : this.lat );

	//マーカーの設定
	if( GMapMap.dummyMarker ){ GMapMap.gmap.removeOverlay( GMapMap.dummyMarker ); }
	var marker = ( GMap_marker_key ? GMap_item[ this.id ].data[ GMap_marker_key ] : "" );
	if( !marker || !GMap_marker[ marker ] ){ marker = "_default"; }
	GMap_marker[ marker ].gicon.image = GMap_marker[ marker ].iconfile.replace( "%count%" , ( GMap_marker[ marker ].filesuffix[ count ] ? GMap_marker[ marker ].filesuffix[ count ] : GMap_marker[ marker ].filesuffix[ 0 ] ) );
	GMapMap.dummyMarker = new GMarker( new GLatLng( lat , lng ) , GMap_marker[ marker ].gicon );		//マーカーの作成
	GMapMap.gmap.addOverlay( GMapMap.dummyMarker );														//情報ウィンドウを表示する為だけのマーカーの表示

	var temp_id = this.id;
	GMapMap.infoWindow.open( "itemNavi" , temp_id , GMapMap.dummyMarker );

	GEvent.addListener( GMapMap.dummyMarker , 'infowindowclose' , function(){	//情報ウィンドウクローズ後の処理
		if( !GMapMap.userControl.marker.visibility || option.match( /ADDMARKER/ ) ){ GMapMap.gmap.removeOverlay( GMapMap.dummyMarker ); }	//マーカーを削除／ユーザーがマーカー非表示時
	} );
}


//--------------------------------------------------------------------------------------------------
//□マップポイント
function GMapPoint(){
	this.count  = 0;  this.minLng = 0;  this.maxLng = 0;  this.minLat = 0;  this.maxLat = 0;
	this.newPoint = 0;  this.newLng = 0;  this.newLat = 0;  this.newZoom = 0;

	this.addPoint			= GMapPoint_addPoint;
	this.moveCenter			= GMapPoint_moveCenter;
	this.moveCenterAndZoom	= GMapPoint_moveCenterAndZoom;
	this.setCenterAndZoom	= GMapPoint_setCenterAndZoom;
}
//□マップポイント - ポイントを加える
function GMapPoint_addPoint( lng , lat ){
	if( !lng || !lat ){ return ; }							//変なごみ

	this.count++
	if( !this.minLng || this.minLng > lng ){ this.minLng = lng; }	//最西と最東の座標を計算
	if( !this.maxLng || this.maxLng < lng ){ this.maxLng = lng; }
	if( !this.minLat || this.minLat > lat ){ this.minLat = lat; }	//最北と最南　〃
	if( !this.maxLat || this.maxLat < lat ){ this.maxLat = lat; }
}
//□マップポイント - 中央に移動
function GMapPoint_moveCenter(){
	GMapMap.gmap.panTo( new GLatLng( ( this.minLat + this.maxLat ) / 2 ) , ( this.minLng + this.maxLng ) / 2 );
}
//□マップポイント - 中央に移動してズーム
function GMapPoint_moveCenterAndZoom(){
	if( !this.newPoint ){ this.setCenterAndZoom(); }
	GMapMap.gmap.setCenter( new GLatLng( this.newLat , this.newLng ) , this.newZoom );
}
//□マップポイント - 中央に移動してズーム
function GMapPoint_setCenterAndZoom(){
	if( !this.count ){ return ; }
	var bounds = GMapMap.gmap.getBounds();
	var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();
	var bound_w = tempNE.x - tempSW.x;			var bound_h = tempNE.y - tempSW.y;
	var new_lng = ( this.minLng + this.maxLng ) / 2;	var new_lat = ( this.minLat + this.maxLat ) / 2;

	//マップタイプから最小、最大のズームを取得
	var mapTypeList = { "map" : G_NORMAL_MAP , "satellite" : G_SATELLITE_MAP , "hybrid" : G_HYBRID_MAP };
	var mapType = mapTypeList[ GMapInfo.getType() ];
	var minZoom = mapType.getMinimumResolution()
	var maxZoom = mapType.getMaximumResolution()

//★★★★★★★★最大のズーム値を取得しないと）

	if( this.count <= 1 ){	//ひとつの場合は詳細
		var n = maxZoom;
	} else if( new_lng - ( bound_w / 2 ) > this.minLng || new_lng + ( bound_w / 2 ) < this.maxLng || new_lat - ( bound_h / 2 ) > this.minLat || new_lat + ( bound_h / 2 ) < this.maxLat ){	//いずれか外
		var n_x  = Math.ceil( Math.log( Math.max( this.maxLng - new_lng , new_lng - this.minLng ) / ( bound_w / 2 ) ) / Math.log( 2 ) )
		var n_y  = Math.ceil( Math.log( Math.max( this.maxLat - new_lat , new_lat - this.minLat ) / ( bound_h / 2 ) ) / Math.log( 2 ) )
		var n    = GMapMap.gmap.getZoom() - Math.min( n_x , n_y );
		if( n < minZoom ){ n = minZoom; }
//		var n    = GMapMap.gmap.getZoom() + Math.max( n_x , n_y );
//		if( n > 17 ){ n = 17; }
	} else {	//すべて内
		var n_x  = Math.floor( Math.log( ( bound_w / 2 ) / Math.max( this.maxLng - new_lng , new_lng - this.minLng ) ) / Math.log( 2 ) )
		var n_y  = Math.floor( Math.log( ( bound_h / 2 ) / Math.max( this.maxLat - new_lat , new_lat - this.minLat ) ) / Math.log( 2 ) )
		var n    = GMapMap.gmap.getZoom() + Math.max( n_x , n_y );
		if( n > maxZoom ){ n = maxZoom; }
//		var n    = GMapMap.gmap.getZoom() - Math.min( n_x , n_y );
//		if( n < 0 ){ n = 0; }
	}

	this.newPoint = 1;  this.newLng = new_lng;  this.newLat = new_lat;  this.newZoom = n;
}
//--------------------------------------------------------------------------------------------------
//□マーカー
function GMapMarker( type ){
	this.gicon		= "";
	this.iconfile	= "";
	this.filesuffix = [];
	this.naviprefix = [];

	if( type == "_center" ){
		this.marker		= "";
		this.width		= 0;
		this.height		= 0;
		this.marking	= GMapMarker_marking;
		this.remove		= GMapMarker_remove;
		this.movestart	= GMapMarker_movestart;
	}
}
//□マーカー - センターマーカーの表示
function GMapMarker_marking(){
	if( GMapInfo.urlPriorityType == "item" ){ return ; }			//アイテム閲覧中は非表示

	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-icon"   , 0 );
	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-shadow" , 0 );
	if( this.marker ){ GMapMap.gmap.removeOverlay( this.marker ); }				//センターマーカーを消す

	if( !GMapMap.userControl.centerMarker.visibility ){ return; }					//ユーザーが非表示にしている場合、表示しない
	this.marker = new GMarker( GMapMap.gmap.getCenter() , this.gicon );		//マーカーの作成
    GMapMap.gmap.addOverlay( this.marker );										//マーカーのを表示
	if( GMap_apiversion < 2 ){ this.marker.iconImage.style.cursor = "default"; }
}
//□マーカー - センターマーカーの削除
function GMapMarker_remove(){
	GMapMap.gmap.removeOverlay( this.marker );
	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-icon"   , 0 );				//マップ外センターマーカーを消去
	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-shadow" , 0 );
	this.marker = "";
}
//□マーカー - センターマーカーをマップ外センターマーカーに切り替え
function GMapMarker_movestart(){
	if( !GMapMap.userControl.centerMarker.visibility ){ return; }	//ユーザーが非表示にしている場合、表示しない
	if( GMapInfo.urlPriorityType == "item" ){ return ; }			//アイテム閲覧中は非表示
	this.remove();

	//マップ外センターマーカーの位置を再設定
	var GMap_obj  = document.getElementById( GMap_html_googleMap );
	var x = String( GMap_obj.offsetLeft + ( ( GMap_obj.offsetWidth  - this.width  + 1 ) / 2 ) + GMap_marker_center_adjust_x ) + "px";
	var y = String( GMap_obj.offsetTop  + ( ( GMap_obj.offsetHeight - this.height + 1 ) / 2 ) + GMap_marker_center_adjust_y ) + "px";
	document.getElementById( "GMap--icon-center-outer-icon" ).style.left = x;  document.getElementById( "GMap--icon-center-outer-icon" ).style.top = y;
	if( GMap_marker[ "_center" ].gicon.shadow ){ document.getElementById( "GMap--icon-center-outer-shadow" ).style.left = x;  document.getElementById( "GMap--icon-center-outer-shadow" ).style.top = y; }
	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-icon"   , 1 );	//表示
	GMapCommon.HTML.setDisplay( "GMap--icon-center-outer-shadow" , 1 );
}

//--------------------------------------------------------------------------------------------------
//□検索
var GMapSearch = new function(){
	this.status				= 0;		//マップ検索状態：0検索無し / 1検索有り
	this.count				= 0;
	this.dictionarySynonym	= [];
	this.init				= GMapSearch_init;

	this.clear				= GMapSearch_clear;
	this.dispMessage		= GMapSearch_dispMessage;
	this.search				= GMapSearch_search;
	this.geocoding			= GMapSearch_geocoding;

	this.itemName			= {};					//アイテム名検索
	this.itemName.name		= [];
	this.itemName.clear		= GMapSearch_itemName_clear;
	this.itemName.set		= GMapSearch_itemName_set;

	this.narrow				= {};					//絞り込み検索
	this.narrow.keys		= [];
	this.narrow.change		= GMapSearch_narrow_change;

	this.geocodingSearch				= {};			//住所検索
	this.geocodingSearch.value			= "";
	this.geocodingSearch.prevCategory	= "";
	this.geocodingSearch.result			= "";
	this.geocodingSearch.trimPrefix		= "（日本）|日本";

	this.geocodingSearch.template		= {};
	this.geocodingSearch.template.unmatch	= "<div class=\"GMap--message-negative\">見付かりませんでした。<br />キーワードを変えて再検索を行ってください。</div>";
	this.geocodingSearch.template.outer		= "<table>%html%</table>";
	this.geocodingSearch.template.row		= "<tr class=\"%row_class%\">%col%</tr>";
	this.geocodingSearch.template.col		= "<td onclick=\"%script%\" style=\"cursor: pointer;  color: #000000;  text-decoration: none;\">%address%</td>";

}
//□検索 - 初期化
function GMapSearch_init(){
	//類義語辞書を初期化登録
	var dic  = GMap_search_dic_synonym;
	if( dic ){
		dic = dic.replace( /\t/g , " " );  dic = dic.replace( /\s{2,}/g , " " );
		var temp_dic = dic.split( " " );
		for( var i = 0 ; i < temp_dic.length; i++ ){ this.dictionarySynonym[ this.dictionarySynonym.length ] = "(?:" + temp_dic[ i ].replace( /,/ , "|" ) + ")"; }	//HOGE,FOO ⇒ (?:HOGE|FOO|…)
	}
}
//□検索 - アイテム名検索 - 値のクリア
function GMapSearch_itemName_clear(){
	//ジオコーディングの場合、前のカテゴリに戻す
	if( GMap_focus_category == "_geocoding" ){
		GMap_focus_category = GMapSearch.geocodingSearch.prevCategory;
		GMapSearch.geocodingSearch.prevCategory = "";
	}

	this.name = [];
	GMapSearch.geocodingSearch.value	= "";
	GMapSearch.geocodingSearch.result = "";
}
//□検索 - アイテム名検索 - 値のセット
function GMapSearch_itemName_set( value ){
	GMapSearch.geocodingSearch.value = value;

	//類義語辞書処理
	for( var i = 0 ; i < GMapSearch.dictionarySynonym.length ; i++ ){
		var reg = new RegExp( GMapSearch.dictionarySynonym[ i ] , "i" );
		value = value.replace( reg , GMapSearch.dictionarySynonym[ i ] );
	}

	this.name = value.split( " " );
}
//□検索 - 絞り込み検索 - 条件の変更
function GMapSearch_narrow_change( key , num ){
	num = parseInt( num );		//数値化

	var tempNarrowSearchKeys = [];
	var flag_match = 0;
	for( var i = 0 ; i < this.keys.length ; i++ ){
		var reg = new RegExp( "^" + key + ":" );
		if( this.keys[ i ].match( reg ) &&  num ){ this.keys[ i ] = key + ":" + num;  flag_match = 1; }	//差し替え
		if( this.keys[ i ].match( reg ) && !num ){ flag_match = 1;  continue; }							//削除
		tempNarrowSearchKeys[ tempNarrowSearchKeys.length ] = this.keys[ i ];
	}
	if( !flag_match && num ){ tempNarrowSearchKeys[ tempNarrowSearchKeys.length ] = key + ":" + num; }	//追加
	this.keys = tempNarrowSearchKeys;
}
//□検索 - クリア
function GMapSearch_clear(){
	this.status		= 0;

	//ジオコーディングの場合、前のカテゴリに戻す
	if( GMap_focus_category == "_geocoding" ){
		GMap_focus_category = GMapSearch.geocodingSearch.prevCategory;
		GMapSearch.geocodingSearch.prevCategory = "";
	}

	if( GMap_focus_category ){ GMap_category[ GMap_focus_category ].marking(); }	//マーカーを引きなおす
	GMapCategoryNavi.create();														//カテゴリナビを作り直す
	GMapCommon.HTML.write( GMap_html_search_message , "" );
}
//□検索 - メッセージの表示
function GMapSearch_dispMessage(){
	if( this.count ){		//成功
		var resultMessage = "<div class=\"GMap--message-positive\">" + this.count + "件の" + GMap_item_name + "が見つかりました。</div>";
	} else {			//失敗（マッチ0件）
		var resultMessage = "<div class=\"GMap--message-negative\">1件も見つかりませんでした。</div>";
	}
	GMapCommon.HTML.write( GMap_html_search_message , resultMessage );
}
//□検索 - 検索処理
function GMapSearch_search(){
	GMapEX.callback( this , arguments );					//コールバック

	//ジオコーディング
	if( GMap_focus_category == "_geocoding" ){
		GMapSearch.geocoding();
		return; 
	}

	//検索結果をクリアにしておく
	this.count = 0;
	for( var category_id in GMap_category ){
		if( category_id == "clear" ){ continue; }
		GMap_category[ category_id ].clearSearchResultItems();	//検索結果のクリア
		GMap_category[ category_id ].clearSortCacheItems();		//ソートのキャッシュもクリア
	}

	//アイテム名検索の正規表現オブジェクト生成
	var reg_searchName = [];
	if( this.itemName.name.length ){
		for( i = 0 ; i < this.itemName.name.length ; i++ ){
			if( !this.itemName.name[ i ] ){ continue; }
			reg_searchName[ reg_searchName.length ] = new RegExp( this.itemName.name[ i ] , "i" );
		}
	}

	//検索条件が無い場合
	if( !this.itemName.name.length && !this.narrow.keys.length ){ this.clear();  return; }


	//検索開始
	LABEL_for01:
	for( var item_id in GMap_item ){
		if( item_id == "clear" ){ continue; }
		//アイテム名検索
		for( var i = 0 ; i < reg_searchName.length ; i++ ){ if( !GMap_item[ item_id ].name.match( reg_searchName[ i ] ) ){ continue LABEL_for01; } }

		//絞り込み検索
		for( var i = 0 ; i < this.narrow.keys.length ; i++ ){	//絞込み検索
			if( !GMap_narrowCondition[ this.narrow.keys[ i ] ] || GMap_narrowCondition[ this.narrow.keys[ i ] ].match( /;/ ) ){ continue; }
			if( !eval( GMap_narrowCondition[ this.narrow.keys[ i ] ].replace( /%([a-zA-Z][a-zA-Z0-9_]+)%/g , "GMap_item[ \"" + item_id + "\" ].data[ \"$1\" ]" ) ) ){ continue LABEL_for01; }
		}

		//以下マッチ結果処理
		GMap_category[ GMap_item[ item_id ].category ].addSearchResultItems( item_id );	//カテゴリに検索結果を追加
		this.count++;
	}

	//検索結果が存在する場合、もしくは住所検索が有効の場合、ステータスを1にしておく
	if( this.count || GMap_search_geocoding ){ this.status = 1; }

	GMapItemNavi.page.num = 1;														//ページを1にリセット
	if( GMap_focus_category ){ GMap_category[ GMap_focus_category ].marking(); }	//マーカーを引きなおす
	GMapCategoryNavi.create();														//カテゴリナビを作り直す

	if( !GMap_search_narrow_message && !this.itemName.name.length ){ return ; }		//絞り込み検索でメッセージ表示無し設定で、アイテム名検索無しの場合、メッセージを表示せず完了
	this.dispMessage();																	//メッセージを表示
}
//□検索 - ジオコーディング
function GMapSearch_geocoding( option ){
	if( !option ){ option = {}; }

	//ジオコーディング前のカテゴリを記録
	if( GMap_focus_category != "_geocoding" ){
		GMapSearch.geocodingSearch.prevCategory = GMap_focus_category;
		GMap_focus_category = "_geocoding";
	}

	//キーワード生成
	var keyword = GMapSearch.geocodingSearch.value;
	if( GMap_search_geocoding_joinPrefix ){	//プレフィックス付加がある場合
		keyword = keyword.replace( new RegExp( "^" + GMap_search_geocoding_joinPrefix.replace( /\s/g , "|" ) , "g" ) , "" );
		keyword = GMap_search_geocoding_joinPrefix.replace( /\s/g , "" ) + keyword;
	}

	//ジオコーディング検索
	var isLandmark = ( option.landmark ? true : false );
	GMapMap.geocoder.getLocations(
		keyword ,
		function( response ) {
			if( !response || response.Status.code != 200 ){	//失敗時
				GMapSearch.geocodingSearch.result = GMapSearch.geocodingSearch.template.unmatch;
			} else {
				//HTMLを作成
				var html = "";
				for( var i = 0 ; i < response.Placemark.length ; i++ ){
					var replace_list = {};
					var placemark = response.Placemark[ i ];
					var lng = placemark.Point.coordinates[ 0 ];  var lat = placemark.Point.coordinates[ 1 ];
					//列
					var replace_list = { 
						address	: placemark.address.replace( new RegExp( "^" + GMapSearch.geocodingSearch.trimPrefix ) , "" ) , 
						script	: "return GMapFunc.move.toLatLng( event , " + lat + " , " + lng + " );"
					};
					//行
					var replace_list = { 
						col 		: GMapCommon.String.convTemplate( GMapSearch.geocodingSearch.template.col , replace_list ) , 
						row_class	: ( GMap_itemNavi_rowStrips && i % 2 != 1 ? "GMap--itemNavi-row-strips" : "" ) 
					};
					html += GMapCommon.String.convTemplate( GMapSearch.geocodingSearch.template.row , replace_list );
				}
				GMapSearch.geocodingSearch.result = GMapCommon.String.convTemplate( GMapSearch.geocodingSearch.template.outer , { html : html } );
			}

			GMapItemNavi.make();
		}
	);
}
//--------------------------------------------------------------------------------------------------
//□ソート
var GMapSort = new function(){
	this.status			= 0;		//状態
	this.key			= "";		//ソートするキー
	this.desc			= 0;		//昇順/降順
	this.type			= "string";	//型
	this.distance		= 0;		//距離ソート
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.init					= GMapSort_init;
	this.clear					= GMapSort_clear;
	this.setSortVar				= GMapSort_setSortVar;
}
function GMapSort_init(){
	if( GMap_default_sort ){ this.setSortVar( GMap_default_sort ); }	//初期ソートがある場合値をセット
}
//□ソート - クリア
function GMapSort_clear(){
	this.status = 0;  this.key = "";  this.desc = 0;  this.itemNaviFormat	 = "";
	GMapItemNavi.page.num = 1;										//ページを1にリセット
	for( var category_id in GMap_category ){
		if( category_id == "clear" ){ continue; }
		GMap_category[ category_id ].clearSortCacheItems();			//ソートのキャッシュもクリア
	}
}
//□ソート - ソート変数のセット
function GMapSort_setSortVar( sortKey ){
	this.status	= 1;
	GMapItemNavi.page.num = 1;										//ページを1にリセット

	sortKey.match( /^([a-zA-Z0-9_-]+)(\s.+)?$/i );
	var option = RegExp.$2;

	if( RegExp.$1 == "_distance" ){		//現在地からの距離順
		this.distance = 1;
	} else {							//通常ソート
		this.distance = 0;
		this.key = RegExp.$1;

		this.desc = ( option.match( /desc/ ) ? 1 : 0 );					//降順
		this.type = ( option.match( /num/  ) ? "number" : "string" );	//数値
	}

	this.itemNaviFormat = ( option.match( /navi:(.+)/ ) ? RegExp.$1 : "" );	//アイテムナビのフォーマット
}
//--------------------------------------------------------------------------------------------------
//□カテゴリ・ナビゲーション
var GMapCategoryNavi = new function(){
	this.id			= "";
	this.html		= "";
	this.group		= {};
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.template		= {};
	this.template.outer	= "<select id=\"gmap--categoryNavi-select\" onclick=\"GMapCategoryNavi.click( this );\">%html%</select>";
	this.template.group	= "　<optgroup label=\"%group_name%\">%html%</optgroup>";
	this.template.inner	= "<option id=\"gmap--categoryNavi-listItem-%html_id%\" value=\"%category_id%\"%selected%>%name%</option>";

	this.innerUndefined		= "<option id=\"gmap--categoryNavi-listItem--undefined\" value=\"-\" selected>%GMap_category_name%を選択して下さい。</option>";
	this.innerSearchUnmatch	= "<option id=\"gmap--categoryNavi-listItem--undefined\" value=\"%category_id%\" selected>%GMap_category_name%を選択して下さい。</option>";
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.init	= GMapCategoryNavi_init;
	this.add	= GMapCategoryNavi_add;
	this.change	= GMapCategoryNavi_change;
	this.make	= GMapCategoryNavi_make;
	this.clear	= GMapCategoryNavi_clear;
	this.create	= GMapCategoryNavi_create;
	this.click	= GMapCategoryNavi_click;
}
//□カテゴリ・ナビゲーション - 初期化
function GMapCategoryNavi_init(){
	this.id = GMap_html_categoryNavi;

	//アイテム名とカテゴリ名を挿入
	var replace_list = {};
	replace_list[ "GMap_category_name" ] = GMap_category_name;
	this.innerUndefined		= GMapCommon.String.convTemplate( this.innerUndefined , replace_list );
	this.innerSearchUnmatch	= GMapCommon.String.convTemplate( this.innerSearchUnmatch , replace_list );
}
//□カテゴリ・ナビゲーション - 追加
function GMapCategoryNavi_add( category_id ){
	if( !this.id || category_id == "clear" ){ return ; }
	if( category_id == "_all" && GMap_category_all == 0 && GMap_focus_category != "_all" ){ return ;}
	if( category_id == "_map" && GMap_category_map == 0 && GMap_focus_category != "_map" ){ return ;}

	var replace_list = {};
	replace_list[ "category_id" ] = category_id;  replace_list[ "name" ] = ( category_id != "_geocodingSearch" ? GMap_category[ category_id ].name : "住所検索結果" );  replace_list[ "selected" ] = ( category_id == GMap_focus_category ? " selected=\"selected\"" : "" );  replace_list[ "html_id" ] = category_id.replace( /^_/ , "-" );

	var html = GMapCommon.String.convTemplate( this.template.inner , replace_list );
	if( GMap_category[ category_id ] && GMap_category[ category_id ].group ){
		if( !this.group[ GMap_category[ category_id ].group ] ){ this.group[ GMap_category[ category_id ].group ] = ""; }
		this.group[ GMap_category[ category_id ].group ] += html;
	} else {
		this.html += html;
	}
}
//□カテゴリ・ナビゲーション - 変更
function GMapCategoryNavi_change( category_id ){
	document.getElementById( "gmap--categoryNavi-select" ).value = category_id;
}
//□カテゴリ・ナビゲーション - クリア
function GMapCategoryNavi_clear(){
	if( this.id ){ document.getElementById( !this.id ).innerHTML = ""; }
}
//□カテゴリ・ナビゲーション - 設置
function GMapCategoryNavi_create(){
	//初期カテゴリが未指定の場合
	if( !GMap_focus_category ){ this.html = this.innerUndefined + this.html; }

	for( var category_id in GMap_category ){
		if( category_id == "clear" ){ continue; }

		//検索でマッチしない場合
		if( GMapSearch.status && category_id != "_all" && !GMap_category[ category_id ].searchResultItems.length ){
			if( GMap_focus_category == category_id ){	//「～を選択して下さい。」を表示
				var replace_list = {};
				replace_list[ "category_id" ] = category_id;  replace_list[ "name" ] = GMap_category[ category_id ].name;
				this.html = GMapCommon.String.convTemplate( this.innerSearchUnmatch , replace_list ) + this.html;
			}
			continue;
		}

		this.add( category_id );
	}

	//検索時は住所検索の結果を表示するようにする
	if( GMapSearch.status && GMap_search_geocoding ){ GMapCategoryNavi.add( "_geocodingSearch" ); }

	this.make();
}
//□カテゴリ・ナビゲーション - 生成
function GMapCategoryNavi_make(){
	if( !this.id ){ return; }

	var html = this.html;

	//グループの処理
	for( var group_name in this.group ){
		var replace_list = {};
		replace_list[ "group_name" ] =  group_name;  replace_list[ "html" ] = this.group[ group_name ];
		html += GMapCommon.String.convTemplate( this.template.group , replace_list );
	}

	//全体の処理
	var replace_list = {};
	replace_list[ "html" ] = html;
	document.getElementById( this.id ).innerHTML = GMapCommon.String.convTemplate( this.template.outer , replace_list );

	this.html = "";  this.group = {};		//生成したらクリア
}
//□カテゴリ・ナビゲーション - クリック
function GMapCategoryNavi_click( form ){
	if( form.value == "_geocodingSearch" ){ GMapSearch.geocoding();  return; }
	if( GMap_focus_category == form.value ){ return ; }	//同じだと最初のクリック（onchangeにしていないのは、IEでマウスホイールのバグがある為）
	GMap_category[ form.value ].change();
}
//--------------------------------------------------------------------------------------------------
//□アイテム・ナビゲーション
var GMapItemNavi = new function(){
	this.id			= "";
	this.html		= "";
	this.firstID	= "";
	this.tempCount	= 0;

	this.page		= {};
	this.page.num	= 1;
	this.page.items	= 0;
	this.page.qty	= 1;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.template				= {};
	this.template.outer			= "<div class=\"ItemList\">%html%</div>";
	this.template.inner			= {};
	this.template.inner.row		= "<p class=\"%row_class%\">%col1%%col2%%col3%</p>";
	this.template.inner.col1	= "<a href=\"\" id=\"GMap--itemNavi-countLabel-%item_id%\" accesskey=\"%countLabel%\" onclick=\"%function_openInfoWindow%\" onfocus=\"%function_openInfoWindow%\" onkeydown=\"GMapItemNavi.changeFocus( event );\" style=\"cursor: pointer;  color: #000000;  text-decoration: none;\">%countInnerHTML%</a>";
	this.template.inner.col2	= "<span class=\"ItemName\" unselectable=\"on\" onclick=\"%function_openInfoWindow%\" style=\"cursor: pointer; text-decoration: none;\">%name%</span>";
	this.template.inner.col3	= "%thirdRow%";
	this.template.pageNavi		= "<div style=\"text-align: center;\"><a style=\"color: #333333;\" href=\"\"%prev_attr%>前のページ</a>&nbsp;&nbsp;( %pageInfo% )&nbsp;&nbsp;<a style=\"color: #333333;\" href=\"\"%next_attr%>次のページ</a></div>";

	this.innerEmpty			= "<div class=\"GMap--message-negative\"></div>";
	this.innerSearchUnmatch = "<div class=\"GMap--message-negative\">%GMap_category_name%には検索結果にマッチする%GMap_item_name%は存在しません。<br /><br /><span onclick=\"GMapCategoryNavi.change( '_all' );  GMap_category[ '_all' ].change( 'AUTOCENTERING:2' );\" style=\"cursor: pointer;  text-decoration: underline;\">マップ上にすべて表示する場合はクリック</span></div>";
	this.innerSearchAddress = "<div class=\"GMap--message-negative\"><span onclick=\"GMapCategoryNavi.change( '_geocodingSearch' );  GMapSearch.geocoding();\" style=\"cursor: pointer;  text-decoration: underline;\">住所検索を行う場合はクリック</span></div>";
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.init			= GMapItemNavi_init;
	this.add			= GMapItemNavi_add;
	this.makeThirdRow	= GMapItemNavi_makeThirdRow;
	this.changeFocus	= GMapItemNavi_changeFocus;
	this.clear			= GMapItemNavi_clear;
	this.make			= GMapItemNavi_make;
	this.openInfoWindow = GMapItemNavi_openInfoWindow;
	this.changePage		= GMapItemNavi_changePage;
	this.checkAutoZoom	= GMapItemNavi_checkAutoZoom;
}
//□アイテム・ナビゲーション - 初期化
function GMapItemNavi_init(){
	this.id = GMap_html_itemNavi;
	this.page.items = GMap_itemNavi_page_items;

	//スクロールバーの調整
	if( this.id ){
		var obj = document.getElementById( this.id );
		if(      GMap__ua.MSIE  ){ obj.style.overflowY = "auto";  obj.style.overflowX = "hidden"; }	//IE
		else if( GMap__ua.Gecko ){ obj.style.overflow  = "-moz-scrollbars-vertical"; }				//Gecko系
		else					   { obj.style.overflow  = "auto"; }									//Safariとか（実現できず）
	}

	//自動ズーム（マップ上のアイテムをすべて表示）が有効かチェック
	if( GMap_html_itemNavi_autoZoom ){ GMapItemNavi.checkAutoZoom(); }
}
//□アイテム・ナビゲーション - 追加
function GMapItemNavi_add( item_id , count , marker_id ){
	if( !this.id ){ return; }
	if( !this.html ){ this.firstID = "GMap--itemNavi-countLabel-" + item_id; }			//一番上のIDを記録しておく（フォーカスを当てる為）
	this.tempCount++;

	var replace_list = {};
	replace_list[ "item_id" ] = item_id;  replace_list[ "count" ] = count;  replace_list[ "name" ] = GMap_item[ item_id ].name;

	//カウンタラベルの生成
	if( !marker_id || !GMap_marker[ marker_id ] ){ marker_id = "_default"; }
	replace_list[ "countLabel" ] = ( GMap_marker[ marker_id ].naviprefix[ count ] ? GMap_marker[ marker_id ].naviprefix[ count ] : GMap_marker[ marker_id ].naviprefix[ 0 ] );
	replace_list[ "countInnerHTML" ] = replace_list[ "countLabel" ];

	//カウンターマーカーの作成
	if( GMap_marker[ "itemnavi:" + marker_id ] != undefined ){
		var countMarkerFilename = GMap_marker[ "itemnavi:" + marker_id ].iconfile.replace( "%count%" , ( GMap_marker[ "itemnavi:" + marker_id ].filesuffix[ count ] ? GMap_marker[ "itemnavi:" + marker_id ].filesuffix[ count ] : GMap_marker[ "itemnavi:" + marker_id ].filesuffix[ 0 ] ) );
		if( GMap_focus_category == "_map" && GMap__ua.MSIE <= 6 && navigator.userAgent.match( /SV1/ ) ){		//IE 非SP2 暫定処理
			replace_list[ "countInnerHTML" ] = "<img src=\"" + countMarkerFilename + "\" width=\"" + GMap_marker[ "itemnavi:" + marker_id ].width + "\" height=\"" + GMap_marker[ "itemnavi:" + marker_id ].height + "\" alt=\"" + replace_list[ "countLabel" ] + "\" style=\"border: 0;\" />";
		} else {	//通常処理
			replace_list[ "countInnerHTML" ] = GMapCommon.HTML.makePngTag( countMarkerFilename , GMap_marker[ "itemnavi:" + marker_id ].width , GMap_marker[ "itemnavi:" + marker_id ].height , { style : "border: 0;" , title : replace_list[ "countLabel" ] , alt : replace_list[ "countLabel" ] } );
		}
	}

	//ソート値の生成
	replace_list[ "thirdRow" ] = this.makeThirdRow( item_id );
	replace_list[ "main_colspan" ] = ( replace_list[ "thirdRow" ] ? 1 : 2 );


	//属性（共通）
	replace_list[ "function_openInfoWindow" ] = "GMapItemNavi.openInfoWindow( event , this , '" + item_id + "' , " + count + " );";


	//各列部分の置換
	replace_list[ "row_class" ] = ( GMap_itemNavi_rowStrips && this.tempCount % 2 != 1 ? "GMap--itemNavi-row-strips" : "" );
	replace_list[ "col1" ] = ( GMap_itemNavi_countColumn ? GMapCommon.String.convTemplate( this.template.inner.col1 , replace_list ) : "" );
	replace_list[ "col2" ] = GMapCommon.String.convTemplate( this.template.inner.col2 , replace_list );
	replace_list[ "col3" ] = ( replace_list[ "thirdRow" ] ? GMapCommon.String.convTemplate( this.template.inner.col3 , replace_list ) : "" );

	this.html += GMapCommon.String.convTemplate( this.template.inner.row , replace_list );
}
//□アイテム・ナビゲーション - 3列目の作成
function GMapItemNavi_makeThirdRow( item_id ){
	var value = "";  var format = "";

	//ソートがある場合、それを優先する
	if( GMapSort.itemNaviFormat && GMapSort.distance ){										//現在地からの距離順
		format = GMapSort.itemNaviFormat;
		value = GMap_item[ item_id ].distance;
	} else if( GMapSort.itemNaviFormat && GMapSort.status && GMapSort.itemNaviFormat ){	//通常ソート
		format = GMapSort.itemNaviFormat;
		value = GMap_item[ item_id ].data[ GMapSort.key ];
	} else if( GMap_itemNavi_thirdRow ){														//設定でキー指定
		var temp = GMap_itemNavi_thirdRow.split( " " );
		format = ( temp[ 1 ] ? temp[ 1 ] : "" );
		value = GMap_item[ item_id ].data[ temp[ 0 ] ];
	}

	//コールバックの戻り値がある場合、それを優先
	var callback = GMapEX.callback( this , arguments , item_id , value , format );		//コールバック
	if( callback.cancelParentProcess ){ return callback.returnValue.result;   }
	if( callback.returnValue && callback.returnValue.format  ){ format = callback.returnValue.format; }
	if( callback.returnValue && callback.returnValue.value   ){ value  = callback.returnValue.value;  }

	//sprintf関数で変換
	if( value && format ){ value = GMapCommon.String.sprintf( format , value ); }

	return value;
}

//□アイテム・ナビゲーション - フォーカスを移す
function GMapItemNavi_changeFocus( event ){
	if( !GMap__ua.MSIE ){ return ; }
	if( event.shiftKey || event.keyCode == 9 ){ return ; }		//タブキーはそのまま
	GMapMap.gmap.closeInfoWindow();							//情報ウィンドウを閉じる
	document.getElementById( GMap_html_googleMap ).focus();	//それ以外は、マップにフォーカス
}
//□アイテム・ナビゲーション - クリア
function GMapItemNavi_clear(){
	if( !this.id ){ return; }
	document.getElementById( GMap_html_itemNavi ).innerHTML = "";
}
//□アイテム・ナビゲーション - 生成
function GMapItemNavi_make(){
	if( !this.id ){ return; }

	if( this.html ){	//通常処理
		var replace_list = {};
		replace_list[ "html" ] = this.html;

		this.html = GMapCommon.String.convTemplate( this.template.outer , replace_list );

		//ページモードの場合で、ページ数が2ページ以上の場合
		if( GMapItemNavi.page.items && this.page.qty >= 2 ){
			var replace_list = {};
			replace_list[ "prev_attr" ] = " onclick=\"GMapItemNavi.changePage( event , " + ( this.page.num - 1 ) + " )\"" + ( this.page.num == 1 ? " disabled=\"disabled\"" : "" );
			replace_list[ "next_attr" ] = " onclick=\"GMapItemNavi.changePage( event , " + ( this.page.num + 1 ) + " )\"" + ( this.page.num == this.page.qty ? " disabled=\"disabled\"" : "" );
			replace_list[ "pageInfo" ]  = this.page.num + " / " + this.page.qty;
			var pageNavi = GMapCommon.String.convTemplate( this.template.pageNavi , replace_list );
			this.html = pageNavi + this.html + pageNavi;
		}
	} else {			//1件も存在しない場合のメッセージ
		var replace_list = {};
		replace_list[ "GMap_category_name" ] = ( GMap_focus_category != "_map" ? "この" + GMap_category_name : "マップ内" );
		replace_list[ "GMap_item_name" ] = GMap_item_name;

		if(  GMapSearch.status ){			//検索の場合
			if( !GMapSearch.geocodingSearch.result ){
				if( GMapSearch.count		){ this.html  = GMapCommon.String.convTemplate( this.innerSearchUnmatch , replace_list ); }
				if( GMap_search_geocoding ){ this.html += GMapCommon.String.convTemplate( this.innerSearchAddress , replace_list ); }
			} else {	//ジオコーディング結果がある場合
				this.html = GMapSearch.geocodingSearch.result;
			}
		} else if( !GMapSearch.status ){	//検索でない場合（「マップ内のアイテムを表示」）
			this.html = GMapCommon.String.convTemplate( this.innerEmpty , replace_list );
		}
	}

	document.getElementById( GMap_html_itemNavi ).innerHTML = this.html;
	this.html = "";		//生成したらクリア
	this.tempCount = 0;
}
//□アイテム・ナビゲーション - 情報ウィンドウを開く
function GMapItemNavi_openInfoWindow( event , obj , item_id , count ){
	if( event.shiftKey && obj.tagName != "A" ){		//シフトキーを押しているとセンタリングだけする（アルファベットは除く）
		GMap_item[ item_id ].moveCenter();
	} else {										//通常処理
		GMap_item[ item_id ].openInfoWindowByItemNavi( count );
	}

	return 	GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□アイテム・ナビゲーション - ページの変更
function GMapItemNavi_changePage( event , pageNo ){
	if( 1 <= pageNo && pageNo <= this.page.qty ){
		this.page.num = pageNo;
		GMap_category[ GMap_focus_category ].marking();
	}
	return 	GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□アイテム・ナビゲーション - 自動ズーム（マップ上のアイテムをすべて表示）が有効かチェック
function GMapItemNavi_checkAutoZoom(){
	if( GMap_focus_category == "_geocoding" ){ return false; }
	var map_boudns = bounds = GMapMap.gmap.getBounds();
	var tempSW = map_boudns.getSouthWest();  var tempNE = map_boudns.getNorthEast();
	var category_bounds	= GMap_category[ GMap_focus_category ].bounds;
	var obj = document.getElementById( GMap_html_itemNavi_autoZoom );

	//すべてのアイテムがマップ内の場合、自動ズームを無効にする
	if( tempSW.x < category_bounds.minLng && category_bounds.maxLng < tempNE.x && tempSW.y < category_bounds.minLat && category_bounds.maxLat < tempNE.y ){
		obj.disabled = true;   obj.style.cursor = "default";
	} else {
		obj.disabled = false;  obj.style.cursor = "auto";
	}
}
//--------------------------------------------------------------------------------------------------
//□マップ情報
var GMapInfo = new function(){
	this.urlPriorityType 	= "";
	this.active 			= ( ( GMap_html_mapInfo_url || GMap_html_mapInfo_point ) ? 1 : 0 );
	this.url				= "";
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.xmlInfo			= {};				//XMLからのデータが入る（以下同）
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.dispURL_extraArg	= "";				//追加引数
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.dispURL				= GMapInfo_dispURL;
	this.dispPoint				= GMapInfo_dispPoint;
	this.getType				= GMapInfo_getType;
	this.getURL					= GMapInfo_getURL;
	this.setURL					= GMapInfo_setURL;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.userMessageEditor			= {};
	this.userMessageEditor.message	= "";
	this.userMessageEditor.html		= "<textarea id=\"gmap--mapInfo-userMessageEditor-textarea\" onblur=\"GMapInfo.userMessageEditor.onblur( this );\" style=\"width: 200px;  height: 60px;\">%message%</textarea><br /><input type=\"button\" onclick=\"GMapInfo.userMessageEditor.submit();\" value=\"決定\" style=\"width: 100px;  letter-spacing: 1em;\"> <input type=\"button\" onclick=\"GMapMap.gmap.closeInfoWindow();\" value=\"キャンセル\" style=\"width: 100px;\">";
	this.userMessageEditor.open		= GMapInfo_userMessageEditor_open;
	this.userMessageEditor.submit	= GMapInfo_userMessageEditor_submit;
	this.userMessageEditor.onblur	= GMapInfo_userMessageEditor_onblur;
}
//□マップ情報 - 「このページのURL」の表示
function GMapInfo_dispURL(){
	var tempObj = document.getElementById( GMap_html_mapInfo_url );
	if( tempObj.tagName != "INPUT" ){ tempObj.innerHTML = this.url; } else { tempObj.value = this.url; }	//インプットタグの場合は値を、それ以外はいつも通り、innerHTML
}
//□マップ情報 - 「緯度／経度」の表示
function GMapInfo_dispPoint( lng , lat ){
	var result = "";
	if( GMap_mapInfo_point_base == 60 ){		//60進数
		switch( GMap_mapInfo_point_base60_language ){	//表示言語の指定
			case "jp"	: var lang = [ "東経" , "西経" , "北緯" , "南緯" , "度" , "分" , "秒" ];  break;	//見てのとおり日本語
			case "sign"	: var lang = [ "E" , "W" , "N" , "S" , "°" , "′" , "″" ];  break;				//見てのとおり記号（英語）
		}
		var decimalDigit = GMap_mapInfo_point_base60_decimalDigit;

		var base60_lng = GMapCommon.Map.convBase10ToBase60( lng );	//10進数から60進数に変換
		base60_lng.match( /^(.)([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?$/ );
		var result_lng = ( RegExp.$1 == "+" ? lang[ 0 ] : lang[ 1 ] ) + RegExp.$2 + lang[ 4 ] + RegExp.$3  + lang[ 5 ] + RegExp.$4 + lang[ 6 ] + ( decimalDigit ? RegExp.$5.substring( 1 , ( decimalDigit + 1 ) ) : "" );

		var base60_lat = GMapCommon.Map.convBase10ToBase60( lat );
		base60_lat.match( /^(.)([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?$/ );
		var result_lat = ( RegExp.$1 == "+" ? lang[ 2 ] : lang[ 3 ] ) + RegExp.$2 + lang[ 4 ] + RegExp.$3  + lang[ 5 ] + RegExp.$4 + lang[ 6 ] + ( decimalDigit ? RegExp.$5.substring( 1 , ( decimalDigit + 1 ) ) : "" );
	} else {		//10進数
		var decimalDigit = GMap_mapInfo_point_base10_decimalDigit;
		var temp = String( lng ).split( "." );  var result_lng = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , decimalDigit );
		var temp = String( lat ).split( "." );  var result_lat = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , decimalDigit );
	}
	var result = GMap_mapInfo_point_format;
	result = result.replace( "%lng%" , result_lng );
	result = result.replace( "%lat%" , result_lat );

	document.getElementById( GMap_html_mapInfo_point ).innerHTML = result;
}
//□マップ情報 - タイプの取得
function GMapInfo_getType(){
	var temp_type = GMapMap.gmap.getCurrentMapType();	//タイプの取得と変換
	if(      temp_type == G_SATELLITE_MAP ){ var type = "satellite"; }
	else if( typeof( G_HYBRID_MAP ) != "undefined" && temp_type == G_HYBRID_MAP ){ var type = "hybrid"; }
	else { var type = "map"; }

	return type;
}
//□マップ情報 - 「このページのURL」の取得
function GMapInfo_getURL(){
	return this.url;
}
//□マップ情報 - 「このページのURL」のセット
function GMapInfo_setURL( type ){
	var arg = arguments;
	if( this.urlPriorityType ){  //優先指定されている場合
		if( this.urlPriorityType == "location" ){ this.urlPriorityType = "";  return ; }		//locationは初回のみでクリア
		else { return ; }																	//それ以外
	}

	//有効でないタイプの場合は、point にする
	if( type != "point" && ( !GMap_mapInfo_point_enableType || !type.match( new RegExp( GMap_mapInfo_point_enableType.replace( /,|\t|\s/g , "|" ) , "i" ) ) ) ){
		if( type == "location" ){ return; } else { type = "point"; }
	}

	if( type == "item" || type == "location" ){ this.urlPriorityType = type; }	//アイテム表示中に移動した場合、座標になってしまう為（情報ウィンドウが消えたらオフ
	if( type == "item" && !arg[ 1 ] ){ return ; }								//ユーザーメッセージの場合
	if( type == "point" && ( !arg[ 1 ] || !arg[ 2 ] ) ){						//座標未指定の場合
		var center = GMapMap.gmap.getCenter();
		var temp = String( center.x ).split( "." );  arg[ 1 ] = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , 5 );	//小数点以下5桁にする
		var temp = String( center.y ).split( "." );  arg[ 2 ] = temp[ 0 ] + "." + temp[ 1 ].substring( 0 , 5 );
	}

	//URLの引数の作成
	var urlArg = "http://" + location.host + location.pathname + "?" + this.dispURL_extraArg;
	switch( type ){
		case "category"	: urlArg += "category=" + arg[ 1 ];  break;							//カテゴリ
		case "item"		: urlArg += "item=" + arg[ 1 ];  break;								//アイテム
		case "point"	: urlArg += "lng=" + arg[ 1 ] + "&lat=" + arg[ 2 ] + ( GMap_focus_category != undefined ? "&category=" + GMap_focus_category : "" );  break;		//座標
		case "location" : urlArg += location.search.replace( /^\?/ , "" );  break;					//URL引数
	}
	if( type != "location" ){	
		var temp_type = this.getType();  var temp_zoom = GMapMap.gmap.getZoom();
		urlArg += ( temp_zoom != GMap_default_zoom	? "&zoom=" + temp_zoom : "" );		//ズーム
		urlArg += ( temp_type != GMap_default_type	? "&type=" + temp_type : "" );		//タイプ
		urlArg += ( GMap_import_current_file && GMap_import_current_file != GMap_import_file ? "&import="	+ GMap_import_current_file : "" );		//XMLファイル名
	}
	if( this.userMessageEditor.message && type != "item" ){	//ユーザーメッセージ
		urlArg += "&message=" + this.userMessageEditor.message;
	}

	this.url = urlArg;

	//「このページのURL」表示欄がある場合
	if( GMap_html_mapInfo_url ){ this.dispURL(); }
}
//□マップ情報 - ユーザーメッセージ編集機能 - 開く
function GMapInfo_userMessageEditor_open(){
	var html 		= this.html;
	var message		= decodeURIComponent( this.message );
	message = GMapCommon.HTML.encode( message );			//エンコードしてタグを無効化
	message = message.replace( "|" , "\n" );				// | を改行に変換
	html = GMapCommon.String.convTemplate( html , { message : message } );	//既にあるメッセージを置換

	var center		= GMapMap.gmap.getCenter();
	var layoutSize	= GMapCommon.HTML.getLayoutSize( html );
	GMapMap.gmap.openInfoWindowHtml( new GLatLng( center.y , center.x ) , "<div class=\"gmap--infoWindow-userMessage\" style=\"width: " + ( layoutSize.width + 20 ) + "px;  height: " + layoutSize.height + "px;\">" + html + "</div>" );
}
//□マップ情報 - ユーザーメッセージ編集機能 - 実行
function GMapInfo_userMessageEditor_submit(){
	var message = document.getElementById( "gmap--mapInfo-userMessageEditor-textarea" ).value;
	message = message.replace( "\n" , "|" );				//改行を|に変換
	message = encodeURIComponent( message );
	this.message = message;
	GMapMap.gmap.closeInfoWindow();
	GMapInfo.setURL( "point" );							//「このページのURL」をセット
}
//□マップ情報 - ユーザーメッセージ編集機能 - フォーカスを失った場合
function GMapInfo_userMessageEditor_onblur( obj ){
	if( GMapMap.infoWindow.currentItemID ){ obj.focus(); }	//情報ウィンドウが開いている場合はフォーカスを保つ
}
//--------------------------------------------------------------------------------------------------
//□拡張
var GMapEX = new function(){
	this.callbackList	= [];
	this.addCallback	= GMapEX_addCallback;
	this.callback		= GMapEX_callback;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.plugInList		= [];
	this.addPlugIn		= GMapEX_addPlugIn;
	this.isPlugInExist	= GMapEX_isPlugInExist;
}
//□拡張 - コールバックの追加
function GMapEX_addCallback( callFunc , procFunc ){
	if( this.callbackList[ callFunc ] == undefined ){ this.callbackList[ callFunc ] = []; }	//未定義の場合Arrayを作る
	this.callbackList[ callFunc ][ this.callbackList[ callFunc ].length ] = procFunc;		//追加
}
//□拡張 - コールバック処理
function GMapEX_callback( ref , arg ){
	var callFunc = arg.callee;
	if( this.callbackList[ callFunc ] == undefined ){ return false; }	//未定義
	ref.arg = arg;
	var result = { cancelParentProcess : false , returnValue : null }

	//引数の作成
	var arg = [];
	for( var i = 2 ; i < arguments.length ; i++ ){ arg[ i - 2 ] = arguments[ i ]; }

	//追加した分だけ繰り返す
	for( var i = 0 ; i < this.callbackList[ callFunc ].length ; i++ ){
		var func = this.callbackList[ callFunc ][ i ];
		if( !func ){ continue; }
		var temp_ret = func.apply( ref , arg );
		if( temp_ret ){		//戻り値がある場合
			if( temp_ret.cancelParentProcess	){ result.cancelParentProcess	= temp_ret.cancelParentProcess; }
			if( temp_ret.returnValue			){ result.returnValue			= temp_ret.returnValue; }
		}
	}
	return result;
}
//□拡張 - プラグインを登録する
function GMapEX_addPlugIn( plugInName , version , compatibilityVersion ){
	if( compatibilityVersion != undefined && GMap__version < compatibilityVersion ){ GMapCommon.Error.trigger( "設定エラー：プラグイン（ " + plugInName + " ）は、この GMap本体のバージョンでは動作しません。" , "i003" );  return; }

	this.plugInList[ this.plugInList.length ] = plugInName;
}
//□拡張 - プラグインが登録されているかチェックする
function GMapEX_isPlugInExist( plugInName ){
	for( var i = 0 ; i < this.plugInList.length ; i++ ){ if( this.plugInList[ i ] == plugInName ){ return true; } }
	return false;
}
//--------------------------------------------------------------------------------------------------
//□カテゴリデータ
function GMapDataCategory( category_id , name , lng , lat , group ){
	GMap_category[ category_id ] = new GMapCategory( category_id , name , lng , lat , group );
}
//□アイテムデータ
function GMapDataItem( item_id , category_id , name , lng , lat ){
	if( !GMap_category[ category_id ] ){ GMapCommon.Error.trigger( "データインポートエラー：" + name + "（" + item_id + " ）のカテゴリ（ " + category_id + " ）が定義されていません。" , "i002" , 0 );        }
	GMap_item[ item_id ] = new GMapItem( item_id , category_id , name , lng , lat , arguments , "" );
}
//□XMLファイルからデータをインポート
function GMapDataImportXML( xmlDoc ){
	GMapEX.callback( this , arguments , xmlDoc );		//コールバック

	//GMap情報を変数に収納
	GMap__title = GMapCommon.XML.getValueByUniqueTag( xmlDoc , "title" );	//タイトル取得（マップナビプラグインの下位互換の為）
	GMapInfo.xmlInfo = {};	//初期化
	var GMapinfo = [ "title" , "link" , "author" , "generator" , "createdate" , "lastupdate" ];		//基本データ
	for( var i = 0 ; i < GMapinfo.length ; i++ ){ GMapInfo.xmlInfo[ GMapinfo[ i ] ] = GMapCommon.XML.getValueByUniqueTag( xmlDoc , GMapinfo[ i ] ); }

	//各種データをインポート
	GMapDataImportXML_xml2data( xmlDoc , "category" );	//カテゴリのインポート
	GMapDataImportXML_xml2data( xmlDoc , "item"     );	//アイテムのインポート
	GMapDataImportXML_xml2data( xmlDoc , "template" );	//テンプレートのインポート
}
//□XMLファイルからデータをインポートする - XMLをデータに変換
function GMapDataImportXML_xml2data( xmlDoc , type ){
	var count_max	= Infinity;
	switch( type ){
		case "category" : count_max = GMap_import_maxCategorys;	break;
		case "item"     : count_max = GMap_import_maxItems;		break;
	}
	var temp_xmlData = xmlDoc.documentElement.getElementsByTagName( type );	//カテゴリタグ
	for( var i = 0 ; i < temp_xmlData.length ; i++ ){	//すべてのデータタグからデータを取得
		var iData = GMapCommon.XML.convAttributesToArray( temp_xmlData[ i ] );	//属性を配列に入れ替える
		iData[ "flagXML" ]  = 1;								//XMLデータである識別フラグ
		iData[ "_html" ]    = GXml.value( temp_xmlData[ i ] );	//要素をhtmlキーとして入れておく

		//データを定義
		switch( type ){
			case "category" :	//カテゴリ
				GMap_category[ iData[ "id" ] ] = new GMapCategory( iData[ "id" ] , iData[ "name" ] , iData[ "lng" ] , iData[ "lat" ] , iData[ "group" ] );
				break;
			case "item" :		//アイテム
				if( !GMap_category[ iData[ "category" ] ] ){ GMapCommon.Error.trigger( "データインポートエラー：" + iData[ "name" ] + "（ " + iData[ "id" ] + " ）のカテゴリ（ " + iData[ "category" ] + " ）が定義されていません。" , "i002" , 0 );  break; }
				GMap_item[     iData[ "id" ] ] = new GMapItem( iData[ "id" ] , iData[ "category" ] , iData[ "name" ] , iData[ "lng" ] , iData[ "lat" ] , "" , iData );
				break;
			case "template" :	//テンプレート
				if( iData[ "id" ] == undefined ){ iData[ "id" ] = "undefined"; }
				GMap_template[ iData[ "id" ] ] = { html : iData[ "_html" ] , attribute : iData };
				break;
		}

		if( i >= ( count_max - 1 ) ){ break; }	//最大数を超えた場合
	}
}
//□マーカーデータ
function GMapDataMarker( key_value , image , shadow , image_suffix , iconSize_w , iconSize_h , shadowSize_w , shadowSize_h , iconAnchor_x , iconAnchor_y , infoWindowAnchor_x , infoWindowAnchor_y ){
	//image_suffixが[A-K]のような形式は A,B…J,K に直す
	if( image_suffix.match( /(\[([A-Z])-([A-Z])\])/ ) && RegExp.$2.charCodeAt( 0 ) <= RegExp.$3.charCodeAt( 0 ) ){
		var temp = [];
		for( var i = RegExp.$2.charCodeAt( 0 ) ; i <= RegExp.$3.charCodeAt( 0 ) ; i++ ){ temp[ temp.length ] = String.fromCharCode( i ); }
		image_suffix = image_suffix.replace( RegExp.$1  , temp.join( "," ) );
	}

	GMap_marker[ key_value ] = new GMapMarker( key_value );
	GMap_marker[ key_value ].iconfile		= image;			//GIconの方は書き換えられる為、オリジナルとして保管
	GMap_marker[ key_value ].filesuffix	= image_suffix.split( "," );
	GMap_marker[ key_value ].naviprefix	= GMap_marker[ key_value ].filesuffix;
	GMap_marker[ key_value ].filesuffix	= image_suffix.split( "," );
	GMap_marker[ key_value ].priority		= GMapCommon.Array.count( GMap_marker );	//優先度（最初が高い）
	GMap_marker[ key_value ].width		= iconSize_w;		GMap_marker[ key_value ].height		= iconSize_h;
	GMap_marker[ key_value ].swidth		= shadowSize_w;		GMap_marker[ key_value ].sheight		= shadowSize_h;

	if( key_value.match( /^itemnavi/ ) ){ return ; }	//アイテムナビ用画像はここで終わり

	//省略時の処理
	if( iconAnchor_x == undefined       ){ iconAnchor_x = Math.floor( iconSize_w / 2 );			}	//アンカーX座標は 幅/2
	if( iconAnchor_y == undefined       ){ iconAnchor_y = iconSize_h;							}	//アンカーY座標は 高さ
	if( infoWindowAnchor_x == undefined ){ infoWindowAnchor_x = Math.floor( iconSize_w / 2 );	}  	//アンカーX座標は 幅/2
	if( infoWindowAnchor_y == undefined ){ infoWindowAnchor_y = 2;  							}	//アンカーY座標は 2

	//GIconの定義
	GMap_marker[ key_value ].gicon = new GIcon();
	GMap_marker[ key_value ].gicon.image = image;
	GMap_marker[ key_value ].gicon.iconSize			= new GSize(  iconSize_w		 , iconSize_h         );
	if( shadow						 ){ GMap_marker[ key_value ].gicon.shadow	    = shadow;	}
	if( shadowSize_w && shadowSize_h ){ GMap_marker[ key_value ].gicon.shadowSize = new GSize( shadowSize_w , shadowSize_h ); }
	GMap_marker[ key_value ].gicon.iconAnchor			= new GLatLng( iconAnchor_y       , iconAnchor_x	   );
	GMap_marker[ key_value ].gicon.infoWindowAnchor	= new GLatLng( infoWindowAnchor_y , infoWindowAnchor_x );
}
//□絞り込み条件データ
function GMapDataNarrowCondition( key , condition ){
	if( !key.match( /:\d+$/ ) ){ key += ":1"; }
	GMap_narrowCondition[ key ] = condition;
}
//--------------------------------------------------------------------------------------------------
//□汎用関数
/* 【諸事情で、ここから先は改造／単独利用はご遠慮下さい。GMap での利用では問題ありません】 */
var GMapCommon = new function(){
	this.Array								= {};
	this.Array.count						= GMapCommon_Array_count;
	this.Array.keys							= GMapCommon_Array_keys;
	this.Array.merge						= GMapCommon_Array_merge;
	this.Array.sort							= GMapCommon_Array_sort;
	this.Data								= {};
	this.Data.conv3digitcomma				= GMapCommon_Data_conv3digitcomma;
	this.Data.convTemplate					= GMapCommon_Data_convTemplate;
	this.Data.makeAnchorTag					= GMapCommon_Data_makeAnchorTag;
	this.Data.makeImageTag					= GMapCommon_Data_makeImageTag;
	this.Data.sprintf						= GMapCommon_String_sprintf;		//GMapCommon.String.sprintf のエイリアス
	this.Error								= {};
	this.Error.trigger						= GMapCommon_Error_trigger;
	this.Event								= {};
	this.Event.cancel						= GMapCommon_Event_cancel;
	this.HTML								= {};
	this.HTML.encode						= GMapCommon_HTML_encode;
	this.HTML.makePngTag					= GMapCommon_HTML_makePngTag;
	this.HTML.getLayoutSize					= GMapCommon_HTML_getLayoutSize;
	this.HTML.getWindowSize					= GMapCommon_HTML_getWindowSize;
	this.HTML.openPopup						= GMapCommon_HTML_openPopup;
	this.HTML.closePopup					= GMapCommon_HTML_closePopup;
	this.HTML.setDisplay					= GMapCommon_HTML_setDisplay;
	this.HTML.write							= GMapCommon_HTML_write;
	this.Map								= {};
	this.Map.convBase10ToBase60				= GMapCommon_Map_convBase10ToBase60;
	this.Map.convCoordinateGTokyoToWGS84	= GMapCommon_Map_convCoordinateGTokyoToWGS84;		//この関数は廃止予定
	this.Map.convCoordinateWGS84ToGTokyo	= GMapCommon_Map_convCoordinateWGS84ToGTokyo;		//　　　　〃
	this.Map.convPointsToDistance			= GMapCommon_Map_convPointsToDistance;
	this.Map.getNearData					= GMapCommon_Map_getNearData;
	this.String								= {};
	this.String.convTemplate				= GMapCommon_String_convTemplate;
	this.String.repeat						= GMapCommon_String_repeat;
	this.String.sprintf						= GMapCommon_String_sprintf;
	this.Variable							= {};
	this.Variable.tempValue					= [];
	this.Variable.convInputValue			= GMapCommon_Variable_convInputValue;
	this.Variable.clearTempValue			= GMapCommon_Variable_clearTempValue;
	this.Variable.getTempValue				= GMapCommon_Variable_getTempValue;
	this.Variable.setTempValue				= GMapCommon_Variable_setTempValue;
	this.XML								= {};
	this.XML.convAttributesToArray			= GMapCommon_XML_convAttributesToArray;
	this.XML.include						= GMapCommon_XML_include;
	this.XML.getValueByUniqueTag			= GMapCommon_XML_getValueByUniqueTag;
}
//□汎用関数 - 配列 - 数を返す（キーがStringの配列も含む）
function GMapCommon_Array_count( array ){
	if( !array ){ return 0; } 	//arrayが空
	var result = 0;

	if( array.length   ){ result = array.length; }				//普通のlengthで取得できたら、それを返す
	else				{ for( var i in array ){ if( i != "clear" ){ result++; } } }	//取得できなかったらループで取得

	return result;
}
//□汎用関数 - 配列 - キーを配列で返す
function GMapCommon_Array_keys( array ){
	var result_array = [];
	for( var key in array ){ if( key != "clear" ){ result_array[ result_array.length ] = key; } }
	return result_array;
}
//□汎用関数 - 配列 - マージする
function GMapCommon_Array_merge(){
	var result = [];
	for( var i = 0 ; i < arguments.length ; i++ ){
		for( var temp in arguments[ i ] ){
			if( temp == "clear" ){ continue; }
			result[ temp ] = arguments[ i ][ temp ];
		}
	}
	return result;
}
/*
//□汎用関数 - 配列 - ソート
function GMapCommon_Array_sort( base_array , sort_key , option ){
	var sort_str = 0;
	var sort_desc = ( option == "desc" ? 1 : 0 );

	//ソート用テーブルを作る
	var sort_array = new Array();
	for( var key in base_array ){
		if( key == "clear" ){ continue; }

		var l = sort_array.length;
		sort_array[ l ] = new Array();
		sort_array[ l ][ "key"   ] = key;
		sort_array[ l ][ "value" ] = base_array[ key ];
		if( isNaN( ( sort_key ? base_array[ key ][ sort_key ] : base_array[ key ] ) ) ){ sort_str = 1; }	//ひとつでも文字列の型があれば、文字列で比較
	}

	//基本交換法によるソート
	for( var j = sort_array.length ; j >= 0 ; j-- ){ 
		for( var i = 0 ; i < ( j - 1 ) ; i++ ){
			var comp_1 = ( sort_key ? sort_array[ i     ][ "value" ][ sort_key ] : sort_array[ i     ][ "value" ] );
			var comp_2 = ( sort_key ? sort_array[ i + 1 ][ "value" ][ sort_key ] : sort_array[ i + 1 ][ "value" ] );

			//比較
			var result = ( ( !sort_str ? Number( comp_1 ) : String( comp_1 ) ) > ( !sort_str ? Number( comp_2 ) : String( comp_2 ) ) ? 1 : 0 );

			//降順オプションの場合、結果を逆転させる
			if( sort_desc ){ result = Math.abs( result - 1 ); }

			//値の交換
			if( result ){
				var temp = sort_array[ i + 1 ]; 
				sort_array[ i + 1 ] = sort_array[ i ]; 
				sort_array[ i ] = temp;
			}
		} 
	}

	//ソート用テーブルから元と同じ形の配列に戻す
	var result_array = new Array();
	for( var i = 0 ; i < sort_array.length ; i++ ){
		result_array[ sort_array[ i ][ "key" ] ] = sort_array[ i ][ "value" ];
	}

	return result_array;
}
*/
//□汎用関数 - 配列 - ソート
function GMapCommon_Array_sort( base_array , sort_key , option ){
	var sort_str = 0;
	var sort_desc = ( option == "desc" ? 1 : 0 );

	//ソート用テーブルを作る
	var sort_array = [];  var n = 0;
	for( var key in base_array ){
		var l = sort_array.length;
		sort_array[ l ] = [];
		sort_array[ l ][ "key"   ] = key;
		sort_array[ l ][ "value" ] = base_array[ key ];
		if( isNaN( ( sort_key ? base_array[ key ][ sort_key ] : base_array[ key ] ) ) ){ sort_str = 1; }	//ひとつでも文字列の型があれば、文字列で比較
		n++;
	}
	if( !n ){ return base_array; }

	//型変換用匿名関数
	var tempChangeType = ( sort_str ? function( v ){ return String( v ); } : function( v ){ return Number( v ); } );

	//クイックソートの再帰的ルーチン処理
	if( sort_key   ){ tempSortObjectRoutine(   sort_array , 0 , sort_array.length - 1 ); }
	else			{ tempSortStandardRoutine( sort_array , 0 , sort_array.length - 1 ); }

	//ソート用テーブルから元と同じ形の配列に戻す
	var result_array = {};
	if( !sort_desc ){ for( var i = 0 ; i < sort_array.length ; i++      ){ result_array[ sort_array[ i ][ "key" ] ] = sort_array[ i ][ "value" ]; } }
	else			{ for( var i = sort_array.length - 1 ; i >= 0 ; i-- ){ result_array[ sort_array[ i ][ "key" ] ] = sort_array[ i ][ "value" ]; } }

	return result_array;


	//クイックソートの再帰的ルーチン（普通版）
	function tempSortStandardRoutine( sort_array , first , last ){
		var x = tempChangeType( sort_array[ Math.floor( ( first + last ) / 2 ) ].value );  var i = first;  var j = last;
		while( true ){
			while( tempChangeType( sort_array[ i ].value ) < x ){ i++; }
			while( x < tempChangeType( sort_array[ j ].value ) ){ j--; }
			if ( i >= j ){ break; }

			var t = sort_array[ i ];  sort_array[ i ] = sort_array[ j ];  sort_array[ j ] = t;  i++;  j--; 
		}
		//再帰的処理
		if( first < i - 1 ){ tempSortStandardRoutine( sort_array , first , i - 1 ); }
		if( j + 1 < last  ){ tempSortStandardRoutine( sort_array , j + 1 , last  ); }
	}
	//クイックソートの再帰的ルーチン（オブジェクト版）
	function tempSortObjectRoutine( sort_array , first , last ){
		var x = tempChangeType( sort_array[ Math.floor( ( first + last ) / 2 ) ].value[ sort_key ] );  var i = first;  var j = last;
		while( true ){
			while( tempChangeType( sort_array[ i ].value[ sort_key ] ) < x ){ i++; }
			while( x < tempChangeType( sort_array[ j ].value[ sort_key ] ) ){ j--; }
			if ( i >= j ){ break; }

			var t = sort_array[ i ];  sort_array[ i ] = sort_array[ j ];  sort_array[ j ] = t;  i++;  j--; 
		}
		//再帰的処理
		if( first < i - 1 ){ tempSortObjectRoutine( sort_array , first , i - 1 ); }
		if( j + 1 < last  ){ tempSortObjectRoutine( sort_array , j + 1 , last  ); }
	}
}
//□汎用関数 - データ - 数値に3桁毎にカンマを振る
function GMapCommon_Data_conv3digitcomma( num , failed ){
	if( isFinite( num ) ){ 	//数値
		num = String( num );
		while( num != ( num = num.replace( /^(-?\d+)(\d{3})(\.?\d*)/ , "$1,$2$3" ) ) ){}
		var result = num;
	} else {				//数値じゃない
		var result = ( typeof( failed ) != "undefined" ? failed : num );
	}
	return result;
}
//□汎用関数 - データ - テンプレート変換をする
function GMapCommon_Data_convTemplate( replace_list , template_id ){
	if( template_id == undefined ){ template_id = "undefined"; }
	if( !GMap_template[ template_id ] ){ return "Template Not Fount!"; }	//見つからない場合
	var result = GMapCommon.String.convTemplate( GMap_template[ template_id ].html , replace_list );
	return result;
}
//□汎用関数 - データ - タグの作成（共通）
function GMapCommon_Data__makeTag( tagName , endtag , attribute , innerHTML ){
	var result = "<" + tagName;																//タグ名
	for( var key in attribute ){															//属性
		if( key != "clear" && !key.match( /^_/ ) ){ result += " " + key + "=\"" + attribute[ key ] + "\""; }
	}
	result += ( endtag ? ">" + innerHTML + "</" + tagName + ">" : " />" );		//要素と終了タグ

	return result;
}
//□汎用関数 - データ - アンカータグの作成
function GMapCommon_Data_makeAnchorTag( url , innerHTML , attribute , failed ){
	var reg = new RegExp( "^https?:\/\/[\x23-\x2f0-9a-zA-Z_!:;=?\@~]+$|^[\x23-\x2f0-9a-zA-Z_!;=?\@~]+$" );	//URLの正規表現
	if( url.match( reg ) ){	//URL
		if( !attribute ){ attribute = {}; }
		attribute.href		= url;
		if( !attribute.target && GMap_link_type == 2 ){ attribute.target = "_blank"; }
		var result = GMapCommon_Data__makeTag( "a" , true , attribute , innerHTML );
	} else {				//URLじゃない
		var result = ( typeof( failed ) != "undefined" ? failed : url );
	}
	return result;
}
//□汎用関数 - データ - イメージタグの作成	【この関数はまだ正しく動作しない！】
function GMapCommon_Data_makeImageTag( src , width , height , attribute, failed ){
	var img = new Image()
	img.src = src;
	//画像か否かのチェック
	if( GMap__ua.MSIE ){ var isImg = ( img.mimeType ? 1 : 0 ); }
	else				 { var isImg = ( img.width    ? 1 : 0 ); }

	if( isImg ){			//画像
		if( !attribute ){ attribute = {}; }

		if( attribute._PreserveAspectRatio || attribute._PAR ){	//同アスペクト比での縮尺サイズを取得
			var resize = GMapCommon_Data_makeImageTag_getSizePreserveAspectRatio( img.width , img.height , width , height )
			width = resize.width;  height = resize.height;
			attribute.style = ( attribute.style ? attribute.style + " " : "" ) + "margin: " + resize.marginY + "px " + resize.marginX + "px " + resize.marginY + "px " + resize.marginX + "px;";
		}

		attribute.src		= src;
		attribute.width		= ( width  ? width  : img.width  );
		attribute.height	= ( height ? height : img.height ); 
		attribute.alt		= ( attribute.alt ? attribute.alt : "" );

		var result = GMapCommon_Data__makeTag( "img" , false , attribute );
	} else {				//画像じゃない
		var result = ( typeof( failed ) != "undefined" ? failed : src );
	}
	return result;
}
//□汎用関数 - データ - イメージタグの作成 - 同アスペクト比での縮尺サイズを取得
function GMapCommon_Data_makeImageTag_getSizePreserveAspectRatio( base_width , base_height , resize_width , resize_height ){
	var result = {};

	//新しいサイズと余白の計算
	if( ( resize_width / base_width ) < ( resize_height / base_height ) ){  //横に余白の場合
		result.width = resize_width;  result.height = Math.round( base_height * ( resize_width / base_width ) );
		result.marginX = 0;  result.marginY = ( resize_height - result.height ) / 2;

	} else if( ( resize_width / base_width ) > ( resize_height / base_height ) ){  //縦に余白の場合
		result.width = Math.round( base_width * ( resize_height / base_height ) );  result.height = resize_height;
		result.marginX = ( resize_width  - result.width ) / 2;  result.marginY = 0;

	} else {  //余白無し（一致）の場合
		result.width = resize_width ;  result.height = resize_height;
		result.marginX = 0;  result.marginY = 0;
	}
	return result;
}
//□汎用関数 - エラー - トリガー
function GMapCommon_Error_trigger( message , errNo , errLevel ){	
	if( errLevel == undefined ){ errLevel = 0; }

	if( errLevel == 0 && !GMap_debug_mode ){ return true; }	//エラーレベル0：デバッグモードでのみアラート

	alert( message );
	return false;
}
//□汎用関数 - イベント - キャンセル
function GMapCommon_Event_cancel( event ){
	if( GMap__ua.MSIE ){			//IE
		event.returnValue = false;
	} else {						//Firefoxとか
		event.preventDefault();
	}
	return false;
}
//□汎用関数 - HTML - エンコード
function GMapCommon_HTML_encode( value ){
	var convList = [ "&:&amp;" , "<:&lt;" , ">:&gt;" , "\":&quot;" , "':&apos;" ];
	for( var i = 0 ; i < convList.length ; i++ ){
		var temp = convList[ i ].split( ":" );
		value = value.replace( new RegExp( temp[ 0 ] , "g" ) , temp[ 1 ] );
	}
	return value;
}
//□汎用関数 - HTML - PNG用タグを生成
function GMapCommon_HTML_makePngTag( filename , width , height , attributes , sizingmethod ){
	if( !sizingmethod ){ sizingmethod = "scale"; }

	//属性の処理
	var temp_attributes = "";  var style = "";
	if( attributes ){
		for( var name in attributes ){ if( name != "style" ){ temp_attributes += " " + name + "=\"" + attributes[ name ] + "\""; } }	//style属性以外
		if( attributes.style ){ style = attributes.style; }	//style属性
	}

	//タグの生成
	if( GMap__ua.MSIE && GMap__ua.MSIE < 7.0 && filename.match( /\.png$/ ) ){
		var result = "<div style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + filename + "',sizingmethod=" + sizingmethod + ");  width: " + width + "px;  height: " + height + "px;  overflow: hidden;  " + style + "\"" + temp_attributes + "></div>";
	} else {
		var result = "<img src=\"" + filename + "\" width=\"" + width + "\"  height=\"" + height + "\"  alt=\"\" style=\"" + style + "\"" + temp_attributes + " />";
	}
	return result;
}
//□汎用関数 - HTML - レイアウトのサイズを取得する
function GMapCommon_HTML_getLayoutSize( html ){
	var temp_obj = document.getElementById( "GMap--common-getlayoutsize" );
	temp_obj.innerHTML = "<div>" + html + "</div>";
	var result = { width : temp_obj.firstChild.offsetWidth , height : temp_obj.firstChild.offsetHeight };
	return result;
}
//□汎用関数 - HTML - ウィンドウのサイズを取得する
function GMapCommon_HTML_getWindowSize(){
	var result = {};
	var mode_standard = ( document.compatMode == "CSS1Compat" ? 1 : 0 );

	if( GMap__ua.MSIE && mode_standard ){														//IE標準
		result.width  = document.body.offsetWidth;  result.height = document.documentElement.offsetHeight;
	} else if( ( GMap__ua.MSIE && !mode_standard ) ){											//IE互換
		result.width  = document.body.clientWidth;  result.height = document.body.clientHeight;
	} else if( GMap__ua.Gecko || GMap__ua.Safari ){											//Gecko/Safari
		result.width = document.body.offsetWidth;  result.height = window.innerHeight;
	} else if( GMap__ua.Opera ){																//Opera
		result.width = document.body.offsetWidth - 20;  result.height = window.innerHeight;
	}

	return result;
}
//□汎用関数 - HTML - ポップアップを開く
function GMapCommon_HTML_openPopup( id , option ){
	if( option == undefined ){ option = ""; }
	var obj_box = document.getElementById( id );
	if( !obj_box ){ GMapCommon.Error.trigger( "設定エラー：指定されたID（ " + id + " ）のHTMLタグが存在しません。" , "i004" , 0 );  return false; }

	obj_box.style.display = "block";	//表示

	//ユーザー指定スタイルを設定
	var temp = [ "width" , "height" , "left" , "top" , "right" , "bottom" ];
	for( var i = 0 ; i < temp.length ; i++ ){
		if( option.match( new RegExp( temp[ i ] + "\\s?[=:]\\s?([0-9]+)(px|%)?" , "i" ) ) ){ obj_box.style[ temp[ i ] ] = RegExp.$1 + ( RegExp.$2 ? RegExp.$2 : "px" ); }
	}
	if( option.match( /left\s?[=:]\s?center/i ) ){ obj_box.style.left = String( ( obj_box.parentNode.offsetWidth  - obj_box.offsetWidth  ) / 2 ) + "px"; }
	if( option.match( /top\s?[=:]\s?center/i  ) ){ obj_box.style.top  = String( ( obj_box.parentNode.offsetHeight - obj_box.offsetHeight ) / 2 ) + "px"; }
	obj_box.style.zIndex = 301;
	
	//影の表示
	if( !option.match( /shadow\s?[=:]\s?(?:0|off|false)/ ) ){
		var obj_shadow	= document.getElementById( "GMap--common-popupShadow" );
		obj_shadow.style.display = "block";

		//影のDIVの位置、サイズを指定
		var shadow_width		= obj_box.offsetWidth + 28;  			var shadow_height		= obj_box.offsetHeight + 28;
		obj_shadow.style.left	= String( obj_box.offsetLeft ) + "px";	obj_shadow.style.top    = String( obj_box.offsetTop ) + "px";  
		obj_shadow.style.width	= String( shadow_width ) + "px";		obj_shadow.style.height = String( shadow_height ) + "px";  
		obj_shadow.style.zIndex = 300;

		var insertTag = "";		//影画像を配置
		insertTag += GMapCommon.HTML.makePngTag( GMap_image_path + "GMap_popup_shadow_bl.png" , 28					, 28						, { style : "position: absolute;  left:  0px;  top: " + String( obj_box.offsetHeight ) + "px;" } );
		insertTag += GMapCommon.HTML.makePngTag( GMap_image_path + "GMap_popup_shadow_br.png" , 28					, 28						, { style : "position: absolute;  left: " + String( obj_box.offsetWidth ) + "px;  top: " + String( obj_box.offsetHeight ) + "px;" } );
		insertTag += GMapCommon.HTML.makePngTag( GMap_image_path + "GMap_popup_shadow_tr.png" , 28					, 28						, { style : "position: absolute;  left: " + String( obj_box.offsetWidth ) + "px;  top: 0px;" } );
		insertTag += GMapCommon.HTML.makePngTag( GMap_image_path + "GMap_popup_shadow_bc.png" , ( shadow_width - 56 ) , 28						, { style : "position: absolute;  left: 28px;  top: " + String( obj_box.offsetHeight ) + "px;" } );
		insertTag += GMapCommon.HTML.makePngTag( GMap_image_path + "GMap_popup_shadow_cr.png" , 28					, ( shadow_height - 56 )	, { style : "position: absolute;  left: " + String( obj_box.offsetWidth ) + "px;  top: 28px;" } );
		obj_shadow.innerHTML = insertTag;
	}

	//閉じるボタンの追加
	if( !option.match( /close\s?[=:]\s?(?:0|off|false)/ ) && !document.getElementById( "GMap--common-popupClose-" + id ) ){
		obj_box.innerHTML = obj_box.innerHTML + "<img id=\"GMap--common-popupClose-" + id + "\" src=\"" + GMap_image_path + "GMap_popup_close.png\" width=\"14\" height=\"13\" alt=\"閉じる\" onclick=\"GMapCommon.HTML.closePopup( '" + id + "' )\" style=\"position: absolute;  right: 10px;  top: 10px;  cursor: pointer;\">";
	}

	//セレクトボックスの非表示（IEのみ）
	if( GMap__ua.MSIE && !option.match( /select\s?[=:]\s?(?:1|on|true)/ ) ){
		var obj_select = document.getElementsByTagName( "select" );
		for( var i = 0 ; i < obj_select.length ; i++ ){ obj_select[ i ].style.visibility = "hidden"; }
	}

	//マップのドラッグと情報ウィンドウの表示を制限する
	if( !option.match( /maplimit\s?[=:]\s?(?:0|off|false)/ ) ){
		if( !GMap_limit_dragging ){ GMapMap.gmap.disableDragging(); }
		GMapMap.infoWindow.enabled = false;
	}

}
//□汎用関数 - HTML - ポップアップを閉じる
function GMapCommon_HTML_closePopup( id ){
	var obj_box		= document.getElementById( id );
	var obj_shadow	= document.getElementById( "GMap--common-popupShadow" );
	var obj_select = document.getElementsByTagName( "select" );
	if( !obj_box ){ GMapCommon.Error.trigger( "設定エラー：指定されたID（ " + id + " ）のHTMLタグが存在しません。" , "i004" , 0 );  return false; }

	//閉じるボタンがある場合、削除
	if( document.getElementById( "GMap--common-popupClose-" + id ) ){ obj_box.removeChild( document.getElementById( "GMap--common-popupClose-" + id ) ); }

	//非表示
	obj_box.style.display		= "none";	//表示
	obj_shadow.style.display	= "none";	//表示

	//セレクトボックスを再表示
	if( GMap__ua.MSIE ){ for( var i = 0 ; i < obj_select.length ; i++ ){ obj_select[ i ].style.visibility = "visible"; } }

	//マップのドラッグと情報ウィンドウの表示の制限を解除
	if( !GMap_limit_dragging ){ GMapMap.gmap.enableDragging(); }
	GMapMap.infoWindow.enabled = true;
}
//□汎用関数 - HTML - 表示状態をセットする
function GMapCommon_HTML_setDisplay( id , type ){
	var obj = document.getElementById( id );
	if( !obj ){ return false; }
	if( !GMap__ua.Opera ){ obj.style.display		= ( type ? "block"   : "none"   ); }	//Opera以外
	else				   { obj.style.visibility	= ( type ? "visible" : "hidden" ); }	//Opera
	return true;
}
//□汎用関数 - HTML - HTMLを書き込む
function GMapCommon_HTML_write( id , html ){
	if( !id || !document.getElementById( id ) ){ return false; }
	document.getElementById( id ).innerHTML = html;
	return true;
}
//□汎用関数 - マップ - 10進数表記を60進数表記に変換
function GMapCommon_Map_convBase10ToBase60( base10 ){
	base10 = parseFloat( base10 );
	var minus = 0;
	if( base10 < 0 ){ base10 *= -1 ;  minus = 1; }	//西経もしくは南緯の場合

	var base60_1 = Math.floor( base10 );		//度
	base10 = ( base10 - base60_1 ) * 60;
	var base60_2 = Math.floor( base10 );		//分
	base10 = ( base10 - base60_2 ) * 60;
	var base60_3 = base10;						//秒

	//戻り値は最初の1文字は+もしくは-、以降 度.分.秒.小数点以下… となる
	var result =
		( !minus ? "+" : "-" ) +
		String( base60_1 ) + "." + 
		( base60_2 < 10 ? "0" : "" ) + String( base60_2 ) + "." + 
		( base60_3 < 10 ? "0" : "" ) + String( base60_3 );

	//第二引数（緯度）が指定されている場合、それを再帰的に取得しオブジェクトで返す
	if( arguments[ 1 ] ){
		var result_obj = {};
		result_obj.lng = result;  result_obj.lat = GMapCommon_Map_convBase10ToBase60( arguments[ 1 ] );
		return result_obj;
	} else {
		return result;
	}
}
//□汎用関数 - マップ - Google東京測地系(※)から世界測地系（WGS84）に変換	※世界計測系からの平行移動
function GMapCommon_Map_convCoordinateGTokyoToWGS84(){
	var result = {};
	if( typeof( arguments[ 0 ] ) == "object" ){ result.lng = arguments[ 0 ].x;  result.lat = arguments[ 0 ].y; }
	else									  { result.lng = arguments[ 0 ];    result.lat = arguments[ 1 ];   }

	//Googleの定めた東京測地系の平行移動の場所
	if( ( 115 < result.lng && result.lng < 152 ) && ( 30 < result.lat && result.lat < 50 ) ){
		result.lng -= 0.0032027777777777775;
		result.lat += 0.003236111111111111;
	}
	return result;
}
//□汎用関数 - マップ - 世界測地系（WGS84）からGoogle東京測地系(※)に変換	※世界計測系からの平行移動
function GMapCommon_Map_convCoordinateWGS84ToGTokyo(){
	var result = {};
	if( typeof( arguments[ 0 ] ) == "object" ){ result.lng = arguments[ 0 ].x;  result.lat = arguments[ 0 ].y; }
	else									  { result.lng = arguments[ 0 ];    result.lat = arguments[ 1 ];   }

	//Googleの定めた東京測地系の平行移動の場所
	if( ( 115 < result.lng && result.lng < 152 ) && ( 30 < result.lat && result.lat < 50 ) ){
		result.lng += 0.0032027777777777775;
		result.lat -= 0.003236111111111111;
	}
	return result;
}
//□汎用関数 - マップ - 座標間から距離を取得する
function GMapCommon_Map_convPointsToDistance( lng1 , lat1 , lng2 , lat2 ){
	var lng1 = ( lng1 * Math.PI ) / 180;
	var lat1 = ( lat1 * Math.PI ) / 180;
	var lng2 = ( lng2 * Math.PI ) / 180;
	var lat2 = ( lat2 * Math.PI ) / 180;

	var t = Math.sin( lat1 ) * Math.sin( lat2 ) + Math.cos( lat1 ) * Math.cos( lat2 ) * Math.cos( lng1 - lng2 );
	var d = 20000 * Math.acos( t ) / Math.PI;

	return d;
}
//□汎用関数 - マップ - 現在地から近いデータを取得する
function GMapCommon_Map_getNearData( data , type , limit ){
	if( !type  ){ type  = "all"; }
	if( !limit ){ limit = Infinity; }
	var conditionType = 0;
	var center = GMapMap.gmap.getCenter();		//現在地の座標を取得

	//条件の作成
	if( type.match( /^(.+):(.+)$/ ) ){ type = RegExp.$1;  var ref = RegExp.$2.split( "," ); }	//typeの引数を分離
	switch( type ){
		case "map" :  var conditionType = 1;	//マップ内（条件タイプ1）
			var bounds = GMapMap.gmap.getBounds();		//バウンドの取得
			var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();
			var minLng = tempSW.x;  var maxLng = tempNE.x;  var minLat = tempSW.y;  var maxLat = tempNE.x;
			break;
		case "dist":  var conditionType = 1;	//指定範囲内（条件タイプ1）		ex: dist:0.01
			ref[ 0 ] = parseFloat( ref[ 0 ] );
			var minLng = center.x - ref[ 0 ];  var maxLng = center.x + ref[ 0 ];  var minLat = center.y - ref[ 0 ];  var maxLat = center.y + ref[ 0 ];
			break;
	}

	//ソート用配列の作成
	var sort_array = [];
	for( var id in data ){
		if( key == "clear" || !data[ id ].lng || !data[ id ].lat ){ continue; }

		//条件
		if( conditionType == 1 && ( data[ id ].lng < minLng || maxLng < data[ id ].lng || data[ id ].lat < minLat || maxLat < data[ id ].lat ) ){ continue; }

		sort_array[ id ] = GMapCommon.Map.convPointsToDistance( data[ id ].lng , data[ id ].lat , center.x , center.y );	//ソート用配列に距離を算出したものを入れる
	}

	//ソート処理と戻り値の作成
	var result_array = [];  var c = 1;
	if( sort_array ){
		sort_array = GMapCommon.Array.sort( sort_array );		//ソート処理

		for( var key in sort_array ){		//戻り値の生成
			if( key == "clear" ){ continue; }
			result_array[ result_array.length ] = key;
			if( c >= limit ){ break; } else { c++; }		//リミット
		}
	}

	return result_array;
}
//□汎用関数 - 文字列 - テンプレート変換
function GMapCommon_String_convTemplate( value , replace_list ){
	for( var key in replace_list ){ if( key != "clear" ){ value = value.replace( new RegExp( "%" + key + "%" , "g" ) , replace_list[ key ] ); } }
	return value;
}
//□汎用関数 - 文字列 - 同じ文字を繰り返す
function GMapCommon_String_repeat( str , count ){
	var result = "";
	for( var i = 0 ; i < parseInt( count ) ; i++ ){ result += str; }
	return result;
}
//□汎用関数 - 文字列 - 簡易sprintf
function GMapCommon_String_sprintf( format ){
	var count = 1;

	while( format.match( /(%([0-9\.+-]*?)([dfs]))/ ) ){
		var value = arguments[ count ];
		if( value == undefined ){ continue; }

		var replace = RegExp.$1;  var parameter = RegExp.$2;  var type = RegExp.$3;
		format = format.replace( replace , GMapCommon_String_sprintf_replace( replace , parameter , type , value ) );
		count++;
	}

	return format;
}
//□汎用関数 - 文字列 - 簡易sprintf - 置換
function GMapCommon_String_sprintf_replace( format , parameter , type , value ){
	switch( type ){
		case "d" : value = parseInt( value );	 	break;	//整数
		case "f" : value = parseFloat( value );		break;	//小数（浮動小数）
		case "s" : value = String( value ); 		break;	//整数
	}
	var base_value = value;

	//▽base_value => value
	//小数点以下切り詰め	%～.2		3.145 ⇒ 3.14 / 3.1 ⇒ 3.10
	if( type == "f" && parameter.match( /\.([1-9]+)$/ ) ){
		value = String( parseInt( base_value ) ) + "." + String( Math.floor( ( base_value - parseInt( base_value ) ) * Math.pow( 10 , parseInt( RegExp.$1 ) ) ) );
	}


	//▽value => value
	//文字列切り詰め 		%～.3s		HOGE ⇒ HOG
	if( type == "s" && parameter.match( /\.([1-9]+)$/ ) ){
		value = value.substring( 0 , parseInt( RegExp.$1 ) );
	}
	//符号を付ける			%+～d	100 ⇒ +100
	if( ( type == "d" || type == "f" ) && parameter.match( /^\+/ ) && base_value > 0 ){
		value = "+" + String( value );
	}

	//余白を右に追加		%-7d	HOGE ⇒ |HOGE   |
	if( parameter.match( /^\+?-([1-9][0-9]*)/ ) ){
		value = String( value ) + GMapCommon.String.repeat( "&nbsp;" , parseInt( RegExp.$1 ) - String( value ).length );
	}
	//余白を左に追加		%3d		HOGE ⇒ |   HOGE|			%03d		50 ⇒ |050|
	if( parameter.match( /^\+?(0)?([1-9][0-9]*)/ ) ){
		var temp1 = RegExp.$1;  var temp2 = RegExp.$2;  var temp3 = ( String( value ).match( /^(\+|-)/ ) ? RegExp.$1 : 0 );
		value = ( temp3 ? temp3 : "" ) + GMapCommon.String.repeat( ( temp1 != "" ? temp1 : "&nbsp;" ) , parseInt( temp2 ) - String( value ).length ) + String( value ).substring( ( temp3 ? 1 : 0 ) );
	}

	return value;
}
//□汎用関数 - 変数 - 入力変数を変換する
function GMapCommon_Variable_convInputValue( tempArg , option ){
	if( typeof( tempArg ) == "object" && option && option.match( /ISCHECKED/i ) ){ var result = tempArg.checked; }	//チェックボックス用
	else if( typeof( tempArg ) == "object" ){ var result = tempArg.value; }	//セレクトボックス等
	else { var result = tempArg; }	//アンカーやボタンなど値直接指定
	return result;
}
//□汎用関数 - 変数 - 一時値をクリア
function GMapCommon_Variable_clearTempValue( id  ){
	GMapCommon.Variable.tempValue[ id ] = "";
}
//□汎用関数 - 変数 - 一時値を取得
function GMapCommon_Variable_getTempValue( id , isClear ){
	var result = GMapCommon.Variable.tempValue[ id ];
	if( isClear != false ){ GMapCommon.Variable.tempValue[ id ] = ""; }
	return result;
}
//□汎用関数 - 変数 - 一時値をセット
function GMapCommon_Variable_setTempValue( value , id ){
	if( typeof( id ) == "undefined" ){ id = "TV" + String( new Date().getTime() ) + String( Math.ceil( Math.random() * 10000 ) ); }	//ID生成
	GMapCommon.Variable.tempValue[ id ] = value;
	return id;
}
//□汎用関数 - XML - 属性を配列に入れ替える
function GMapCommon_XML_convAttributesToArray( xmlData ){
	var result = [];
	for( var i = 0 ; i < xmlData.attributes.length ; i++ ){
		var temp = xmlData.attributes.item( i ).nodeValue;
		temp = temp.replace( /&#39;/g , "'" );
		result[ xmlData.attributes.item( i ).nodeName ] = temp;
	}
	return result;
}
//□汎用関数 - XML - インクルード
function GMapCommon_XML_include( filename , func , option ){
	if( option == undefined ){ option = "" };

	if( GMap_debug_mode || !GMap_import_cache || option.match( /CACHE:(?:0|OFF)/i ) ){ filename += ( !filename.match( /\?/ ) ? "?" : "&" ) + "rand=" + String( Math.random() ).substring( 2 , 8 ); }		//デバッグ時にキャッシュを読まないように、ファイル名をユニークにする
	var GMap_request = GXmlHttp.create();
	var method = ( option.match( /METHOD:POST/i ) ? "POST" : "GET" );
	GMap_request.open( method , filename , true );	//XMLファイルを読み込む
	GMap_request.onreadystatechange = function(){
		if( GMap_request.readyState != 4 ){ return; }
		var xmlDoc = GMap_request.responseXML;
		if( !xmlDoc.documentElement ){ GMapCommon.Error.trigger( "データインポートエラー：ファイルが存在しないか、XMLファイルではありません。" , "i001" , 3 );  return false; }
		func.apply( null , [ xmlDoc ] );									//引数の関数実行
	}
	GMap_request.send( null );
}
//□汎用関数 - XML - ユニークなタグから要素の値を取得する
function GMapCommon_XML_getValueByUniqueTag( xmlDoc , tagName ){
	var temp_xmlData = xmlDoc.documentElement.getElementsByTagName( tagName );
	var result = GXml.value( temp_xmlData[ 0 ] );
	return result;
}
//--------------------------------------------------------------------------------------------------
//□汎用機能
var GMapFunc = new function(){
	this.category					= {};
	this.category.change			= GMapFunc_category_change;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.html						= {};
	this.html.popupOpen				= GMapFunc_html_popupOpen;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.item						= {};
	this.item.openInfoWindow		= GMapFunc_item_openInfoWindow;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.itemNavi					= {};
	this.itemNavi.autoZoom			= GMapFunc_itemNavi_autoZoom;
	this.itemNavi.changeThirdRow	= GMapFunc_itemNavi_changeThirdRow;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.link						= {};
	this.link.select				= GMapFunc_link_select;
	this.link.GMap				= GMapFunc_link_GMap;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.map						= {};
	this.map.changeType				= GMapFunc_map_changeType;
	this.map.changeZoom				= GMapFunc_map_changeZoom;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.mapInfo							= {};
	this.mapInfo.select						= GMapFunc_mapInfo_select;
	this.mapInfo.urlAddFavorite				= GMapFunc_mapInfo_urlAddFavorite;
	this.mapInfo.urlCopyToClipboard			= GMapFunc_mapInfo_urlCopyToClipboard;
	this.mapInfo.urlLink					= GMapFunc_mapInfo_urlLink;
	this.mapInfo.urlSendMail				= GMapFunc_mapInfo_urlSendMail;
	this.mapInfo.urlOpenUserMessageEditor	= GMapFunc_mapInfo_urlOpenUserMessageEditor;
	this.mapInfo.pointChangeBase			= GMapFunc_mapInfo_pointChangeBase;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.move						= {};
	this.move.toLatLng				= GMapFunc_move_toLatLng;
	this.move.toLngLat				= GMapFunc_move_toLngLat;
	this.move.select				= GMapFunc_move_select;
	this.move.toNeighbor			= GMapFunc_move_toNeighbor;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.search						= {};
	this.search.itemName			= {};
	this.search.itemName.submit		= GMapFunc_search_itemName_submit;
	this.search.itemName.keydown	= GMapFunc_search_itemName_keydown;
	this.search.itemName.clear		= GMapFunc_search_itemName_clear;
	this.search.narrow				= {};
	this.search.narrow.change		= GMapFunc_search_narrow_change;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.sort						= {};
	this.sort.change				= GMapFunc_sort_change;
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	this.userControl								= {};
	this.userControl.marker							= {};
	this.userControl.marker.changeVisibility		= GMapFunc_userControl_marker_changeVisibility;
	this.userControl.marker.hidden					= GMapFunc_userControl_marker_hidden;
	this.userControl.marker.visible					= GMapFunc_userControl_marker_visible;
	this.userControl.centerMarker					= {};
	this.userControl.centerMarker.changeVisibility	= GMapFunc_userControl_centerMarker_changeVisibility;
	this.userControl.centerMarker.hidden			= GMapFunc_userControl_centerMarker_hidden;
	this.userControl.centerMarker.visible			= GMapFunc_userControl_centerMarker_visible;
	this.userControl.mouseWheel						= {};
	this.userControl.mouseWheel.changeStatus		= GMapFunc_userControl_mouseWheel_changeStatus;
	this.userControl.mouseWheel.changeDirection		= GMapFunc_userControl_mouseWheel_changeDirection;
}
//□汎用機能 - カテゴリ - 変更
function GMapFunc_category_change( event , category_id ){
	if( GMap_category[ category_id ] ){
		if( GMap_html_categoryNavi ){ GMapCategoryNavi.change( category_id ); }	//セレクトボックスを変更
		GMap_category[ category_id ].change();
	}
	return GMapCommon.Event.cancel( event );	//イベントをキャンセル
}
//□汎用機能 - HTML - ポップアップを開く
function GMapFunc_html_popupOpen( event , target_id , option ){
	GMapCommon.HTML.openPopup( target_id , option );
	return GMapCommon.Event.cancel( event );	//イベントをキャンセル
}
//□汎用機能 - アイテム - 情報ウィンドウを表示
function GMapFunc_item_openInfoWindow( event , item_id ){
	if( GMap_item[ item_id ] ){
		var option = ( GMap_item[ item_id ].category != GMap_focus_category ? "ADDMARKER" : "" );	//他のカテゴリの場合、マーカーが無いと変になっちゃうので付加
		GMap_item[ item_id ].moveCenter();
		GMap_item[ item_id ].openInfoWindowByItemNavi( 0 , option );
	}
	return GMapCommon.Event.cancel( event );	//イベントをキャンセル
}
//□汎用機能 - アイテムナビ - 自動ズーム（マップ上のアイテムをすべて表示）
function GMapFunc_itemNavi_autoZoom( event ){
	if( !GMap_html_itemNavi_autoZoom || document.getElementById( GMap_html_itemNavi_autoZoom ).disabled == false ){	//すでに範囲内でアンカー／ボタンが無効の場合は動作しない
		GMap_category[ GMap_focus_category ].change( 'AUTOCENTERING:2' );
	}

	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - アイテムナビ - 3列目を変更
function GMapFunc_itemNavi_changeThirdRow( event , tempValue ){
	GMap_itemNavi_thirdRow = GMapCommon.Variable.convInputValue( tempValue );
	GMap_category[ GMap_focus_category ].marking();	//マーキングしなおす
	return GMapCommon.Event.cancel( event );
}
//□汎用機能 - リンク - 処理（共通）
function GMapFunc_link__commonLink( event , url ){
	switch( GMap_link_type ){
		case 1 : location.href = url;  break;				//現在のブラウザで移動
		case 2 : window.open( url , "_blank" );  break;		//新しいウィンドウで開く
	}

	GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - リンク - イベント取得（共通）
function GMapFunc_link__getEvent( temp_event ){
	if( typeof( temp_event ) == "string" ){
		var event = GMapCommon_Variable_getTempValue( temp_event );	//一時値から取得
	} else {
		var event = temp_event;
	}
	return event;
}
//□汎用機能 - リンク - セレクトボックスの処理
function GMapFunc_link_select( event , form ){
	var site = form.value;
	if( site == "-" ){ return ; }

	if( site.match( /^GMap,(.+)$/ ) ){									//他のGMapへのリンク
		GMapFunc.link.GMap( event , RegExp.$1 );
	} else if( site.match( /^GMapPlugIn/ ) ){								//プラグイン等
		var eid = GMapCommon.Variable.setTempValue( event );					//イベント変数を一時的に記録
		eval( site + "( '" + eid + "' );" );
	} else if( GMapEX.isPlugInExist( "mapLink" ) ) {						//それ以外のリンク（マップリンク・プラグイン Ver1.00）
		var eid = GMapCommon.Variable.setTempValue( event );					//イベント変数を一時的に記録
		eval( "GMapPlugIn_mapLink_" + site + "( '" + eid + "' );" );
	}

	form.selectedIndex = 0;		//選択肢を先頭に戻しておく（連続して同じ値が選択できなくなる為）
}
//□汎用機能 - リンク - GMap
function GMapFunc_link_GMap( temp_event , url ){		/* この関数は改造禁止です */
	var event = GMapFunc_link__getEvent( temp_event );
	var center = GMapMap.gmap.getCenter();	//中央座標取得

	//リンクの引数
	url += "?lng="		+ center.x;
	url += "&lat="		+ center.y;
	url += "&zoom="		+ GMapMap.gmap.getZoom();
	url += "&referer="	+ escape( location.href );

	//共通リンク処理にてリンクする
	GMapFunc_link__commonLink( event , url );
	return false;
}
//□汎用機能 - マップ - タイプの変更
function GMapFunc_map_changeType( event , tempValue ){
	var type = GMapCommon.Variable.convInputValue( tempValue );
	if( type == "map"										){ GMapMap.gmap.setMapType( G_NORMAL_MAP );		}	//マップ
	if( type == "satellite"									){ GMapMap.gmap.setMapType( G_SATELLITE_MAP );	}	//サテライト
	if( type == "hybrid" && GMapInit_checkHybridEnable()	){ GMapMap.gmap.setMapType( G_HYBRID_MAP );		}	//デュアル
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ - ズームの変更
function GMapFunc_map_changeZoom( event , tempValue ){
	var level = GMapCommon.Variable.convInputValue( tempValue );
	level = ( String( level ).match( /^[+-][0-9]+$/ ) ? GMapMap.gmap.getZoom() + parseInt( level ) : parseInt( level ) ); 
	if( level < 0 ){ level = 0; } else if( level > 17 ){ level = 17; }
	GMapMap.gmap.setZoom( level );
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - セレクトボックスの処理
function GMapFunc_mapInfo_select( event , form ){
//alert( form.value );
	switch( form.value ){
		case "urlAddFavorite"			: GMapFunc.mapInfo.urlAddFavorite( event );  break;			//お気に入りに追加
		case "urlCopyToClipboard"		: GMapFunc.mapInfo.urlCopyToClipboard( event );  break;		//クリップボードにコピー
		case "urlLink"					: GMapFunc.mapInfo.urlLink( event );  break;					//リンク
		case "urlSendMail"				: GMapFunc.mapInfo.urlSendMail( event );  break;				//メールで送信
		case "urlOpenUserMessageEditor" : GMapFunc.mapInfo.urlOpenUserMessageEditor( event );  break;	//ユーザーメッセージ編集
	}
	form.selectedIndex = 0;						//選択肢を先頭に戻しておく（連続して同じ値が選択できなくなる為）
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - このページのURLをお気に入りに追加
function GMapFunc_mapInfo_urlAddFavorite( event ){
	var url = GMapInfo.getURL();			//このページのURLを取得
	window.external.AddFavorite( url , document.title );
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - このページのURLをクリップボードにコピー
function GMapFunc_mapInfo_urlCopyToClipboard( event ){
	var url = GMapInfo.getURL();			//このページのURLを取得
	clipboardData.setData( "Text" , url );
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - このページのURLにリンク
function GMapFunc_mapInfo_urlLink( event ){
	var url = GMapInfo.getURL();			//このページのURLを取得
	location.href = url;
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - このページのURLをメールで送信
function GMapFunc_mapInfo_urlSendMail( event ){
	var url = GMapInfo.getURL();			//このページのURLを取得

	location.href = "mailto:?body=" + escape( url );

	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - このページのURLのユーザーメッセージ編集機能を開く
function GMapFunc_mapInfo_urlOpenUserMessageEditor( event ){
	GMapInfo.userMessageEditor.open();
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - マップ情報 - 緯度／経度の表示の進数を変更
function GMapFunc_mapInfo_pointChangeBase( event , base ){
	if( !base ){ base = ( GMap_mapInfo_point_base == 60 ? 10 : 60 ); }	//進数未指定の場合、現在のでは無いものにする
	GMap_mapInfo_point_base = base;
	var center = GMapMap.gmap.getCenter();
	GMapInfo.dispPoint( center.x , center.y );							//表示
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - 移動 - 指定緯度経度
function GMapFunc_move_toLatLng( event , lat , lng ){
	GMapMap.gmap.closeInfoWindow();										//情報ウィンドウを閉じる
	lng = parseFloat( lng );  lat = parseFloat( lat );
	GMapMap.gmap.panTo( new GLatLng( lat , lng ) );
	return ( event ? GMapCommon.Event.cancel( event ) : true );	//イベントをキャンセルしとく
}
//□汎用機能 - 移動 - 指定経度緯度
function GMapFunc_move_toLngLat( event , lng , lat ){
	return GMapFunc.move.toLatLng( event , lat , lng );	//エイリアス
}
//□汎用機能 - 移動 - セレクトボックスの処理
function GMapFunc_move_select( event , form ){
	if( form.value == "-" ){ return ; }
	GMapMap.gmap.closeInfoWindow();										//情報ウィンドウを閉じる
	var point = form.value.split( /[,\s\t]/ );
	lng = parseFloat( point[ 1 ] );  
	lat = parseFloat( point[ 0 ] );
	GMapMap.gmap.panTo( new GLatLng( lat , lng ) );

}
//□汎用機能 - 移動 - 隣に移動
function GMapFunc_move_toNeighbor( event , tempValue ){
	GMapMap.gmap.closeInfoWindow();										//情報ウィンドウを閉じる
	var direction = GMapCommon.Variable.convInputValue( tempValue );
	var bounds = GMapMap.gmap.getBounds();	//表示範囲の座標を取得
	var tempSW = bounds.getSouthWest();  var tempNE = bounds.getNorthEast();
	var center = GMapMap.gmap.getCenter();	//中央座標取得
	var lng = center.x;  var lat = center.y;
	switch( direction.toLowerCase() ){
		case "north" : lat = tempNE.y + ( ( tempNE.y - tempSW.y ) / 3 );  break;	//北
		case "east"  : lng = tempNE.x + ( ( tempNE.x - tempSW.x ) / 3 );  break;	//東
		case "south" : lat = tempSW.y - ( ( tempNE.y - tempSW.y ) / 3 );  break;	//南
		case "west"  : lng = tempSW.x - ( ( tempNE.x - tempSW.x ) / 3 );  break;	//西
	}
	GMapMap.gmap.panTo( new GLatLng( lat , lng ) );
	return GMapCommon.Event.cancel( event );	//イベントをキャンセルしとく
}
//□汎用機能 - 検索 - アイテム名 - 実行
function GMapFunc_search_itemName_submit( event , form ){
	var searchName = document.getElementById( GMap_html_search_itemName_textField ).value;		//検索する文字
	//-- UI依存ここまで --

	GMapSearch.itemName.set( searchName );			//アイテム名を検索をセット
	GMapSearch.search();								//検索処理
}
//□汎用機能 - 検索 - アイテム名 - キーダウン
function GMapFunc_search_itemName_keydown( event , form ){
	if( event.keyCode == 13 ){ GMapFunc.search.itemName.submit( event , form ); }
}
//□汎用機能 - 検索 - アイテム名 - クリア
function GMapFunc_search_itemName_clear( event , form ){
	document.getElementById( GMap_html_search_itemName_textField ).value = "";	//フォームの値を削除
	//-- UI依存ここまで --
	GMapSearch.itemName.clear();						//アイテム名をクリア
	GMapSearch.search();								//検索処理
}
//□汎用機能 - 検索 -  絞り込み検索 - 条件の変更
function GMapFunc_search_narrow_change( event , form ){
	var key   = form.name;															//キー抽出
	if( form.type == "checkbox" ){	//チェックボックス
		var value = ( form.value.match( /!(\d+)/ ) ? RegExp.$1 :  form.value );		//値抽出
		var checked = ( form.checked ? 1 : 0 );
		if( form.value.match( /!/ ) ){ checked = Math.abs( checked - 1 ); }			//！が付いていたら反転
		value = ( checked ? value : 0 );
	} else {						//ラジオボタンとセレクトボックス
		var value = form.value;
	}
	//-- UI依存ここまで --

	GMapSearch.narrow.change( key , value );		//絞り込み条件の変更
	GMapSearch.search();								//検索処理
}
//□汎用機能 - ソート - 変更
function GMapFunc_sort_change( event , tempValue ){
	var sortKey = GMapCommon.Variable.convInputValue( tempValue );
	GMapSort.clear();		//ソートをクリア
	if( sortKey || sortKey != "-" ){ GMapSort.setSortVar( sortKey ); }	//ソートキーをセット（未指定の場合、ソートをしない）
	GMap_category[ GMap_focus_category ].marking();		//マーキングしなおし
	return GMapCommon.Event.cancel( event );				//イベントをキャンセルしとく
}
//□汎用機能 - ユーザーコントロール - マーカー - 変更
function GMapFunc_userControl_marker_changeVisibility( event , form ){ GMapMap.userControl.marker.changeVisibility( ( form.checked ? 1 : 0 ) ); }
function GMapFunc_userControl_marker_hidden( event , form           ){ GMapMap.userControl.marker.changeVisibility( 0 ); }
function GMapFunc_userControl_marker_visible( event , form          ){ GMapMap.userControl.marker.changeVisibility( 1 ); }
//□汎用機能 - ユーザーコントロール - センターマーカー - 変更
function GMapFunc_userControl_centerMarker_changeVisibility( event , form ){ GMapMap.userControl.centerMarker.changeVisibility( ( form.checked ? 1 : 0 ) ); }
function GMapFunc_userControl_centerMarker_hidden( event , form           ){ GMapMap.userControl.centerMarker.changeVisibility( 0 ); }
function GMapFunc_userControl_centerMarker_visible( event , form          ){ GMapMap.userControl.centerMarker.changeVisibility( 1 ); }
//□汎用機能 - ユーザーコントロール - マウスホイール - 状態変更
function GMapFunc_userControl_mouseWheel_changeStatus( event , tempValue ){
	var value = GMapCommon.Variable.convInputValue( tempValue , "isChecked" );
	GMapMap.userControl.mouseWheel.status = value;
}
//□汎用機能 - ユーザーコントロール - マウスホイール - 方向変更
function GMapFunc_userControl_mouseWheel_changeDirection( event , tempValue ){
	var value = GMapCommon.Variable.convInputValue( tempValue , "isChecked" );
	GMapMap.userControl.mouseWheel.reverse = tempValue;
}

//--------------------------------------------------------------------------------------------------
