if(!PSINC) { var PSINC = {} };
if(!PSINC.googleLatLonSearch) { PSINC.googleLatLonSearch = {} };
(function(){
	var d = document;
	var map;
	//var requestUrl = "http://test.finalchecker.jp/";
	//var requestUrlHttps = "https://test.finalchecker.jp/";
	var requestUrl = "http://finalchecker.jp/";
	var requestUrlHttps = "https://finalchecker.jp/";
	
	var form_id = "";
	var param_form_id = "";
	var site_arr = new Array();
	var show_cnt = 0;
	var page_no = 0;
	
	var url_top = "";
	var hotel_arr = new Array();
	var clip_request_array = new Array();
	
	var hotel_info = new Object();
	var hotel_reptation = new Object();
	var hotel_min_price = new Object();
	
	var markerList = [];
	
	//地図表示の初期設定
	if(!PSINC.googleLatLonSearch.init) {
		PSINC.googleLatLonSearch.init = function (formId,divId,lat,lon,zoom) {
			if (GBrowserIsCompatible()) {
				map = new GMap2(document.getElementById(divId));
				map.setCenter(new GLatLng(lat, lon), zoom);
				//コントロールの追加
				var ctrlObj= new GLargeMapControl();
				map.addControl(ctrlObj);
				var position2 = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(80,20));
				map.addControl(new GScaleControl(),position2);

				//地図が移動したら、表示をリセットする
				GEvent.addListener(map, 'moveend', function() {
					PSINC.googleLatLonSearch.markerReset();
				});

				//地図のズームが変わったら、表示をリセットする
				GEvent.addListener(map, 'zoom', function() {
					PSINC.googleLatLonSearch.markerReset();
				});


				 //マウスホイールによるズーム処理を有効化
//機能停止
//				map.addControl(new GOverviewMapControl());
				
			}
		}
	}
	
	//ホテル名クリック時の動作
	if(!PSINC.googleLatLonSearch.clickHotelName) {
		PSINC.googleLatLonSearch.clickHotelName = function (htlCd) {
			//特定のマーカーのオンマウスイベントを発生させることで、吹き出しを開く
			GEvent.trigger(markerList[htlCd], "mouseover");
			return false;
		}
	}
	
	//地図の緯度経度情報取得
	if(!PSINC.googleLatLonSearch.getLatLon) {
		PSINC.googleLatLonSearch.getLatLon = function () {
			var rectObj = map.getBounds();
			var mapArea = rectObj.getSouthWest() + ", "+rectObj.getNorthEast();
			return mapArea;
		}
	}
	
	//ホテルジャンルの条件取得
	if(!PSINC.googleLatLonSearch.getHotelGenre) {
		PSINC.googleLatLonSearch.getHotelGenre = function () {
	
			var genre_max = document.getElementById('mapSearchArea').elements['genre_max'].value;
			
			var hotelGenre = "";
			
			for(var i=1;i<(Number(genre_max)+1);i++){
				if (document.getElementById('mapSearchArea').elements['hotel_genre_'+i].value != undefined) {
					hotelGenre += document.getElementById('mapSearchArea').elements['hotel_genre_'+i].value;
					if (i != genre_max) {
						hotelGenre += ',';
					}
				
				} else {
					if (i != genre_max) {
						hotelGenre += ',';
					}
				}
			}
			
			return hotelGenre;
		}
	}
	
	if(!PSINC.googleLatLonSearch.addOverlay) {
		PSINC.googleLatLonSearch.addOverlay = function (obj) {
			map.addOverlay(obj);
		}
	}

	if(!PSINC.googleLatLonSearch.editMarkerImage) {
		PSINC.googleLatLonSearch.editMarkerImage = function (adFlg, hotel_genre) {
			
//			if (adFlg == "0") {	//広告設定なし
			
				//ラグジュアリー
				if(hotel_genre == 1){
					return "/images/map/mi_luxury.png"; // パープル
				//ホテル・コンドミニアム
				}else if(hotel_genre == 2){
					return "/images/map/mi_hotel.png"; // ブルー
				//温泉旅館
				}else if(hotel_genre == 4){
					return "/images/map/mi_hspring.png"; // グリーン
				//カプセルホテル
				}else if(hotel_genre == 3){
					return "/images/map/mi_capsule.png"; // ライトブルー
				//民宿・ペンション・ロッジ・貸別荘
				}else if(hotel_genre == 5){
					return "/images/map/mi_mlp.png"; // オレンジ
				//その他
				}else if(hotel_genre == 6){
					return "/images/map/mi_other.png"; // グレー
				//未設定orどこにも当てはまらない
				}else{
					return "/images/map/mi_other.png"; // グレー
				}
/*
			} else {	//広告設定あり
			
				//ラグジュアリー
				if(hotel_genre == 1){
					return "/images/map/mi_luxury-ani.gif"; // パープル
				//ホテル・コンドミニアム
				}else if(hotel_genre == 2){
					return "/images/map/mi_hotel-ani.gif"; // ブルー
				//温泉旅館
				}else if(hotel_genre == 4){
					return "/images/map/mi_hspring-ani.gif"; // グリーン
				//カプセルホテル
				}else if(hotel_genre == 3){
					return "/images/map/mi_capsule-ani.gif"; // ライトブルー
				//民宿・ペンション・ロッジ・貸別荘
				}else if(hotel_genre == 5){
					return "/images/map/mi_mlp-ani.gif"; // オレンジ
				//その他
				}else if(hotel_genre == 6){
					return "/images/map/mi_other-ani.gif"; // グレー
				//未設定orどこにも当てはまらない
				}else{
					return "/images/map/mi_other-ani.gif"; // グレー
				}
			}
*/
		}
	}


	//マーカーの作成
	if(!PSINC.googleLatLonSearch.createMarker) {
		//PSINC.googleLatLonSearch.createMarker = function (hotelName,htlCd,lat,lng,pictureUrl,selectedHtlCD) {
//		PSINC.googleLatLonSearch.createMarker = function (hotelName,htlCd,lat,lng,pictureUrl,selectedHtlCD,adFlg,hotel_genre) {
		PSINC.googleLatLonSearch.createMarker = function (hotelName,htlCd,lat,lng,pictureUrl,selectedHtlCD,adFlg,cm,hotel_genre) {
			//マーカのデザイン設定
			var icon = new GIcon();
			
			//hotel_genreのマーカー分け
			//ラグジュアリー
			if(hotel_genre == 1){
				icon.image = "/images/map/mi_luxury.png"; // パープル
			//ホテル・コンドミニアム
			}else if(hotel_genre == 2){
				icon.image = "/images/map/mi_hotel.png"; // ブルー
			//温泉旅館
			}else if(hotel_genre == 4){
				icon.image = "/images/map/mi_hspring.png"; // グリーン
			//カプセルホテル
			}else if(hotel_genre == 3){
				icon.image = "/images/map/mi_capsule.png"; // ライトブルー
			//民宿・ペンション・ロッジ・貸別荘
			}else if(hotel_genre == 5){
				icon.image = "/images/map/mi_mlp.png"; // オレンジ
			//その他
			}else if(hotel_genre == 6){
				icon.image = "/images/map/mi_other.png"; // グレー
			}
			
			icon.shadow = "/images/map/shadow.png";
			
			icon.iconSize = new GSize(22, 35);
			icon.shadowSize = new GSize(45, 35);
			icon.iconAnchor = new GPoint(6, 20);
			icon.infoWindowAnchor = new GPoint(10, 1);
			var point = new GLatLng(lat, lng);
			var marker = new GMarker(point,icon);
			
			//吹き出し内表示
			var html = "";
			if(pictureUrl == ""){
				pictureUrl = "http://finalchecker.jp/images/no_img200x150.jpg";
			}

			var cm_arr = "";
			if (cm != ""){
				cm_arr = new Array(cm.seq,cm.pr_catchcopy,cm.pr_bestrate,cm.pr_privilege,cm.pr_freeword,cm.pr_freeword_text,cm.pr_plan,cm.pr_plan_price);
			}

			html = html + "<a href='/detail_plan/"+htlCd+"/' target='_blank'><img src='"+pictureUrl+"' width='90' border='0' style='float:left;' ></a><br />";
			html = html + "<div class='googleMapHotelInfo' style='margin-left: 100px;'>";
			html = html + "<b>" + hotelName + "</b> " + "<br />";
			html = html + '<a href="#" onclick="PSINC.googleLatLonSearch.clickGetLowPrice(' + htlCd + ',\'' + hotelName + '\',\'' + cm_arr + '\'); return false;" ><img src="images/bt_pricedown_gss.gif" width="117" height="19" border="0" alt="最安値を検索" class="rollover mbt10" /></a><br />';
			html = html + "<div class='radius'><a href='/detail_plan/"+htlCd+"/' target='_blank'>プラン・施設詳細を見る</a></div>";
			html = html + "<div class='radius'><a href='/detail_rep/"+htlCd+"/' target='_blank'>クチコミ・評価点数を見る</a></div>";
			html = html + "<a href='"+requestUrlHttps+"reputation/reputation_index.php?seq="+htlCd+"&sel=domestic' target='_blank'><img src='images/bt_pi-contributed_ss.gif' width='130' height='23' border='0' alt='クチコミを投稿' class='rollover' /></a><br />";
			html = html + "</div>";
			
			html = html + "<div id='GoogleSearch' class='clear mtp10'>";
			//広告(プランA)
			if(adFlg == "0"){//広告設定なし
				//今のところ何も表示しない
			} else {		//広告設定あり
			
				if (cm.pr_freeword == 'true' || cm.pr_bestrate == 'true' || cm.pr_privilege == 'true') {
					
					html = html + "<div class='BP_gs'>";
					if (cm.pr_freeword == 'true') {
						html = html + "<p class='mbt10'><a href='" + "/r/" + cm.seq + "-4/" + "' target='_blank'>" + cm.pr_freeword_text + "</a></p>";
					}
					if (cm.pr_bestrate == 'true') {
						html = html + "<p class='txt-a_center'><a href='" + "/r/" + cm.seq + "-2/" + "' target='_blank'><img src='" + requestUrl + "images/bt_bestrate_gss.gif' alt='ベストレート保障' width='117' height='19' class='rollover' /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
					}
					if (cm.pr_privilege == 'true') {
						html = html + "<a href='" + "/r/" + cm.seq + "-3/" + "' target='_blank'><img src='" + requestUrl + "images/bt_privilege_gss.gif' alt='特典あり' width='117' height='19' class='rollover' /></a></p>";
					}
					html = html + "</div>";
				}	
			}
			html = html + "</div>"
			
			var userAgent = d.getElementById("mapSearchArea").elements['userAgent'].value;
			if (userAgent != 'iPhone') {
			
				//マーカーオンマウス時の動作
				GEvent.addListener(marker, 'mouseover', function() {
					marker.openInfoWindowHtml(html);
				});
		
			} else {	//iPhoneの場合はクリックでバルーンを表示する
			
				//マーカーオンマウス時の動作
				GEvent.addListener(marker, 'click', function() {
					marker.openInfoWindowHtml(html);
				});
			}

			
			if(htlCd == selectedHtlCD){
				marker.openInfoWindowHtml(html);
			}
			
			return marker;
		}
	}
	
	//マーカー内最安値検索クリック時動作
	if(!PSINC.googleLatLonSearch.clickGetLowPrice) {
		PSINC.googleLatLonSearch.clickGetLowPrice = function (htlCd, hotelName, cm) {
	
			d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value = htlCd;
			d.getElementById('mapSearchArea').elements['now_select_htl_name'].value = hotelName;
			d.getElementById('mapSearchArea').elements['now_select_htl_cm'].value = cm;
			d.getElementById('mapSearchArea').elements['min_price'].value = 99999999999999;

			//口コミ情報を1件取得する
			var http = PSINC.util.createXMLHttpRequest("");
			http.onreadystatechange = function() {
				if (http.readyState == 4 && http.status == 200) {
					//取得した口コミデータを配列に入れる
					var kuchikomiData = eval("(" + http.responseText + ")");
					
					//口コミデータが取得できている場合のみ実施
					if(kuchikomiData.result != undefined){
					
						//取得したデータに問題がない場合のみ実施
						if(kuchikomiData.result == 'success'){
						
							//ホテル名表示
							var hotel_info = kuchikomiData.hotel_info;
							var htl_link = '<a href="'+requestUrl+'detail_plan/'+hotel_info.htl_cd+'/" target="_blank"><span class="tit">' + decodeURIComponent(hotel_info.hotel_name) + '</span><span class="txt">'+'〒:' + decodeURIComponent(hotel_info.post_code) + '<br />住所:' + decodeURIComponent(hotel_info.hotel_address)+'</span></a>';
							PSINC.util.htmlInsert('lowPriceHotelName',htl_link);

							//広告(プランA)表示
							if (cm != '') {
							
								var cm_info = cm.split(",");
								//広告(プランA)表示
								var hotel_cm = '<div class="BestPrivilege_r">';
								hotel_cm = hotel_cm + '<div class="bpbody">';
								hotel_cm = hotel_cm + cm_info[1];
								hotel_cm = hotel_cm + '<div class="bt_img mbt10 mtp10">';
								if (cm_info[2] == 'true') {
									hotel_cm = hotel_cm + '<a href="'+'/r/'+cm_info[0]+'-2/'+'" target="_blank"><img src="'+requestUrl+'images/bt_bestrate_s.gif" alt="ベストレート保障" width="175" height="24" class="rollover" /></a><br />';
								}
								if (cm_info[3] == 'true') {
									hotel_cm = hotel_cm + '<a href="'+'/r/'+cm_info[0]+'-3/'+'" target="_blank"><img src="'+requestUrl+'images/bt_privilege_s.gif" alt="特典あり" width="175" height="24" class="rollover" /></a>';
								}
								hotel_cm = hotel_cm + '</div>';
								if (cm_info[4] == 'true') {
									hotel_cm = hotel_cm + '<p class="mbt10"><a href="'+'/r/'+cm_info[0]+'-4/'+'" target="_blank">'+cm_info[5]+'</a></p>';
								
								}
								hotel_cm = hotel_cm + '<div class="bd_line mbt5 font-bold"><a href="'+'/r/'+cm_info[0]+'-5/'+'" target="_blank">'+cm_info[6]+'</a></div>';
								hotel_cm = hotel_cm + '<div class="f14 Emphasis">'+PSINC.googleLatLonSearch.number_format(cm_info[7])+'円～</div>';
								hotel_cm = hotel_cm + '</div>';
								hotel_cm = hotel_cm + '</div>';
								
								PSINC.util.htmlInsert('contractHotelName',hotel_cm);	//広告(プランA)表示

							}

							//口コミ情報表示
							var kuchikomiList = kuchikomiData.lists;	//口コミの内容を取得
							if(kuchikomiList.site_id != undefined){
								var kuchikomi_html = '';
								//表示内容の編集
								if(kuchikomiList.site_id == 'jalan' 
								 || kuchikomiList.site_id == 'ikyu' 
								 || kuchikomiList.site_id == 'jtb' 
								 || kuchikomiList.site_id == 'rurubu' 
								 || kuchikomiList.site_id == 'rakuten' 
								 || kuchikomiList.site_id == 'knt' 
								 || kuchikomiList.site_id == 'hankyu'
								 ){
									kuchikomi_html = kuchikomi_html + '<a href="'+requestUrl+'/pagechange.php?site_id=' + kuchikomiList.site_id + '" target="_blank">';
									kuchikomi_html = kuchikomi_html + '<img src="'+requestUrl + '/images/logo/' + kuchikomiList.site_id + '.gif"></a><br />';
								}else{
									kuchikomi_html = kuchikomi_html + PSINC.realtime_crwl.getSiteName(kuchikomiList.site_id) + '<br />';
								}
								
								kuchikomi_html = kuchikomi_html + '<a href="'+requestUrl+'detail_rep/'+hotel_info.htl_cd+'/" target="_blank">';
								kuchikomi_html = kuchikomi_html + decodeURIComponent(kuchikomiList.comment) + '<strong>&gt;&gt;口コミ一覧を表示</strong>';
								kuchikomi_html = kuchikomi_html + '</a>';
							
								//画面表示
								PSINC.util.htmlInsert('lowPriceKuchikomi',kuchikomi_html);
							}else{
								PSINC.util.htmlInsert('lowPriceKuchikomi','口コミがありません');
							}
						}
					}else{
					}
				}
			}
			http.open("GET",  ""+requestUrl+"ajax/get_kuchikomi_data.php?htl_cd="+htlCd  , true);
			http.send(null);

			//最安値を検索する
			if(d.getElementById('mapSearchArea').elements['loginResult'].value == "1"){	//以前、ログインしている場合に限られていた頃の名残

				//表示領域の初期化
				PSINC.googleLatLonSearch.onClinkFirstSet();
				
				//最安値の表示と15媒体分のプラン検索結果表示
				PSINC.realtime_crwl.crwlRequest(
												'mapSearchArea',
												'../ajax/realtime.php',
//												'ikyu,jalan,rakuten,yahoo,hankyu,travelco,bestrsv,yukoyuko,ozmall,yadoplaza,gurunavi,tocoo,jtb,tavita,knt',
//												'ikyu,jalan,rakuten,yahoo,hankyu,travelco,bestrsv,yukoyuko,ozmall,yadoplaza,gurunavi,tocoo,jtb,tavita',
//												'ikyu,jalan,rakuten,yahoo,hankyu,travelco,bestrsv,yukoyuko,ozmall,gurunavi,tocoo,jtb,rurubu',
//												'ikyu,jalan,rakuten,yahoo,travelco,bestrsv,yukoyuko,ozmall,gurunavi,tocoo,jtb,rurubu',
												'ikyu,jalan,rakuten,yahoo,travelco,bestrsv,yukoyuko,ozmall,gurunavi,tocoo,jtb,rurubu',
												htlCd,
												d.getElementById('mapSearchArea').elements['person'].value,
												d.getElementById('mapSearchArea').elements['stay_date_from'].value,
												d.getElementById('mapSearchArea').elements['meal'].value,
												d.getElementById('mapSearchArea').elements['price_down'].value,
												d.getElementById('mapSearchArea').elements['price_up'].value,
												d.getElementById('mapSearchArea').elements['plan_type'].value,
											'',
											''
												); 
			}
/*			
			//検索対象ホテルoverture広告の表示
			var http2 = PSINC.util.createXMLHttpRequest("");
			http2.onreadystatechange = function() {
			
				if (http2.readyState == 4 && http2.status == 200) {
					var apcmData = eval("(" + http2.responseText + ")");
					if(apcmData.result != undefined){
						if(apcmData.result == 'success'){
							
							var apcmList = apcmData.apcm;
							var htl_apcm = '';
							if (apcmList[0].ClickUrl != '') {
								htl_apcm += '<div class="pr_sp_r mbt15"><p class="pr_tit">[PR] スポンサーリンク</p>'
								
								//1セット
								htl_apcm += '<div class="pr_sp_box">'
								htl_apcm += '<a href="' + apcmList[0].ClickUrl + '" target="_blank">';
								htl_apcm += '<span class="tit">' + apcmList[0].title + '</span>';
								htl_apcm += '<span class="txt">' + apcmList[0].description + '</span>';
								htl_apcm += '<span class="link">' + apcmList[0].siteHost + '</span></a>';
								htl_apcm += '</div>';
								
								htl_apcm += '</div>';
							}
							PSINC.util.htmlInsert('contractHotelApcm',htl_apcm);
						}
					}
				}
			}
			http2.open("GET",  ""+requestUrl+"ajax/get_hotels_apcm.php?keyword="+hotelName  , true);
			http2.send(null);
*/
		}
	}
	
	//マーカーの作成
	if(!PSINC.googleLatLonSearch.createSimpleMarker) {
		PSINC.googleLatLonSearch.createSimpleMarker = function (hotelName,htlCd,lat,lng,post_code,addr,hotel_genre) {
			//マーカのデザイン設定
			var icon = new GIcon();
			
			//hotel_genreのマーカー分け
			//ラグジュアリー
			if(hotel_genre == 1){
				icon.image = "/images/map/mi_luxury.png"; // パープル
			//ホテル・コンドミニアム
			}else if(hotel_genre == 2){
				icon.image = "/images/map/mi_hotel.png"; // ブルー
			//温泉旅館
			}else if(hotel_genre == 4){
				icon.image = "/images/map/mi_hspring.png"; // グリーン
			//カプセルホテル
			}else if(hotel_genre == 3){
				icon.image = "/images/map/mi_capsule.png"; // ライトブルー
			//民宿・ペンション・ロッジ・貸別荘
			}else if(hotel_genre == 5){
				icon.image = "/images/map/mi_mlp.png"; // オレンジ
			//その他
			}else if(hotel_genre == 6){
				icon.image = "/images/map/mi_other.png"; // グレー
			}
			
			icon.shadow = "/images/map/shadow.png";
			
			icon.iconSize = new GSize(22, 35);
			icon.shadowSize = new GSize(45, 35);
			icon.iconAnchor = new GPoint(6, 20);
			icon.infoWindowAnchor = new GPoint(10, 1);
			var point = new GLatLng(lat, lng)
			var marker = new GMarker(point,icon);
			var html = "<b>" + hotelName + "</b> " + "<br />";
			html += "〒" + post_code + "<br />";
			html += "" + addr + "<br />";
			GEvent.addListener(marker, 'click', function() {
				marker.openInfoWindowHtml(html);
			});
			marker.openInfoWindowHtml(html);
			return marker;
		}
	}
	
	if(!PSINC.googleLatLonSearch.onClinkFirstSet) {
		PSINC.googleLatLonSearch.onClinkFirstSet = function () {
		
			PSINC.util.htmlInsert('lowPriceHotelName','');	//最安値検索ホテル名クリア
			PSINC.util.htmlInsert('contractHotelName','');	//広告表示クリア
			
//			PSINC.util.htmlInsert('lowPriceAddr','');
			PSINC.util.htmlInsert('lowPriceKuchikomi','');	//クチコミ表示クリア
			PSINC.util.onVisible('nowSearching');			//検索中ロゴ表示

			PSINC.util.onVisible('rs_results');	//最安値・口コミ欄表示
			PSINC.util.onVisible('pr_search-results');	//15媒体検索結果表示
		}
	}
	
	//マーカーの再設定
	if(!PSINC.googleLatLonSearch.markerReset) {
		PSINC.googleLatLonSearch.markerReset = function () {

//			map.clearOverlays();
			//alert("マーカーの再設定");
			PSINC.util.htmlInsert('mapErrMessage','');
			var viewArea = PSINC.googleLatLonSearch.getLatLon();

			var genre = PSINC.googleLatLonSearch.getHotelGenre();

			//リクエストを再送
			var http = PSINC.util.createXMLHttpRequest("");
			http.onreadystatechange = function() {
				if (http.readyState == 4 && http.status == 200) {
					var htmlData = eval("(" + http.responseText + ")");					
					if(htmlData.result != undefined){
						if(htmlData.result == 'success'){
						
							PSINC.util.htmlInsert('mapErrMessage',decodeURIComponent(htmlData.mapErrMessage));
							var makerList = htmlData.maker;
							if (makerList == undefined || makerList.length == 0) {
								//一覧部分をクリア
								PSINC.util.htmlInsert('divHotelList', '<ul></ul>');
							} else {
								//一覧部分をクリア
								PSINC.util.htmlInsert('divHotelList', '');
								
								var list_html = "<ul>";
								for(var i=0 , l=makerList.length; i<l; i++){

//									var marker = PSINC.googleLatLonSearch.createMarker(decodeURIComponent(makerList[i].hotel_name),decodeURIComponent(makerList[i].htl_cd),decodeURIComponent(makerList[i].latitude),decodeURIComponent(makerList[i].longitude),decodeURIComponent(makerList[i].picture_url),'',decodeURIComponent(makerList[i].ad_flg),decodeURIComponent(makerList[i].hotel_genre));
//									//var marker = PSINC.googleLatLonSearch.createMarker(decodeURIComponent(makerList[i].hotel_name),decodeURIComponent(makerList[i].htl_cd),decodeURIComponent(makerList[i].latitude),decodeURIComponent(makerList[i].longitude),decodeURIComponent(makerList[i].picture_url),'');
//									map.addOverlay(marker);

									//マーカーの再生成
									markerList[makerList[i].htl_cd] = PSINC.googleLatLonSearch.createMarker(
																											decodeURIComponent(makerList[i].hotel_name),	//ホテル名
																											decodeURIComponent(makerList[i].htl_cd),		//ホテルコード
																											decodeURIComponent(makerList[i].latitude),		//緯度
																											decodeURIComponent(makerList[i].longitude),		//経度
																											decodeURIComponent(makerList[i].picture_url),	//画像URL
																											'',												//選択済みホテルコード(設定があれば画面表示時にバルーンが表示)
																											decodeURIComponent(makerList[i].ad_flg),		//広告フラグ
																											makerList[i].cm,								//広告内容
																											decodeURIComponent(makerList[i].hotel_genre)	//ホテルジャンル
																											);
									map.addOverlay(markerList[makerList[i].htl_cd]);

									var icon_image = requestUrl + PSINC.googleLatLonSearch.editMarkerImage('0', makerList[i].hotel_genre).substring(1);
									//マーカーを出したホテルをホテルリストに追加
									list_html += '<li><img height="20" width="12" align="absmiddle" src="' + icon_image + '" alt=""><a href="#" onclick="PSINC.googleLatLonSearch.clickHotelName(\'' + makerList[i].htl_cd + '\'); return false;" >' + makerList[i].hotel_name + '</a></li>';

								}
								list_html += '</ul>';

								//ホテルリスト再表示
								PSINC.util.htmlInsert('divHotelList', list_html);

								//エリア広告の表示
								PSINC.googleLatLonSearch.getContractAreaList();

							}							
							
						}
					}else{
					}
				}
			}
			http.open("GET",  ""+requestUrl+"ajax/get_hotels_latlon.php?latlon="+encodeURIComponent(viewArea)+"&hotel_genre="+encodeURIComponent(genre)  , true);
			http.send(null);
			
		}
	}
	
	//エリア広告の設定
	if(!PSINC.googleLatLonSearch.getContractAreaList) {
		PSINC.googleLatLonSearch.getContractAreaList = function () {

			var viewArea = PSINC.googleLatLonSearch.getLatLon();	//地図の表示範囲を取得
			PSINC.util.htmlInsert('areaContractText','');
			PSINC.util.htmlInsert('areaContractItem','');

			//リクエストを再送
			var http = PSINC.util.createXMLHttpRequest("");
			http.onreadystatechange = function() {
				if (http.readyState == 4 && http.status == 200) {
					var htmlData = eval("(" + http.responseText + ")");					
					if(htmlData.result != undefined){
						if(htmlData.result == 'success'){

							//テキスト広告
							var areaText = htmlData.text;
							if (areaText == undefined || areaText.length == 0) {
								PSINC.util.htmlInsert('areaContractText','');	//広告表示なし
							
							} else {
								var htmlCmText = '';
								htmlCmText = htmlCmText + '<div class="mbt15">';
								for(var i=0, l=areaText.length; i<l; i++){
									htmlCmText = htmlCmText + '<a href="'+requestUrl+'r/'+areaText[i].seq+'-1/'+'" target="_blank">[PR]'+areaText[i].pr_keyword+'（公式サイト）</a>　　　';
								}
								htmlCmText = htmlCmText + '</div>';
							
								PSINC.util.htmlInsert('areaContractText',htmlCmText);
							}
							
							//詳細広告
							var areaItem = htmlData.item;
							if (areaItem == undefined || areaItem.length == 0) {
								PSINC.util.htmlInsert('areaContractItem','');	//広告表示なし
							
							} else {
								var htmlCmItem = '';
								htmlCmItem = htmlCmItem + '<div class="BestPrivilege">';
								htmlCmItem = htmlCmItem + '<h4><a href="'+requestUrl+'r/'+areaItem.seq+'-1/'+'" target="_blank">'+areaItem.pr_keyword+'（公式サイト）</a></h4>';
								htmlCmItem = htmlCmItem + '<div class="bpbody mbt15">';
								htmlCmItem = htmlCmItem + '<div class="bt_img">';
								if (areaItem.pr_bestrate == 'true') {
									htmlCmItem = htmlCmItem + '<a href="'+requestUrl+'r/'+areaItem.seq+'-2/'+'" target="_blank"><img src="'+requestUrl+'images/bt_bestrate_s.gif" alt="ベストレート保障" width="175" height="24" class="rollover" /></a><br />';
								}
								if (areaItem.pr_privilege == 'true') {
									htmlCmItem = htmlCmItem + '<a href="'+requestUrl+'r/'+areaItem.seq+'-3/'+'" target="_blank"><img src="'+requestUrl+'images/bt_privilege_s.gif" alt="特典あり" width="175" height="24" class="rollover" /></a>';
								}
								htmlCmItem = htmlCmItem + '</div>';
								htmlCmItem = htmlCmItem + areaItem.pr_catchcopy;
								if (areaItem.pr_freeword == 'true') {
									htmlCmItem = htmlCmItem + '<p class="mtp5"><a href="'+requestUrl+'r/'+areaItem.seq+'-4/'+'" target="_blank">'+areaItem.pr_freeword_text+'</a></p>';
								}
								htmlCmItem = htmlCmItem + '<div class="clear_b"></div>';
								htmlCmItem = htmlCmItem + '</div>';
								htmlCmItem = htmlCmItem + '<div class="bpbody bd_line">';
								htmlCmItem = htmlCmItem + '<div class="tit_img"><img src="'+requestUrl+'images/icon_recoplan.gif" alt="おすすめプラン" width="65" height="36" /></div>';
								htmlCmItem = htmlCmItem + '<div class="txt"><a href="'+requestUrl+'r/'+areaItem.seq+'-5/'+'" target="_blank">'+areaItem.pr_plan+'</a></div>';
								htmlCmItem = htmlCmItem + '<div class="price Emphasis">'+PSINC.googleLatLonSearch.number_format(areaItem.pr_plan_price)+'円～</div>';
								htmlCmItem = htmlCmItem + '<div class="clear_b"></div>';
								htmlCmItem = htmlCmItem + '</div>';
								htmlCmItem = htmlCmItem + '</div>';
								PSINC.util.htmlInsert('areaContractItem',htmlCmItem);
							}
						}
					}else{
					}
				}
			}
			http.open("GET",  ""+requestUrl+"ajax/get_keiyaku_area_latlon.php?latlon="+encodeURIComponent(viewArea)  , true);
			http.send(null);
		}
	}
	
	//広告の設定
	if(!PSINC.googleLatLonSearch.setCms) {
		PSINC.googleLatLonSearch.setCms = function (jsonCd) {
			var num = jsonCd.length;
			if(num == 0){
				var html = '';
				html = html + '<div class="ad_collection"><a href="'+requestUrlHttps+'advertising/" target="_blank"><span class="txt_black">宿泊施設様専用広告スペース<br />';
				html = html + 'このページに広告を出しませんか？お申込み・お問い合わせは下記からお願いします。</span><br />';
				html = html + '<span class="link">お問い合わせフォームへ</span></a></div>';
				PSINC.util.htmlInsert('prFrameType1',html);
				
				var html2 = '';
				html2 = html2 + '<div class="ad_collection_r">';
				html2 = html2 + '<a href="'+requestUrlHttps+'advertising/" target="_blank">';
				html2 = html2 + '<span class="txt_black mbt10">宿泊施設様専用広告スペース</span>';
				html2 = html2 + '<span class="txt_black mbt5">このページに広告を出しませんか？</span>';
				html2 = html2 + '<span class="txt_black">お申込み・お問い合わせは下記からお願いします。</span>';
				html2 = html2 + '<span class="link">お問い合わせフォームへ</span>';
				html2 = html2 + '</a></div>';
				PSINC.util.htmlInsert('right_cm_area',html2);
				
				return false;
			}
			
			//3個ずつ存在確認
			var j,k,res_1,res_2,res_3;
			
			var html = '<div class="pr_plan"><span class="pr_tit">おすすめプラン [PR]</span>';
			for(var i=0 , l=jsonCd.length; i<l; i+=3){
				j = i+1;
				k = i+2;
				res_1 = false;
				if(jsonCd[i] != undefined){
					res_1 = true;
				}
				res_2 = false;
				if(jsonCd[j] != undefined){
					res_2 = true;
				}
				res_3 = false;
				if(jsonCd[k] != undefined){
					res_3 = true;
				}
				if(res_1 == true && res_2 == true && res_3 == true ){  //3列
					html = html + '<div class="pr_plan_ad03"><div class="ad03_l">';
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[i].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[i].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line">'+decodeURIComponent(jsonCd[i].pr_type_1_caption)+'</span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[i].pr_type_1_price))+'円～<br />';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[i].pr_type_1_price_info)+'</span></span>';
					html = html + '</a></div>';
					html = html + '';
					html = html + '<div class="ad03_l">';
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[j].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[j].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line">'+decodeURIComponent(jsonCd[j].pr_type_1_caption)+'</span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[j].pr_type_1_price))+'円～<br />';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[j].pr_type_1_price_info)+'</span></span>';
					html = html + '</a></div>';
					html = html + '';
					html = html + '<div class="ad03_r">';
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[k].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[k].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line">'+decodeURIComponent(jsonCd[k].pr_type_1_caption)+'</span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[k].pr_type_1_price))+'円～<br />';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[k].pr_type_1_price_info)+'</span></span>';
					html = html + '</a></div>';
					html = html + '';
					html = html + '<div class="clear_b"></div>';
					html = html + '</div>';
				}else if(res_1 == true && res_2 == true && res_3 == false ){ //2列
					html = html + '<div class="pr_plan_ad02">';
					html = html + '<div class="ad02_l">';
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[i].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[i].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line"></span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[i].pr_type_1_price))+'円～<br />';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[i].pr_type_1_price_info)+'</span></span>';
					html = html + '</a></div>';
					html = html + '';
					html = html + '<div class="ad02_r">';
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[j].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[j].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line">'+decodeURIComponent(jsonCd[j].pr_type_1_caption)+'</span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[j].pr_type_1_price))+'円～<br />';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[j].pr_type_1_price_info)+'</span></span>';
					html = html + '</a></div>';
					html = html + '<div class="clear_b"></div></div>';
					html = html + '';
				}else if(res_1 == true && res_2 == false && res_3 == false){ //1列
					html = html + '<a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[i].seq)+'-1/" target="_blank">';
					html = html + '<strong class="mtp7">'+decodeURIComponent(jsonCd[i].pr_type_1_text)+'</strong>';
					html = html + '<span class="under_line">'+decodeURIComponent(jsonCd[i].pr_type_1_caption)+'</span>';
					html = html + '<span class="Emphasis">'+PSINC.googleLatLonSearch.number_format(decodeURIComponent(jsonCd[i].pr_type_1_price))+'円～';
					html = html + '<span class="s-txt">'+decodeURIComponent(jsonCd[i].pr_type_1_price_info)+'</span></span>';
					html = html + '</a>';
					html = html + '';
				}
			}
			html = html + '</div>';
			PSINC.util.htmlInsert('prFrameType1',html);
			
			var html2 = '';
			html2 = html2 + '<div id="prFrameType2">';
			html2 = html2 + '<div class="pr_plan_ryellow"><a href="'+requestUrl+'r/'+decodeURIComponent(jsonCd[0].seq)+'-2/" target="_blank"><span class="pr_tit">おすすめプラン [PR]</span>';
			html2 = html2 + '<strong>'+decodeURIComponent(jsonCd[0].pr_type_2_text)+'</strong>';
			html2 = html2 + '<span class="under_line">'+decodeURIComponent(jsonCd[0].pr_type_2_caption)+'</span>';
			html2 = html2 + '<span class="Emphasis">'+decodeURIComponent(jsonCd[0].pr_type_2_price)+'円～';
			html2 = html2 + '<span class="s-txt">'+decodeURIComponent(jsonCd[0].pr_type_2_price_info)+'</span>';
			html2 = html2 + '</span></a></div>';
			html2 = html2 + '</div>';
			PSINC.util.htmlInsert('right_cm_area',html2);
			return false;
		}
	}
	
	
	if(!PSINC.googleLatLonSearch.number_format) {
		PSINC.googleLatLonSearch.number_format = function (num) {
			return num.toString().replace( /([0-9]+?)(?=(?:[0-9]{3})+$)/g , '$1,' );
		}
	}
	
	//地図内最安値検索
	if(!PSINC.googleLatLonSearch.openMinPricePage) {
		PSINC.googleLatLonSearch.openMinPricePage = function () {
			var viewArea = PSINC.googleLatLonSearch.getLatLon();
			var person = d.getElementById('mapSearchArea').elements['person'].value;
			var stay_date_from = d.getElementById('mapSearchArea').elements['stay_date_from'].value;
			var meal = d.getElementById('mapSearchArea').elements['meal'].value;
			var price_down = d.getElementById('mapSearchArea').elements['price_down'].value;
			var price_up = d.getElementById('mapSearchArea').elements['price_up'].value;
			var plan_type = d.getElementById('mapSearchArea').elements['plan_type'].value;
			
			var param = "";
			param = param + "latlon="+encodeURIComponent(viewArea);
			param = param + "&person="+encodeURIComponent(person);
			param = param + "&stay_date_from="+encodeURIComponent(stay_date_from);
			param = param + "&meal="+encodeURIComponent(meal);
			param = param + "&price_down="+encodeURIComponent(price_down);
			param = param + "&price_up="+encodeURIComponent(price_up);
			param = param + "&plan_type="+encodeURIComponent(plan_type);
			PSINC.util.OpenNewWindow("search_low_price.php?"+param,"low_price_window",'width=800,  menubar=no, toolbar=no, scrollbars=yes');
		}
	}
	
		//前日リンク押下
	if(!PSINC.googleLatLonSearch.getPrevDatePrice) {
		PSINC.googleLatLonSearch.getPrevDatePrice = function () {

			//ホテルコードを取得
			var htl_cd = d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value;

			//ホテル名を取得
			var htl_name = d.getElementById('mapSearchArea').elements['now_select_htl_name'].value;

			//ホテル名を取得
			var htl_cm = d.getElementById('mapSearchArea').elements['now_select_htl_cm'].value;

			//検索対象日を取得
			var param_year = d.getElementById('mapSearchArea').elements['year'].value;
			var param_month = d.getElementById('mapSearchArea').elements['month'].value;
			var param_day = d.getElementById('mapSearchArea').elements['day'].value;

			//検索対象日の前日日付を求める
			var param_date = new Date(param_year, param_month-1, param_day);
			param_date.setDate(param_date.getDate()-1); 
			var prev_year = param_date.getFullYear();
			var prev_month = param_date.getMonth() + 1;
			if (prev_month < 10) {prev_month = "0" + prev_month;};
			var prev_day = param_date.getDate();
			if (prev_day < 10) {prev_day = "0" + prev_day;};

			//検索日付を更新する
			d.getElementById('mapSearchArea').elements['year'].value = prev_year;
			d.getElementById('mapSearchArea').elements['month'].value = prev_month;
			d.getElementById('mapSearchArea').elements['day'].value = prev_day;
			d.getElementById('mapSearchArea').elements['stay_date_from'].value = prev_year + "-" + prev_month + "-" + prev_day;

//セレクトボックスがなくなったので廃止
//			//セレクトボックスの設定
//			PSINC.util.selectBoxSelected('search','year',prev_year);
//			PSINC.util.selectBoxSelected('search','month',prev_month);
//			PSINC.util.selectBoxSelected('search','day',prev_day);

			//検索結果欄の日付を更新する
			PSINC.util.htmlInsert('low_search_date','宿泊日：' + prev_month + '月' + prev_day + '日');
			PSINC.util.htmlInsert('res_search_date','宿泊日：' + prev_month + '月' + prev_day + '日');
			
			//最安値検索処理
			PSINC.googleLatLonSearch.clickGetLowPrice(htl_cd, htl_name,htl_cm); 
			return false;
		}
	}
	
	//翌日リンク押下
	if(!PSINC.googleLatLonSearch.getNextDatePrice) {
		PSINC.googleLatLonSearch.getNextDatePrice = function () {

			//ホテルコードを取得
			var htl_cd = d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value;

			//ホテル名を取得
			var htl_name = d.getElementById('mapSearchArea').elements['now_select_htl_name'].value;

			//ホテル名を取得
			var htl_cm = d.getElementById('mapSearchArea').elements['now_select_htl_cm'].value;

			//検索対象日を取得
			var param_year = d.getElementById('mapSearchArea').elements['year'].value;
			var param_month = d.getElementById('mapSearchArea').elements['month'].value;
			var param_day = d.getElementById('mapSearchArea').elements['day'].value;

			//検索対象日の翌日日付を求める
			var param_date = new Date(param_year, param_month-1, param_day);
			param_date.setDate(param_date.getDate()+1); 
			var next_year = param_date.getFullYear();
			var next_month = param_date.getMonth() + 1;
			if (next_month < 10) {next_month = "0" + next_month;};
			var next_day = param_date.getDate();
			if (next_day < 10) {next_day = "0" + next_day;};

			//検索日付を更新する
			d.getElementById('mapSearchArea').elements['year'].value = next_year;
			d.getElementById('mapSearchArea').elements['month'].value = next_month;
			d.getElementById('mapSearchArea').elements['day'].value = next_day;
			d.getElementById('mapSearchArea').elements['stay_date_from'].value = next_year + "-" + next_month + "-" + next_day;

//セレクトボックスがなくなったので廃止
//			//セレクトボックスの設定
//			PSINC.util.selectBoxSelected('search','year',next_year);
//			PSINC.util.selectBoxSelected('search','month',next_month);
//			PSINC.util.selectBoxSelected('search','day',next_day);

			//検索結果欄の日付を更新する
			PSINC.util.htmlInsert('low_search_date','宿泊日：' + next_month + '月' + next_day + '日');
			PSINC.util.htmlInsert('res_search_date','宿泊日：' + next_month + '月' + next_day + '日');

			//最安値検索処理
			PSINC.googleLatLonSearch.clickGetLowPrice(htl_cd, htl_name,htl_cm); 
			return false;
		}
	}
	
		// 宿泊条件変更
	if(!PSINC.googleLatLonSearch.getStaySearchPrice) {
		PSINC.googleLatLonSearch.getStaySearchPrice = function () {
			
			//検索条件を取得
			var param_year = d.getElementById('mapSearchArea').elements['year'].value;
			var param_month = d.getElementById('mapSearchArea').elements['month'].value;
			var param_day = d.getElementById('mapSearchArea').elements['day'].value;
			
			var param_person = d.getElementById('resultsSearch').elements['person'].value;
			var param_meal = d.getElementById('mapSearchArea').elements['meal'].value;
			var param_plan_type = d.getElementById('resultsSearch').elements['plan_type'].value;
			var param_price_down = d.getElementById('resultsSearch').elements['price_down'].value;
			var param_price_up = d.getElementById('resultsSearch').elements['price_up'].value;
			
			
			//検索条件をhidden項目に保持する
			d.getElementById('mapSearchArea').elements['year'].value = param_year;
			d.getElementById('mapSearchArea').elements['month'].value = param_month;
			d.getElementById('mapSearchArea').elements['day'].value = param_day;
			d.getElementById('mapSearchArea').elements['stay_date_from'].value = param_year + "-" + param_month + "-" + param_day;
			d.getElementById('mapSearchArea').elements['person'].value = param_person;
			d.getElementById('mapSearchArea').elements['meal'].value = param_meal;
			d.getElementById('mapSearchArea').elements['plan_type'].value = param_plan_type;
			d.getElementById('mapSearchArea').elements['price_down'].value = param_price_down;
			d.getElementById('mapSearchArea').elements['price_up'].value = param_price_up;
			
			//セレクトボックスの設定
			PSINC.util.selectBoxSelected('resultsSearch','person',param_person);
			PSINC.util.selectBoxSelected('resultsSearch','plan_type',param_plan_type);
			PSINC.util.selectBoxSelected('resultsSearch','price_down',param_price_down);
			PSINC.util.selectBoxSelected('resultsSearch','price_up',param_price_up);
			
			//検索を実行したホテルの情報が取得できない場合はリアルタイムクロールをしない
			if(d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value == undefined
			 || d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value == ''
			){
				return false;
			}
			if(d.getElementById('mapSearchArea').elements['now_select_htl_name'].value == undefined
			 || d.getElementById('mapSearchArea').elements['now_select_htl_name'].value == ''
			){
				return false;
			}
			
			//ホテルコードを取得
			var htl_cd = d.getElementById('mapSearchArea').elements['now_select_htl_cd'].value;

			//ホテル名を取得
			var htl_name = d.getElementById('mapSearchArea').elements['now_select_htl_name'].value;

			//ホテル名を取得
			var htl_cm = d.getElementById('mapSearchArea').elements['now_select_htl_cm'].value;
			
			//最安値検索処理
			PSINC.googleLatLonSearch.clickGetLowPrice(htl_cd, htl_name,htl_cm); 
			return false;
		}
	}
	
	//マイマップ登録
	if(!PSINC.googleLatLonSearch.registMyMap) {
		PSINC.googleLatLonSearch.registMyMap = function () {
			var viewArea = PSINC.googleLatLonSearch.getLatLon();
			var zoomLevel = map.getZoom();
			var param = "";
			param = param + "latlon="+encodeURIComponent(viewArea);
			param = param + "&zoomLevel="+encodeURIComponent(zoomLevel);
			PSINC.util.OpenNewWindow("regist_mymap.php?"+param,"regist_mymap_window",'width=320,height=300,  menubar=no, toolbar=no, scrollbars=yes');
			return false;
		}
	}
	
})();



