//<![CDATA[
//*===============================================================
//○Zg呼出
//*===============================================================
var Zg = function( argId ) {
	if ( window == this || !this.initialize ) {
		return new Zg( argId );
	}
	return this.initialize( argId );
};
Zg.c = {
	//■ID名
	DIV_GMAP		: ''				,
	DIV_LIST		: '#results'		,
	DIV_PAGE		: '#numbers'		,
	DIV_TYPE		: '#buttons'		,
	INP_KEY			: '#key'			,
	//■リスト表示
	LISTMAX_ON		: 6					,	//一覧の画像あり
	LISTMAX_OFF		: 16				,	//一覧の画像なし
	LISTMAX_LEN_ON	: 17				,	//一覧の画像あり.タイトル文字数
	LISTMAX_LEN_OFF	: 10				,	//一覧の画像なし.タイトル文字数
	LISTMAX_PAGE	: 7					,	//ページボタン最大数
	LISTTYPE_IMG_ON	: 0					,	//リスト表示タイプ.画像あり
	LISTTYPE_IMG_OFF: 1					,	//リスト表示タイプ.画像なし
	LISTTYPE_GMAP	: 2					,	//リスト表示タイプ.マップ
	//■地図初期値
	DEFAULT_LAT		: 33.825000			,	//デフォルト.緯度
	DEFAULT_LNG		: 132.750000		,	//デフォルト.経度
	DEFAULT_ZOOM	: 12				,	//デフォルト.ズーム
	MENU_HEIGHT		: 296				,	//メニュー最小高
	DUMMY_END		: 0					
};
Zg.p = {
	//■GoogleMapsオブジェクト
	gMap			: null				,	//GoogleMapオブジェクト
	gGeo			: null				,	//ジオコーディングオブジェクト
	gOmc			: null				,	//オーバービューコントロール
	gWindow			: null				,	//別ウィンドウ
	//■オブジェクト表示
	gIcon			: []				,	//アイコンオブジェクト
	gMarkersNew		: []				,	//マーカー：表示用
	gMarkersOld		: []				,	//マーカー：削除用
	gEventsNew		: []				,	//イベント：表示用
	gEventsOld		: []				,	//イベント：削除用
	gZoom			: null				,	//地図検索の物件表示ズーム限界値
	//■リスト表示
	gRMaxRows		: 0					,	//ページ:最大行
	gRMaxPage		: 0					,	//ページ:最大ページ
	gRCurrent		: 0					,	//ページ:現ページ
	gROrder			: []				,	//ページ:ソート順
	gIduid			: []				,	//IDUID変換
	gListType		: 0					,	//リスト表示タイプ
	//■検索条件
	gSelected		: []				,	//東進スクール、東進四国衛星予備校
	DUMMY_END		: 0					
};
//*===============================================================
//○Zg初期化
//*===============================================================
Zg.prototype.initialize = function( argId ) {
//GLog.write('initialize');
	Zg.c.DIV_GMAP = '#' + argId;
	this.gElement = document.getElementById( argId );
	return this;
};
//*===============================================================
//○初期化
//*===============================================================
$( document ).ready(
	function() {
		//□初期処理
		Zg( 'map' ).start();
//		//□画面のリサイズイベント登録
//		$( window ).resize( function(){
//			Zg( 'map' ).start();
//		});
	}
);
//*===============================================================
//○初期処理
//*===============================================================
Zg.prototype.start = function() {
//GLog.write('start');
	//◆Google Mapを構築済みならアンロード
	if ( Zg.p.gMap != null ) {
		GUnload();
	}
	this.loadImage([
		'images/map_school.png'			,
		'images/map_school_ov.png'		,
		'images/map_school_ro.png'		,
		'images/map_school_ro_ov.png'	,
		'images/map_yobikou.png'		,
		'images/map_yobikou_ov.png'		,
		'images/map_yobikou_ro.png'		,
		'images/map_yobikou_ro_ov.png'	,
		'images/1.png'					,
		'images/2.png'					,
		'images/3.png'					,
		'images/4.png'					,
		'images/5.png'					,
		'images/6.png'					,
		'images/7.png'					,
		'images/1_on.png'				,
		'images/2_on.png'				,
		'images/3_on.png'				,
		'images/4_on.png'				,
		'images/5_on.png'				,
		'images/6_on.png'				,
		'images/7_on.png'				,
		''
	]);
	
	//◆Google Mapsが利用できるブラウザかどうか判断
	if ( GBrowserIsCompatible() ) {
		//◇利用可能
		//□ウィンドウフィット処理
		this.windowFit();
		//□ジオコーディングのインスタンス化
		Zg.p.gGeo = new GClientGeocoder();
		//□地図のインスタンスを作成
		Zg.p.gMap = new GMap2( $( Zg.c.DIV_GMAP ).gid()	, G_NORMAL_MAP );
		//□オーバービュー追加
		Zg.p.gOmc = new GOverviewMapControl();
		Zg.p.gMap.addControl( Zg.p.gOmc );
		//□移動/縮尺ボタンをつける
		Zg.p.gMap.addControl(
			new GLargeMapControl() ,
			new GControlPosition( G_ANCHOR_TOP_RIGHT  , new GSize( 4 , 32 ) )
		);
		//□地図/衛星写真/地形 切り替え
		Zg.p.gMap.addControl(
			new GMenuMapTypeControl( true , false ) ,
			new GControlPosition( G_ANCHOR_TOP_RIGHT  , new GSize( 2 , 2 ) )
		);
		Zg.p.gMap.addMapType( G_PHYSICAL_MAP );
		//□ズームイン時にスムーズ
		Zg.p.gMap.enableContinuousZoom();
		//□ダブルクリック時にズームイン
		Zg.p.gMap.enableDoubleClickZoom();
		//□初期表示位置を設定
		Zg.p.gMap.setCenter( new GLatLng( parseFloat( Zg.c.DEFAULT_LAT ) , parseFloat( Zg.c.DEFAULT_LNG ) ) , parseInt( Zg.c.DEFAULT_ZOOM , 10 ) );
		//□マウススクロール時にズームイン・ズームアウト
		Zg.p.gMap.enableScrollWheelZoom();
		GEvent.addDomListener( $( Zg.c.DIV_GMAP ).gid() , 'DOMMouseScroll' , this.cancelEventMouse );
		GEvent.addDomListener( $( Zg.c.DIV_GMAP ).gid() , 'mousewheel'     , this.cancelEventMouse );
		
		//□初期化
		this.clearAllParameter();
		//□アイコン作成
		this.makeIcon();
		//□リストを取得
		this.loadList( '' );
		//□マウスムーブイベントを追加
		GEvent.addListener( Zg.p.gMap , 'dragend' , function() {
			//□格納したズーム値をクリア
			Zg.p.gRZoom = 0;
			//□リストを取得
			Zg.prototype.loadList( '' );
		} );
		//□マウスズームイベントを追加
		GEvent.addListener( Zg.p.gMap , 'zoomend' , function( oldZoom , newZoom ) {
			//□リストを取得
			Zg.prototype.loadList( '' );
		} );
	}
};
//*===============================================================
//○ウィンドウフィット処理
//*===============================================================
Zg.prototype.windowFit = function() {
//GLog.write('windowFit');
	var w = '';
	var h = '';
	if        ( $.browser.msie		 ) {
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	} else if ( $.browser.safari	) {
		w = innerWidth;
		h = innerHeight;
	} else if ( $.browser.opera		) {
		w = document.body.clientWidth - 6;
		h = document.body.clientHeight - 6;
	} else if ( $.browser.mozilla	) {
		w = innerWidth;
		h = innerHeight;
	}
	$( Zg.c.DIV_GMAP ).css({
		'width'	: w,
		'height': h 
	});
	//□一覧の件数調整
	var hList = h - Zg.c.MENU_HEIGHT;
	hList = parseInt( hList / 72 );
	Zg.c.LISTMAX_ON = hList;
};
//*===============================================================
//○マウススクロールキャンセル処理
//*===============================================================
Zg.prototype.cancelEventMouse = function( argEvent ) {
//GLog.write('cancelEventMouse');
	var e	= argEvent;
	if (typeof e.preventDefault  == 'function') {
		e.preventDefault();
	}
	if (typeof e.stopPropagation == 'function') {
		e.stopPropagation();
	}
	if ( window.event ) {
		window.event.cancelBubble	= true;
		window.event.returnValue	= false;
	}
};
//*===============================================================
//○変数初期化
//*===============================================================
Zg.prototype.clearAllParameter = function() {
//GLog.write('clearAllParameter');
	Zg.p.gMap.clearOverlays();
	
	if ( Zg.p.gMarkersNew != null ) {
		for( idx in Zg.p.gMarkersNew ) {
			Zg.p.gMap.removeOverlay	( Zg.p.gMarkersNew[idx]	);
		}
	}
	if ( Zg.p.gMarkersOld != null ) {
		for( idx in Zg.p.gMarkersOld ) {
			Zg.p.gMap.removeOverlay	( Zg.p.gMarkersOld[idx]	);
		}
	}
	if ( Zg.p.gEventsNew != null ) {
		for( idx in Zg.p.gEventsNew ) {
			GEvent.removeListener	( Zg.p.gEventsNew[idx]	);
		}
	}
	if ( Zg.p.gEventsOld != null ) {
		for( idx in Zg.p.gEventsOld ) {
			GEvent.removeListener	( Zg.p.gEventsOld[idx]	);
		}
	}
	
	Zg.p.gIcon					= new Array();
	Zg.p.gMarkersNew			= new Array();
	Zg.p.gMarkersOld			= new Array();
	Zg.p.gEventsNew				= new Array();
	Zg.p.gEventsOld				= new Array();
	Zg.p.gROrder				= new Array();
	Zg.p.gIduid					= new Array();
	Zg.p.gSelected				= new Array();
	if        ( CONST_Q == '1' ) {
		Zg.p.gSelected[0]			= 1;
		Zg.p.gSelected[1]			= 0;
	} else if ( CONST_Q == '2' ) {
		Zg.p.gSelected[0]			= 0;
		Zg.p.gSelected[1]			= 1;
	} else {
		Zg.p.gSelected[0]			= 0;
		Zg.p.gSelected[1]			= 0;
	}
	
	//□ソート条件の初期化
	this.setOrder		( 1 , 1 );	//画像あり
	//□検索条件の初期化
	this.setSelect		( 0 );
	//□リストの表示タイプ
	if ( Zg.p.gListType == null ) {
		Zg.p.gListType = Zg.c.LISTTYPE_IMG_ON;	//画像あり
	}
};
//*===============================================================
//○ソートとリスト描画
//*===============================================================
Zg.prototype.setOrder = function( argIdx , argValue ) {
//GLog.write('setOrder');
	Zg.p.gROrder[0] = 0;
	Zg.p.gROrder[1] = 0;
	Zg.p.gROrder[2] = 0;
	Zg.p.gROrder[3] = 0;
	Zg.p.gROrder[argIdx] = argValue;
	
	//□リスト描画
	this.viewList( 0 );
};
//*===============================================================
//○検索条件
//*===============================================================
Zg.prototype.setSelect = function( argFlg ) {
//GLog.write('setSelect');
	var html = '';
	
	//□条件の反転
	if ( argFlg > 0 ) {
		if ( Zg.p.gSelected[argFlg-1] == 1 ) {
			Zg.p.gSelected[argFlg-1] = 0;
		} else {
			Zg.p.gSelected[argFlg-1] = 1;
		}
	}
	//□条件描画
	html += '<a href="#" onclick="Zg.prototype.setSelect(1);return false;">';
	if ( Zg.p.gSelected[0] == 1 ) {
		html += '<img src="images/map_school.png"';
		html += ' onmouseover="this.src=\'images/map_school_ov.png\';"';
		html += ' onmouseout="this.src=\'images/map_school.png\';"';
		html += ' alt="東進スクールを探す" width="213" height="60" class="imgover" />';
	} else {
		html += '<img src="images/map_school_ro.png"';
		html += ' onmouseover="this.src=\'images/map_school_ro_ov.png\';"';
		html += ' onmouseout="this.src=\'images/map_school_ro.png\';"';
		html += ' alt="東進スクールを探す" width="213" height="60" class="imgover" />';
	}
	html += '</a>';
	html += '<a href="#" onclick="Zg.prototype.setSelect(2);return false;">';
	if ( Zg.p.gSelected[1] == 1 ) {
		html += '<img src="images/map_yobikou.png"';
		html += ' onmouseover="this.src=\'images/map_yobikou_ov.png\';"';
		html += ' onmouseout="this.src=\'images/map_yobikou.png\';"';
		html += ' alt="東進衛星予備校を探す" width="213" height="60" class="imgover" />';
	} else {
		html += '<img src="images/map_yobikou_ro.png"';
		html += ' onmouseover="this.src=\'images/map_yobikou_ro_ov.png\';"';
		html += ' onmouseout="this.src=\'images/map_yobikou_ro.png\';"';
		html += ' alt="東進衛星予備校を探す" width="213" height="60" class="imgover" />';
	}
	html += '</a>';
	
	$( Zg.c.DIV_TYPE  ).html( html );
	
	this.loadList( '' ) ;
};

//*===============================================================
//○リストの表示
//*===============================================================
Zg.prototype.viewList = function( argPageMumber ) {
//GLog.write('viewList');
	if ( Zg.p.gListType != null ) {
		//□ページの計算
		if ( argPageMumber < 0 ) {
			argPageMumber = 0;
		}
		if ( argPageMumber > Zg.p.gRMaxPage ) {
			argPageMumber = Zg.p.gRMaxPage;
		}
		Zg.p.gRCurrent = argPageMumber;
		
		//□ページ選択
		$( Zg.c.DIV_PAGE ).html( '' );
		$( Zg.c.DIV_PAGE ).html( this.getHtmlPageNavi( Zg.p.gRCurrent , Zg.p.gRMaxPage ) );
		
		//□リストの表示
		var html = this.makeList( Zg.p.gMarkersNew );
		$( Zg.c.DIV_LIST ).html( ''   );
		$( Zg.c.DIV_LIST ).html( html );
	}
};
//*===============================================================
//○ページ選択作成
//*===============================================================
Zg.prototype.getHtmlPageNavi = function( argCurrentPage , argMmaxPage ) {
//GLog.write('getHtmlPageNavi');
	var html	= '';
	var prev	= '';
	var next	= '';
	var page	= 0;
	
	if ( Zg.p.gListType != Zg.c.LISTTYPE_GMAP ) {
		page = argMmaxPage;
		if ( page > Zg.c.LISTMAX_PAGE ) {
			page = Zg.c.LISTMAX_PAGE;
		}
		
		if ( page > 0 ) {
			html += '<ul>';
			html += '<li>';
			if ( Zg.p.gRCurrent > 0 && page != 0 ) {
				html += '<a href="#" onclick="Zg.prototype.viewList('	+ ( Zg.p.gRCurrent - 1 )	+ ');return false;" title="前へ">前<</a>';
			} else {
				html += '前<';
			}
			html += '</li>';
			for ( var idx = 0; idx < page; idx++ ) {
				html += '<li>';
				//◇選択ページか
				if ( argCurrentPage == idx ) {
					//◆選択ページ
					if ( idx < 9 ) {
						html += '<img src="images/'	+ ( idx + 1 ) + '_on.png" alt="'		+ ( idx + 1 ) + 'ページ" width="16" height="16" />';
					} else {
						html += '<img src="images/'	+ ( idx + 1 ) + '_on.png" alt="'		+ ( idx + 1 ) + 'ページ" width="16" height="16" />';
					}
				} else {
					//◆未選択ページ
					html += '<a href="#" onclick="Zg.prototype.viewList('	+ idx	+ ');return false;" title="' + idx + 'ページ">';
					if ( idx < 9 ) {
						html += '<img src="images/'	+ ( idx + 1 ) + '.png" alt="'	+ ( idx + 1 ) + 'ページ" width="16" height="16" />';
					} else {
						html += '<img src="images/'	+ ( idx + 1 ) + '.png" alt="'	+ ( idx + 1 ) + 'ページ" width="16" height="16" />';
					}
					html += '</a>';
				}
				html += '</li>';
			}
			html += '<li>';
			if ( Zg.p.gRCurrent < page - 1 && page != 0 ) {
				html += '<a href="#" onclick="Zg.prototype.viewList('	+ ( Zg.p.gRCurrent + 1 )	+ ');return false;" title="次へ">>次</a>';
			} else {
				html += '>次';
			}
			html += '</li>';
			html += '</ul>';
			html += '<br class="clear" />';
		}
	}
	return html;
};
//*===============================================================
//○リストの作成
//*===============================================================
Zg.prototype.makeList = function( argMarkers ) {
//GLog.write('makeList');
	var html    = '';
	var start	= 0 ;
	var end		= 0 ;
	var maxrow	= 0 ;
	var objBound= Zg.p.gMap.getBounds();
	
	if ( Zg.p.gListType == null || Zg.p.gRMaxRows == 0 ) {
		return html;
	}
	
	maxrow	= this.getMaxrow();
	start	= Zg.p.gRCurrent * maxrow;
	end		= ( Zg.p.gRCurrent + 1 ) * maxrow;
	if ( end > Zg.p.gRMaxRows ) {
		end = Zg.p.gRMaxRows;
	}
	
	//□ユニークIDの格納
	if ( argMarkers != '' ) {
		Zg.p.gIduid = new Array();
		for ( idx = 0; idx < Zg.p.gRMaxRows; idx++ ) {
			Zg.p.gIduid[idx] = argMarkers[idx]['uid'];
		}
		
		//□リスト作成
		if        ( Zg.p.gListType == Zg.c.LISTTYPE_IMG_ON ) {
			//---------------------------------------------------------------
			//◆画像
			//---------------------------------------------------------------
			for ( var idx = start; idx < end; idx++ ) {
				if (
					(
						( argMarkers[idx]['group'] == '1' && Zg.p.gSelected[0] == 1 )
					||	( argMarkers[idx]['group'] == '2' && Zg.p.gSelected[1] == 1 )
					)
					&&	parseFloat( argMarkers[idx]['latitude' ] ) >= objBound.getSouthWest().lat()
					&&	parseFloat( argMarkers[idx]['longitude'] ) >= objBound.getSouthWest().lng()
					&&	parseFloat( argMarkers[idx]['latitude' ] ) <= objBound.getNorthEast().lat()
					&&	parseFloat( argMarkers[idx]['longitude'] ) <= objBound.getNorthEast().lng()
				) {
					var id = 'list_'  + argMarkers[idx]['id'];
				    
					html += '<div';
					html += ' id="' + id + '"';
					html += ' onmouseover="$(\'#' + id + '\').css(\'background-image\',\'url(images/classroom_ro.png)\');"';
					html += ' onmouseout="$(\'#'  + id + '\').css(\'background-image\',\'url(images/classroom.png)\');"';
					html += ' onclick="Zg.prototype.clickListInfowindow(' + idx + ');return false;"';
					html += ' class="classrooms">';
					html += '<div class="results_left">';
					if ( argMarkers[idx]['image'] != '-' ) {
						html += '<img';
						html += ' src="r.php?w=69&q=80&g='	+ argMarkers[idx]['image'	] + '"';
						html += ' alt="'	+ argMarkers[idx]['name'	] + '"';
						html += ' width="69" height="54" />';
					} else {
						html += '<img';
						html += ' src="images/noimage.png"';
						html += ' alt="'	+ argMarkers[idx]['name'	] + '"';
						html += ' width="69" height="54" />';
					}
					html += '</div>';
					html += '<div class="results_right">';
					switch( argMarkers[idx]['group'] ) {
						case '1':
							html += '<img src="images/group1.png" alt="' + argMarkers[idx]['name'	] + '" width="14" height="14" class="icon_group" />';
							break;
						case '2':
							html += '<img src="images/group2.png" alt="' + argMarkers[idx]['name'	] + '" width="14" height="14" class="icon_group" />';
							break;
						default:
					}
					if ( argMarkers[idx]['jumpurl'] != '-' ) {
						html += '<a href="#" onclick="Zg.prototype.openwin(\'' + argMarkers[idx]['jumpurl'] + '\',800,800);">';
					}
					html += argMarkers[idx]['name'	];
					if ( argMarkers[idx]['jumpurl'] != '-' ) {
						html += '</a>';
					}
					html += '<br />';
					html += 'TEL.';
					html += argMarkers[idx]['tel'	];
					html += '</div>';
					html += '<br class="clear" />';
					html += '</div>';
				}
			}
			
		} else if ( Zg.p.gListType == Zg.c.LISTTYPE_IMG_OFF	) {
			//---------------------------------------------------------------
			//◆テキスト
			//---------------------------------------------------------------
		} else if ( Zg.p.gListType == Zg.c.LISTTYPE_GMAP		) {
			//---------------------------------------------------------------
			//◆マップ
			//---------------------------------------------------------------
		}
	}
	return html;
};
//*===============================================================
//○リストをクリックし情報ウィンドウを表示
//*===============================================================
Zg.prototype.clickListInfowindow = function( argIdx ) {
//GLog.write('clickListInfowindow');
	Zg.p.gMap.removeControl( Zg.p.gCtrlS );
	var html = Zg.p.gMarkersNew[argIdx]['html'].replace( '##ID##' , argIdx );
	Zg.p.gMarkersNew[argIdx].openInfoWindowHtml( html );
};
//*===============================================================
//○文字列数カット
//*===============================================================
Zg.prototype.stringCutter = function( argString , argLength ) {
//GLog.write('stringCutter');
	var strTmp = argString;
	if ( strTmp != null ) {
		if ( strTmp.length > argLength ) {
		    strTmp = strTmp.substring( 0 , argLength ) + '…';
		}
	}
	return strTmp;
};
//*===============================================================
//○別ウインドウを開く
//*===============================================================
Zg.prototype.openwin = function( argUrl , argWidth , argHeight ) {
	if ( window.gWindow ) {
		Zg.p.gWindow.close();
	}
	Zg.p.gWindow = window.open( argUrl , 'win' , 'width=' + argWidth + ',height=' + argHeight + ',status=no,scrollbars=yes,directories=no,menubar=no,resizable=yes,toolbar=no' );
};
//*===============================================================
//○別PG画面を開く
//*===============================================================
Zg.prototype.openPG = function( argPG ) {
	var url = this.makeRequestSelect( argPG );
	window.location.href = url;
};
//*===============================================================
//○アイコン作成
//*===============================================================
Zg.prototype.makeIcon = function( argPG ) {
//GLog.write('makeIcon');
	//アイコン
	for( var idx = 1; idx <= 3; idx++ ) {
		Zg.p.gIcon[idx]					= new GIcon();
		Zg.p.gIcon[idx].image			= 'images/map_icon_' + idx + '.png';
		Zg.p.gIcon[idx].iconSize		= new GSize ( 39 , 49 );
		Zg.p.gIcon[idx].iconAnchor		= new GPoint( 19 , 49 );
		Zg.p.gIcon[idx].shadow    	 	= 'images/map_shadow.png';
		Zg.p.gIcon[idx].shadowSize		= new GSize ( 47 , 47 );
		Zg.p.gIcon[idx].infoWindowAnchor= new GPoint( 18 , 23 );
	}
};
//*===============================================================
//○リストを取得
//*===============================================================
Zg.prototype.loadList = function( argId ) {
//GLog.write('loadList');
	//---------------------------------------------------------------
	//施設データ
	//---------------------------------------------------------------
	GDownloadUrl( this.makeRequestString( 'marker/data.xml' ) , function( data, responseCode ) {
		var xmlDoc 		= GXml.parse( data );
		var objBound	= Zg.p.gMap.getBounds();
		markers			= xmlDoc.documentElement.getElementsByTagName( 'marker' );
		Zg.p.gRMaxRows	= 0;
		
		//□旧イベントを削除
		Zg.prototype.clearOldEvent();
		
		//□マーカーを作成
		for ( var idx = 0; idx < markers.length; idx++ ) {
			//□マーカーを１つずつ作成する
			if (
				(
					( markers[idx].getAttribute( 'group' ) == '1' && Zg.p.gSelected[0] == 1 )
				||	( markers[idx].getAttribute( 'group' ) == '2' && Zg.p.gSelected[1] == 1 )
				)
				&&	parseFloat( markers[idx].getAttribute( 'latitude'	) ) >= objBound.getSouthWest().lat()
				&&	parseFloat( markers[idx].getAttribute( 'longitude'	) ) >= objBound.getSouthWest().lng()
				&&	parseFloat( markers[idx].getAttribute( 'latitude'	) ) <= objBound.getNorthEast().lat()
				&&	parseFloat( markers[idx].getAttribute( 'longitude'	) ) <= objBound.getNorthEast().lng()
			) {
				Zg.prototype.makeMarker( markers, idx );
				Zg.p.gRMaxRows++;
			}
		}
		
		//□一覧を表示する
		Zg.p.gRMaxPage = Zg.prototype.makeMaxPage( Zg.p.gRMaxRows , Zg.prototype.getMaxrow() );
		Zg.prototype.viewList( 0 );
		
		//□旧マーカーの削除
		Zg.prototype.clearOldParameter();
	} );
};
//*===============================================================
//○変数の作成
//*===============================================================
Zg.prototype.makeRequestString = function( argPG ) {
//GLog.write('makeRequestString');
	var request   = '';
	var strtmp    = '';
	
	request = argPG + '?x=1' + request;
	
	return request;
};
//*===============================================================
//○旧イベントのクリア
//*===============================================================
Zg.prototype.clearOldEvent = function() {
//GLog.write('clearOldEvent');
	Zg.p.gZoom			= Zg.p.gMap.getZoom();
	Zg.p.gMarkersOld	= Zg.p.gMarkersNew;
	Zg.p.gEventsOld		= Zg.p.gEventsNew;
	Zg.p.gMarkersNew	= new Array();
	Zg.p.gEventsNew		= new Array();
};
//*===============================================================
//○マーカーの作成
//*===============================================================
Zg.prototype.makeMarker = function( argMarker , argIdx ) {
//GLog.write('makeMarker');
	var objIcon = Zg.p.gIcon[ parseInt( argMarker[argIdx].getAttribute( 'mapflg' ) , 10 ) ];
	
	var marker		= new GMarker(
		new GLatLng(
			parseFloat( argMarker[argIdx].getAttribute( 'latitude'	)	),
			parseFloat( argMarker[argIdx].getAttribute( 'longitude'	)	)
		) ,
		{
			title		: argMarker[argIdx].getElementsByTagName( 'mapname'	)[0].firstChild.nodeValue,
			icon		: objIcon
		}
	);
	
	//●インフォウィンドウの中身
	var html = this.makeInfowindow( argMarker , argIdx );
	marker['html'		]	= html;
	//●インフォウィンドウ用に保持
	marker['id'			]	= argMarker[argIdx].getAttribute( 'id'			);
	marker['latitude'	]	= argMarker[argIdx].getAttribute( 'latitude'	);
	marker['longitude'	]	= argMarker[argIdx].getAttribute( 'longitude'	);
	marker['group'		]	= argMarker[argIdx].getAttribute( 'group'		);
	marker['mapflg'		]	= argMarker[argIdx].getAttribute( 'mapflg'		);
	marker['name'		]	= argMarker[argIdx].getElementsByTagName( 'name'	)[0].firstChild.nodeValue;
	marker['mapname'	]	= argMarker[argIdx].getElementsByTagName( 'mapname'	)[0].firstChild.nodeValue;
	marker['post'		]	= argMarker[argIdx].getElementsByTagName( 'post'	)[0].firstChild.nodeValue;
	marker['address'	]	= argMarker[argIdx].getElementsByTagName( 'address'	)[0].firstChild.nodeValue;
	marker['access'		]	= argMarker[argIdx].getElementsByTagName( 'access'	)[0].firstChild.nodeValue;
	marker['tel'		]	= argMarker[argIdx].getElementsByTagName( 'tel'		)[0].firstChild.nodeValue;
	marker['jumpurl'	]	= argMarker[argIdx].getElementsByTagName( 'jumpurl'	)[0].firstChild.nodeValue;
	marker['image'		]	= argMarker[argIdx].getElementsByTagName( 'image'	)[0].firstChild.nodeValue;
	
	//□クリック時にインフォウィンドウを開くイベントを追加
	var eve_click = GEvent.addListener( marker, 'click', function() {
		for ( var idx = 0; idx < Zg.p.gIduid.length; idx++ ) {
			if ( Zg.p.gIduid[ idx ] == marker['uid'] ) {
				var html = marker['html'].replace( '##ID##' , idx );
				marker.openInfoWindowHtml( html );
				break;
			}
		}
	} );
	
	//□イベントを削除用に格納
	Zg.p.gEventsNew.push	( eve_click	);
	Zg.p.gMarkersNew.push	( marker	);
	Zg.p.gMap.addOverlay	( marker	);
};
//*===============================================================
//○情報ウィンドウの内容を作成
//*===============================================================
Zg.prototype.makeInfowindow = function( argMarker , argIdx ) {
//GLog.write('makeInfowindow');
	var html	= '';
	
	html += '<div class="lyt_infowindow">';
	if ( argMarker[argIdx].getElementsByTagName( 'image'	)[0].firstChild.nodeValue != '-' ) {
		html += '<p class="lyt_center">';
		html += '<img';
		html += ' src="'	+ argMarker[argIdx].getElementsByTagName( 'image'	)[0].firstChild.nodeValue	+ '"';
		html += ' alt="'	+ argMarker[argIdx].getElementsByTagName( 'mapname'	)[0].firstChild.nodeValue	+ '"';
		html += ' height="180"';
		html += ' class="shopimage"';
		html += ' />';
		html += '</p>';
	}
	html += '<h4>';
	if ( argMarker[argIdx].getElementsByTagName( 'jumpurl'	)[0].firstChild.nodeValue != '-' ) {
		html += '<a href="#" onclick="Zg.prototype.openwin(\'' + argMarker[argIdx].getElementsByTagName( 'jumpurl' )[0].firstChild.nodeValue + '\',800,800);">';
	}
	html += argMarker[argIdx].getElementsByTagName( 'mapname'	)[0].firstChild.nodeValue;
	switch( argMarker[argIdx].getAttribute( 'mapflg' ) ) {
		case '1':
			html += '<img src="images/group1.png" alt="" width="14" height="14" class="icon" />';
			break;
		case '2':
			html += '<img src="images/group2.png" alt="" width="14" height="14" class="icon" />';
			break;
		case '3':
			html += '<img src="images/group1.png" alt="" width="14" height="14" class="icon" />';
			html += '<img src="images/group2.png" alt="" width="14" height="14" class="icon" />';
			break;
		default:
	}
	if ( argMarker[argIdx].getElementsByTagName( 'jumpurl'	)[0].firstChild.nodeValue != '-' ) {
		html += '</a>';
	}
	html += '</h4>';
	html += '<table class="lyt_table">';
	html += '<tr>';
	html += '<th>住所：</th>';
	html += '<td>';
	html += '〒';
	html += argMarker[argIdx].getElementsByTagName( 'post'		)[0].firstChild.nodeValue;
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<th></th>';
	html += '<td>';
	html += argMarker[argIdx].getElementsByTagName( 'address'	)[0].firstChild.nodeValue;
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<th>電話番号：</th>';
	html += '<td>';
	html += '<span>';
	html += argMarker[argIdx].getElementsByTagName( 'tel'		)[0].firstChild.nodeValue;
	html += '</span>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<th>アクセス：</th>';
	html += '<td>';
	html += argMarker[argIdx].getElementsByTagName( 'access'	)[0].firstChild.nodeValue;
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	if ( argMarker[argIdx].getAttribute( 'mapflg' ) == '3' ) {
		switch ( argMarker[argIdx].getAttribute( 'group' ) ) {
			//◆分類=1
			case '1':
				var join_id = 0;
				for ( var idx = 0; idx < argMarker.length; idx++ ) {
					if (
						argMarker[idx].getAttribute( 'group'   ) == '2'
					&&	argMarker[idx].getAttribute( 'mapflg'  ) == '3'
					&&	argMarker[idx].getElementsByTagName( 'mapname' )[0].firstChild.nodeValue == argMarker[argIdx].getElementsByTagName( 'mapname' )[0].firstChild.nodeValue
					) {
						join_id = argMarker[idx].getAttribute( 'id' );
						break;
					}
				}
				html += '<p class="lyt_center">';
				html += '<a href="../form_input.php?q=' + argMarker[argIdx].getAttribute( 'id' ) + '" title="お問い合わせ・資料請求">';
				html += '<img src="images/contact1.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
				html += '</a>';
				html += '</p>';
				html += '<p>&nbsp;</p>'
				html += '<p class="lyt_center">';
				html += '<a href="../form_input.php?q=' + join_id + '" title="お問い合わせ・資料請求">';
				html += '<img src="images/contact2.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
				html += '</a>';
				html += '</p>';
				break;
			//◆分類=2
			case '2':
				var join_id = 0;
				for ( var idx = 0; idx < argMarker.length; idx++ ) {
					if (
						argMarker[idx].getAttribute( 'group'   ) == '1'
					&&	argMarker[idx].getAttribute( 'mapflg'  ) == '3'
					&&	argMarker[idx].getElementsByTagName( 'mapname' )[0].firstChild.nodeValue == argMarker[argIdx].getElementsByTagName( 'mapname' )[0].firstChild.nodeValue
					) {
						join_id = argMarker[idx].getAttribute( 'id' );
						break;
					}
				}
				html += '<p class="lyt_center">';
				html += '<a href="../form_input.php?q=' + join_id + '" title="お問い合わせ・資料請求">';
				html += '<img src="images/contact1.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
				html += '</a>';
				html += '</p>';
				html += '<p>&nbsp;</p>'
				html += '<p class="lyt_center">';
				html += '<a href="../form_input.php?q=' + argMarker[argIdx].getAttribute( 'id' ) + '" title="お問い合わせ・資料請求">';
				html += '<img src="images/contact2.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
				html += '</a>';
				html += '</p>';
				break;
			//◆その他
			default:
		}
/*
		html += '<p class="lyt_center">';
		html += '<a href="../form_input.php?q=8" title="お問い合わせ・資料請求">';
		html += '<img src="images/contact1.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
		html += '</a>';
		html += '</p>';
		html += '<p>&nbsp;</p>'
		html += '<p class="lyt_center">';
		html += '<a href="../form_input.php?q=22" title="お問い合わせ・資料請求">';
		html += '<img src="images/contact2.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
		html += '</a>';
		html += '</p>';
*/
	} else {
		html += '<p class="lyt_center">';
		html += '<a href="../form_input.php?q=' + argMarker[argIdx].getAttribute( 'id' ) + '" title="お問い合わせ・資料請求">';
		html += '<img src="images/contact' + argMarker[argIdx].getAttribute( 'group' ) + '.png" alt="お問い合わせ・資料請求" width="213" height="41" class="contact" />';
		html += '</a>';
		html += '</p>';
	}
	html += '</div>';
	
	return html;
};
//*===============================================================
//○ページ最大数を取得
//*===============================================================
Zg.prototype.makeMaxPage = function( argMax_rows , argMax_list ) {
//GLog.write('makeMaxPage');
	if ( argMax_rows <= 0 ) {
		return 0;
	}
	var max_page = Math.ceil( argMax_rows / argMax_list );
	
	return max_page;
};
//*===============================================================
//○表示件数取得
//*===============================================================
Zg.prototype.getMaxrow = function() {
//GLog.write('getMaxrow');
	var maxrow = 0;
	
	if        ( Zg.p.gListType == Zg.c.LISTTYPE_IMG_ON		) {
		//◆画像あり
		maxrow = Zg.c.LISTMAX_ON;
	} else if ( Zg.p.gListType == Zg.c.LISTTYPE_IMG_OFF		) {
		//◆画像なし
		maxrow = Zg.c.LISTMAX_OFF;
	} else if ( Zg.p.gListType == Zg.c.LISTTYPE_GMAP		) {
		//◆マップ
	}
	
	return maxrow;
};
//*===============================================================
//○旧情報のクリア
//*===============================================================
Zg.prototype.clearOldParameter = function() {
//GLog.write('clearOldParameter');
	for( idx in Zg.p.gMarkersOld ) {
		Zg.p.gMap.removeOverlay	( Zg.p.gMarkersOld[idx]	);
	}
	for( idx in Zg.p.gEventsOld ) {
		GEvent.removeListener	( Zg.p.gEventsOld[idx]	);
	}
	
	Zg.p.gMarkersOld	= new Array();
	Zg.p.gEventsOld		= new Array();
};
//*===============================================================
//○ジオコード処理
//*===============================================================
Zg.prototype.getGecode = function() {
//GLog.write('getGecode');
	var strError	= '';
	if ( Zg.p.gGeo ) {
		Zg.p.gGeo.getLatLng(
			$( Zg.c.INP_KEY ).val(),
			function( point ) {
				if ( point ) {
					Zg.p.gMap.setCenter( point , 12 );
					$( INP_KEY ).val( '' );
					//□リストを取得
					this.loadList( '' );
				} else {
					if ( $( Zg.c.INP_KEY ).val() != '' ) {
						strError = $( Zg.c.INP_KEY ).val() + 'は見つかりませんでした';
						$( Zg.c.DIV_MSG ).html( strError );
						$( Zg.c.DIV_MSG ).css( 'display' , 'inline' );
					}
				}
			}
		);
	}
};
//*===============================================================
//○画像先読み処理
//*===============================================================
Zg.prototype.loadImage = function( argImages ) {
	for( var idx = 0; idx < argImages.length; idx++ ){
		if ( argImages != '' ) {
			var image = new Image();
			image.src = argImages[idx];
		}
	}
};
//]]>