
/* 全角半角対応表 */
var zenkaku = new Array("１","２","３","４","５","６","７","８","９","０");
var hankaku = new Array(1,2,3,4,5,6,7,8,9,0);

var map = '/map/uc/Maps?';
var adrill = '/map/uc/ADrill?';
var poicount = '/map/uc/PoiCount?';
var poiattr = '/map/uc/PoiAttr?';

// タブロックフラグ
var lockflg = false;

/*
 * 初期化
 */
function init(){

	//document.f1.reset();
//	document.f2.reset();
//	var fm = document.getElementById("search");
	
	//for( i=0; i<fm.elements.length; i++ ) {
	//	if( fm.elements[i].type == 'checkbox') {
	//		fm.elements[i].checked = true;
	//	}
	//}
};

/*
 * PoiCountのパラメータを作る
 */
function makeRequest( grpby, callback, code ) {
	var param = 'grp=' + grp + '&grpby=' + grpby + '&vo=mbml';
	if( code ) {
		if( grpby == 'city' ) {
			param += '&kencode=' + code;
			document.getElementById("kentmp").value = code;
		}
	}
	if( ph.get("br") != "01" ) param += "&disp_str40="+ph.get("br");
	// ppパラメータ追加
	param += "&pp=print_start_date,print_end_date";
	//param += createParamForService(document.getElementById('search'));
	
	// アクティブタブのフォームを検索条件にセット
	if( !ph.get("sgrp") ) {
		if( at == 1 ) {
			var p2 = createParamForService(document.getElementById('search'));
			if( !p2.match(/9999$/) ) {
				param += p2;
			} else {
				document.getElementById("cautionText").style.display="block";
				
				// 文言出力
				document.getElementById("cautionText").innerHTML="※ 該当する都道府県がありません。</br>&nbsp;&nbsp;&nbsp;上のブランドのチェックボックスにチェックを入れてください。";
		
				// タブをロック解除
				lockflg=false;
				doDisabled( document.search, false );
				return;
			}
			document.getElementById("cautionText").style.display="none";
		} else {
			cph2 = createParamForCook(document.getElementById('search2'));
			cph3 = createParamForCook(document.getElementById('search3'));

			if( cph2.getkeys() != "" ) {
				param += "&" + cph2;
				param += "&unit="+(cph2.getkeys()).toString().replace(/,/g, ":");
			} else {
				param += "&" + cph3;
				param += "&unit="+(cph3.getkeys()).toString().replace(/,/g, ":");
			}
		}
	}
	
	sendRequestForCount( poicount + param );

};

/*
 * PoiCountの再検索
 */
function research(flg){

	// フォームのdisabledにする
	doDisabled( document.search, true );
		
	document.getElementById('ken').innerHTML = '';
	document.getElementById('city').innerHTML = '';
	if( document.getElementById('station') ) document.getElementById("station").innerHTML = '';
	makeRequest( 'ken', 'getList' );
	if( !flg) {
		document.getElementById('chkAll').checked = false;
		document.getElementById('chkDisable').checked = false;
		chkflg="";
	}
};

/*
 * PoiAttrのパラメータを作る
 */
function makeRequestByAttr( grpby, callback, code ) {
	// ランドマーク検索の場合、キーワードがないと再検索
	if( !ph.get("poi_name") && ph.get("sgrp") == "lm01" ) return;
	// 駅名検索の場合、キーワードがないと再検索
	if( !ph.get("st_name") && ph.get("sgrp") == "station01" ) return;
	// 郵便番号検索の場合、キーワードがないと再検索
	if( !ph.get("zip_code") && ph.get("sgrp") == "zip01" ) return;
	// POI属性検索の場合、キーワードがないと再検索
	if( !ph.get('q') && !ph.get("sgrp")) return;
	
	pph = new mapionFuncs.text.ParamHashForUC();
	pph.put('grp', ph.get('grp'));
	if( ph.get('sgrp') ) pph.put('sgrp', ph.get('sgrp'));
	pph.put('grpby', grpby);
	pph.put('vo', 'mbml');
	if( ph.get('q') ) {
		pph.putForUC('q', decodeURI(ph.get('q')));
		pph.put("pp","print_start_date,print_end_date");
	}
	if( ph.get('poi_name') ) pph.putForUC('poi_name', ph.get('poi_name'), pph.ORACLE_TEXT);
	if( ph.get('zip_code') ) pph.putForUC('zip_code', ph.get('zip_code'), ph.FRONT);
	if( ph.get('st_name') ) pph.putForUC('st_name', ph.get('st_name'), pph.ORACLE_TEXT);
	if( ph.get('disp_str40') ) pph.putForUC("disp_str40", ph.get("disp_str40"));
	var param = pph;
	
	if( code ) {
		if( grpby == 'city' )
		param += '&kencode=' + code;
	}
	
	sendRequestForCount( poicount+param );
};

/*
 * Requestを送る
 */
function sendRequestForLand( _url ) {
	MXmlRequest.open(null,'GET',_url,	true,
								function( http_obj ){
									land(eval( http_obj.responseText ));
								}
	);
};

/*
 * TopのPoiCount取得用
 */
function sendRequestForCount( _url ) {
	MXmlRequest.open(null,'GET',_url,	true,
								function( http_obj ){
									getList(eval(http_obj.responseText));
								}
	);
};

/*
 * POI属性検索
 */
function sendRequestForPoi( _url ) {
	MXmlRequest.open(null,'GET',_url,	true,
								function( http_obj ){
									poi(eval(http_obj.responseText));
								}
	);
};


/*
 * リストを作成する
 */
function getList( obj ){
	var select = document.getElementById(obj.GrpBy);
	select.innerHTML = '';
	if( document.getElementById("station") )document.getElementById("station").innerHTML = "";
	var opt = '';
	var tmpcode = "";
	// IFAMEのcodeを取得
	try{
		if( obj.GrpBy == "ken" ) {
			tmpcode = document.getElementById("kentmp").value;
		} else if( obj.GrpBy == "city" ) {
			tmpcode = document.getElementById("citytmp").value;
		}
	} catch(e) {
		// TOPページの場合なのでエラー出て何もしない
	}

	for( var j=0; j<obj.CountList.length; j++ ) {
		var list = obj.CountList[j];
		// その他を省く
		if( list.code == "00" ) continue;
		var opt = document.createElement('option');
		var tex = document.createTextNode( list.name );
		opt.value = list.code;
		opt.id = obj.GrpBy +'code';
		if( tmpcode == list.code ) opt.selected = true;
		opt.appendChild(tex);
		select.appendChild(opt);
	}
	
	// チェックがあれば次へ
	if( ph.get("sgrp") ) return;
	if( select.selectedIndex >= 0 ){
		if( obj.GrpBy == "ken" ) {
			// 見た目変更
			document.images["prefimg"].src="/sevenandifs/images/list_bbtn_disabled.gif";
			makeRequest("city", "getList", tmpcode);
			
		} else {
			if( !ph.get("sgrp")) stationSelect( tmpcode );
		}
	} else {
		// 見た目変更
		document.images["prefimg"].src="/sevenandifs/images/list_bbtn_disabled.gif";
		// タブロックフラグ解除
		lockflg = false;
		// フォームのdisabledをやめる
		if( at == 1 ) {
			doDisabled( document.search, false );
		} else {
			doDisabled( document.search2, false );
			doDisabled( document.search3, false );
		}
	}
};

function getList2( obj ){
	var select = document.getElementById(obj.mbml.Parameter.grpby);
	select.innerHTML = '';
	var opt = '';
	var tmpcode = "";
	// IFAMEのcodeを取得
	try{
		if( obj.mbml.Parameter.grpby == "ken" ) {
			tmpcode = document.getElementById("kentmp").value;
		} else if( obj.mbml.Parameter.grpby == "city" ) {
			tmpcode = document.getElementById("citytmp").value;
		}
	} catch(e) {
		// TOPページの場合なのでエラー出て何もしない
	}
	var cnt = obj.mbml.CountList.Count;
	
	var count = cnt.length;
	
	for( var j=0; j<count; j++ ) {
		var list = cnt[j];
		var opt = document.createElement('option');
		var tex = document.createTextNode( list.count_name );
		opt.value = list.count_id;
		opt.id = obj.mbml.Parameter.grpby +'code';
		if( tmpcode == list.count_id ) opt.selected = true;
		opt.appendChild(tex);
		select.appendChild(opt);
	}
	// 1件の場合
	if( cnt.count_id ) {
		var opt = document.createElement('option');
		var tex = document.createTextNode( cnt.count_name );
		opt.value = cnt.count_id;
		opt.id = obj.mbml.Parameter.grpby +'code';
		if( tmpcode == cnt.count_id ) opt.selected = true;
		opt.appendChild(tex);
		select.appendChild(opt);
	}
};

/*
 * POI属性検索(ランドマーク、駅、郵便番号用)
 */
function getPoiAttribute() {
	// xslパラメータ変更
	// sortパラメータを付与
	sgrp = ph.get('sgrp')
	ph.remove('xsl');
	ph.remove("ie");
	ph.remove("oe");
	if( sgrp == 'lm01') {
		ph.put('xsl','landmark');
		ph.put('srt','citycode');
		// poi_nameパラメータがnullの場合に再検索
		if( !ph.get("poi_name") ) {
			land(eval("({\"Parameter\":[{\"poi_name\":\"^キーワードなし\",\"sgrp\":\"lm01\"}],\"Property\":[{\"hit\":\"0\",\"no\":\"1\"}]})"));
			return;
		}
	} else if( sgrp == 'station01' ) {
		ph.put('xsl','station');
		ph.put('srt','genre1_code');
		// st_nameパラメータがnullの場合に再検索
		if( !ph.get("st_name") ) {
			land(eval("({\"Parameter\":[{\"st_name\":\"^キーワードなし\",\"sgrp\":\"station01\"}],\"Property\":[{\"hit\":\"0\",\"no\":\"1\"}]})"));
			return;
		}
	} else if( sgrp == 'zip01' ) {
		var zipValue = ph.get('zip_code');
		// zip_codeパラメータがnullの場合に再検索
		if( !zipValue ) {
			land(eval("({\"Parameter\":[{\"zip_code\":\"キーワードなし\",\"sgrp\":\"zip01\"}],\"Property\":[{\"hit\":\"0\",\"no\":\"1\"}]})"));
			return;
		}
		ph.remove('zip_code');
		ph.putForUC('zip_code', zipValue, ph.FRONT);
		ph.put('xsl','zip');
	} else {
		ph.put('vo','mbml');
		ph.put('srt','citycode');
		ph.put("pp","print_start_date,print_end_date");
		// qパラメータがnullの場合に再検索
		if( !ph.get("q") ) {
			poi(eval("({\"Parameter\":[{\"q\":\"キーワードなし\"}],\"Property\":[{\"hit\":\"0\"}]})"));
			return;
		}
	}
	// IFRAME使わない場合
	if( !sgrp ) sendRequestForPoi( poiattr + ph );
	else sendRequestForLand( poiattr + ph );
};

/*
 * 都道府県で絞り込む
 */
function searchByKen( kencode ) {
	ph.remove('kencode');
	ph.remove('citycode');
	ph.remove('start');
	if( kencode == null || kencode == "" ) return;
	ph.put('kencode', kencode);
	
	// IFRAMEにkencodeを保持
	document.getElementById("kentmp").value = kencode;
	// IFRAMEにcitycodeを削除
	document.getElementById("citytmp").value = "";
	
	// IFRAME使わない場合
	if(!ph.get("sgrp") ) sendRequestForPoi( poiattr + ph );
	else sendRequestForLand( poiattr + ph );
};

/*
 * 市区町村で絞り込む
 */
function searchByCity( citycode ) {
	ph.remove('kencode');
	ph.remove('citycode');
	ph.remove('start');
	ph.put('citycode', citycode);
	
	// hoji
	document.getElementById("citytmp").value = citycode;

	// ここがIFRAME使わない方式
	if(!ph.get("sgrp") ) sendRequestForPoi( poiattr + ph );
	else sendRequestForLand( poiattr + ph );
};

/*
 * 検索結果リストを作成する(ランドマーク、駅、郵便番号)
 * @param obj jsonオブジェクト
 */
function land(obj) {

	var _html = "<table width=\"651\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"minTable\">";
  	_html += "<tr>";
    _html += "<td align=\"center\">";
	_html += "<table width=\"641\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"subTable\">";
	_html += "<tr><td align=\"left\">";

	// 検索キーワード
	_html += "<p><span>検索キーワード</span>";
	_html += "<span class=\"keyWD\">";
	if( obj.Parameter[0].sgrp == "lm01" ) {
		_html += (obj.Parameter[0].poi_name).substring(1);
	} else if( obj.Parameter[0].sgrp == "station01" ) {
		_html += (obj.Parameter[0].st_name).substring(1);
	} else if( obj.Parameter[0].sgrp == "zip01" ) {
		_html += (obj.Parameter[0].zip_code).replace("%","");
	}

	_html += "</span>";
	_html += "</p>";
	
	_html += "</td>";
	_html += "<td align=\"right\">";
	
	// ヒット件数
	_html += "<p style=\"padding:4px;\">";
	_html += "<span>検索ヒット数</span><span class=\"hitNum\">"+obj.Property[0].hit+"件</span>";
	_html += "</p>";
	
	_html += "</td></tr></table>";
	_html += "</td></tr>";

	// 検索結果が0件だった場合とそうでない場合
	if( obj.Property[0].hit != 0 ) { 
		_html += "<tr><td>";
		
		// リスト部分
		_html += "	<table width=\"641\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"listTable\">";
	    if( obj.Parameter[0].sgrp == "lm01" ) {
			
			_html += "<tr><th>ランドマーク</th><th>住所</th></tr>";
			_html += createLMList(obj);
			
			
		} else if( obj.Parameter[0].sgrp == "station01" ) {
		
			_html += "<tr><th>駅名</th><th>路線名</th></tr>";
			_html += createSTList(obj);
		
		} else if( obj.Parameter[0].sgrp == "zip01" ) {
		
			_html += "<tr><th>郵便番号</th><th>住所</th></tr>";
			_html += createZPList(obj);
		
		}
	
		// 20件より少ない場合、行追加する
		var si = obj.Property[0].startIndex;
		var ei = obj.Property[0].endIndex;
		var loop = 20-(ei-si+1);
		if( loop < 20 ) {
			for( var j=loop; j > 0; j-- ) {
				if( j%2 == 1 ) _html += "<tr class=\"bg2\"><td>&nbsp;</td><td>&nbsp;</td></tr>";
				else _html += "<tr class=\"bg1\"><td>&nbsp;</td><td>&nbsp;</td></tr>";
			}
		}
		_html += "</table>";
		_html += "</td></tr>";
		
		// ページ送り
		_html += "<tr><td align=\"center\">";
		_html += "<table width=\"641\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"footTable\">";
	    _html += "<tr><td width=\"110\" align=\"right\">"+beforeP(obj, ph)+"</td>";
	    _html += "<td width=\"400\" align=\"center\"><p style=\"padding:7px;\">"+createPageSendLink2(obj,ph)+"</p></td>";
	    _html += "<td width=\"110\" align=\"left\">"+nextP(obj, ph)+"</td></tr>";
	    _html += "</table>";
		_html += "</td></tr></table>";
		
		document.getElementById("starttmp").value = obj.Property[0].start?obj.Property[0].start:1;
	} else {
	
		_html += "</td></tr></table>";
		
		// 再検索窓スタート
		_html += "<div style=\"margin:8px;\">";
		_html += "<p>"+(obj.Property[0].no == 1?"キーワードを入力してください。":"入力されたキーワードにヒットしませんでした。")+"</p>";
		_html += "<div class=\"searchBodyForms_R2\">";
		_html += "<form name=\"f2\">";
		_html += "<p id=\"keyLead\">主要施設周辺、駅周辺、郵便番号エリアの店舗を探します</p>";
		_html += "<div id=\"landmarkRadio\">";
		_html += "<input type=\"radio\" name=\"sgrp\" id=\"sgrp\" value=\"lm01\"  checked=\"checked\" />&nbsp;</xsl:text><label for=\"chkLand\">主要施設名</label>&nbsp;&nbsp;";
		_html += "<input type=\"radio\" name=\"sgrp\" id=\"sgrp\" value=\"station01\" />&nbsp;<label for=\"chkSta\">駅名</label>&nbsp;&nbsp;";
		_html += "<input type=\"radio\" name=\"sgrp\" id=\"sgrp\" value=\"zip01\" />&nbsp;<label for=\"chkZip\">郵便番号</label>";
		_html += "</div>";
		_html += "<div>";
		_html += "<input type=\"text\" id=\"poi_name\" name=\"poi_name\" />";
		_html += "<input type=\"hidden\" name=\"grp\" id=\"grp\" value=\"" + ph.get("grp") + "\" />";
		_html += "<input type=\"hidden\" name=\"xsl\" value=\"searchTop2\" />";
		_html += "<input type=\"hidden\" name=\"br\" id=\"br\" value=\"" + ph.get("br") + "\" />";
		_html += "<input type=\"submit\" value=\" 検索 \" />";
		_html += "</div>";
		_html += "</form>";
		_html += "</div>";
		_html += "<div class=\"landmarkCaution\">";
		_html += "<p>例）入力キーワード：「東京タワー」「東京ミッドタウン」「四ツ谷」「御茶ノ水」<br />";
		_html += "※お探しの地域に店舗がない場合もあります。</p>";
		_html += "</div>";
		_html += "<img src=\"/sevenandifs/images/space.gif\" width=\"1\" height=\"350\" />";
		_html += "</div>";
	
	}
	
	document.getElementById("listArea").innerHTML = _html;
};


/*
 * 検索結果リストを作成する(POI属性)
 * @param obj jsonオブジェクト
 */
function poi(obj) {

	var _html = "<table width=\"849\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"minTable\">";
  	_html += "<tr>";
    _html += "<td align=\"center\">";
	_html += "<table width=\"838\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"subTable\">";
	_html += "<tr><td align=\"left\">";

	// 検索キーワード
	_html += "<p><span>検索キーワード</span>";
	_html += "<span class=\"keyWD\">";
	_html += obj.Parameter[0].q;
	_html += "</span>";
	_html += "</p>";
	_html += "</td>";
	_html += "<td align=\"right\">";
	
	// ヒット件数
	_html += "<p style=\"padding:4px;\">";
	_html += "<span>検索ヒット数</span><span class=\"hitNum\">"+obj.Property[0].hit+"件</span>";
	_html += "</p>";
	
	_html += "</td></tr></table>";
	_html += "</td></tr>";

	// 検索結果が0件の場合かそうでないか
	if( obj.Property[0].hit != 0 ) {
	
	
		_html += "<tr><td>";
		// リスト部分
		_html += "	<table width=\"838\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"listTable\">";
		_html += "<tr><th>店名</th><th>住所</th><th>電話番号</th><th>サービス</th></tr>";
		_html += createPOIList(obj);
	
		// 20件より少ない場合、行追加する
		var si = obj.Property[0].startIndex;
		var ei = obj.Property[0].endIndex;
		var loop = 20-(ei-si+1);
		if( loop < 20 ) {
			for( var j=loop; j > 0; j-- ) {
				if( j%2 == 1 ) _html += "<tr class=\"bg2\"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
				else _html += "<tr class=\"bg1\"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
			}
		}
		_html += "</table>";
		_html += "</td></tr>";
		
		// ページ送り
		_html += "<tr><td align=\"center\">";
		_html += "<table width=\"838\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"footTable\">";
	    _html += "<tr><td width=\"189\" align=\"right\">"+beforeP(obj, ph)+"</td>";
	    _html += "<td width=\"460\" align=\"center\"><p style=\"padding:7px;\">"+createPageSendLink2(obj,ph)+"</p></td>";
	    _html += "<td width=\"189\" align=\"left\">"+nextP(obj, ph)+"</td></tr>";
	    _html += "</table>";
		_html += "</td></tr></table>";
		
		document.getElementById("starttmp").value = obj.Property[0].start?obj.Property[0].start:1;
	} else {
		
		_html += "</td></tr></table>";
	
		// 再検索窓スタート
		_html += "<div style=\"margin:8px;\">";
		_html += "<p>"+(obj.Parameter[0].q =="キーワードなし"?"キーワードを入力してください。":"入力されたキーワードにヒットしませんでした。")+"</p>";
		_html += "<div class=\"searchBodyMain_R\">";
		_html += "<div class=\"searchBodyForms_R\">";
		_html += "<form name=\"f1\" onsubmit=\"return searchPOI2(this.q.value);\">";
		_html += "<p id=\"keyLead\">検索したいキーワードを入力してください</p>";
		_html += "<input type=\"text\" id=\"q\" name=\"q\" />";
		_html += "<input type=\"submit\" value=\" 検索 \" />";
		_html += "</form>";
		_html += "</div>";
		_html += "<div class=\"keyCaution\">";
		_html += "<p>※スペースで区切って頂く事で複数のキーワードで絞り込む事が出来ます。</p>";
		_html += "<p>※店舗名称、住所、電話番号の一部で検索する事が出来ます。<br />";
		_html += "例）<br />";
		_html += "入力キーワード：「逗子　デニーズ」<br />";
		_html += "↓<br />";
		_html += "検索結果：「デニーズ　逗子店　神奈川県逗子市桜山９−１−１０　046-873-5598」</p>";
		_html += "</div>";
		_html += "<img src=\"/sevenandifs/images/space.gif\" width=\"1\" height=\"350\" />";
		_html += "</div>";
		_html += "</div>";
		
		
	}
	
	document.getElementById("listArea").innerHTML = _html;
};


/*
 * リスト部分を作成する(ランドマーク)
 * @param list リストオブジェクト
 * return _html テーブル
 */
function createLMList( obj ) {
	var html = "";
	for(var i=0; i<obj.poiList.length; i++) {
 		if( i % 2 == 0 ) html += "<tr class=\"bg1\">";
		else html += "<tr class=\"bg2\">";
		html += "<td width=\"330\">";
		
		// ランドマーク名称
		html += "<a target=\"_parent\" ";
		html += "href=\"/map/uc/Maps?grp="+obj.Parameter[0].grp;
		html += "&nl="+obj.poiList[i].latitude;
		html += "&el="+obj.poiList[i].longitude;
		html += "&scl=70000&br="+obj.Parameter[0].br+"\">"+obj.poiList[i].name+"</a>";
		
		// 住所
		html += "</td><td width=\"329\">";
		html += obj.poiList[i].kenname + obj.poiList[i].cityname;
		html +="</td></tr>";
	}
	return html;
};

/*
 * リスト部分を作成する(駅)
 * @param list リストオブジェクト
 * return _html テーブル
 */
function createSTList( obj ) {
	var html = "";
	for(var i=0; i<obj.poiList.length; i++) {
 		if( i % 2 == 0 ) html += "<tr class=\"bg1\">";
		else html += "<tr class=\"bg2\">";
		html += "<td width=\"330\">";
		
		// 駅名
		html += "<a target=\"_parent\" ";
		html += "href=\"/map/uc/Maps?grp="+obj.Parameter[0].grp;
		html += "&nl="+obj.poiList[i].latitude;
		html += "&el="+obj.poiList[i].longitude;
		html += "&scl=70000&br="+obj.Parameter[0].br+"\">"+obj.poiList[i].name+"</a>";
		
		// 路線一覧
		html += "</td><td width=\"329\">";
		for( var j=0; j<obj.poiList[i].rosenList.length; j++ ) {
			if( j != 0) html += ",";
			html += obj.poiList[i].rosenList[j].name;
		}
		html +="</td></tr>";
	}
	return html;
};

/*
 * リスト部分を作成する(郵便番号)
 * @param list リストオブジェクト
 * return _html テーブル
 */
function createZPList( obj ) {
	var html = "";
	for(var i=0; i<obj.poiList.length; i++) {
 		if( i % 2 == 0 ) html += "<tr class=\"bg1\">";
		else html += "<tr class=\"bg2\">";

		html += "<td width=\"330\">";
		
		// 郵便番号
		html += "<a target=\"_parent\" ";
		html += "href=\"/map/uc/Maps?grp="+obj.Parameter[0].grp;
		html += "&nl="+obj.poiList[i].latitude;
		html += "&el="+obj.poiList[i].longitude;
		html += "&scl=70000&br="+obj.Parameter[0].br+"\">〒"+(obj.poiList[i].zip_code).substring(0,3)+"-"+(obj.poiList[i].zip_code).substring(3)+"</a>";
		
		// 住所
		html += "</td><td width=\"329\">";
		html += obj.poiList[i].kenname + obj.poiList[i].cityname + obj.poiList[i].name;
		html +="</td></tr>";
	}
	return html;
};

/*
 * リスト部分を作成する(POI属性)
 * @param list リストオブジェクト
 * return _html テーブル
 */
function createPOIList( obj ) {
	var html = "";
	for(var i=0; i<obj.poiList.length; i++) {
 		if( i % 2 == 0 ) html += "<tr class=\"bg1\">";
		else html += "<tr class=\"bg2\">";

		html += "<td width=\"185\">";
		
		// ロゴ、店舗名称
		html += getLogoImage( obj.poiList[i].disp_str40 );
		html += "<a target=\"info\" ";
		html += "href=\"/map/uc/PoiInfo?grp="+obj.Parameter[0].grp;
		html += "&poi_code="+obj.poiList[i].id;
		html += "&br="+obj.Parameter[0].br+"\">"+ obj.poiList[i].name +"</a>";
		
		// 住所
		html += "</td><td width=\"255\">";
		html += obj.poiList[i].full_address?obj.poiList[i].full_address:"";
		html +="</td>";
		
		// 電話番号
		html += "</td><td width=\"86\">";
		html += obj.poiList[i].disp_str03?obj.poiList[i].disp_str03:"";
		html +="</td>";
		
		// サービス
		html += "</td><td width=\"180\">";
		html += getService1( obj.poiList[i].search_str01 ); // 24時間営業
		html += getService2( obj.poiList[i].search_str02 ); // 玄関・店舗入り口段差なし
		html += getService3( obj.poiList[i].search_str03 ); // トイレに手すりあり
		html += getService4( obj.poiList[i].search_str04 ); // トイレにベビーシートあり
		html += getService5( obj.poiList[i].search_str05 ); // 駐車場あり
		html += getService6( obj.poiList[i].search_str06 ); // 分煙対応
		html += getService7( obj.poiList[i].search_str07 ); // 禁煙対応
		html += getService8( obj.poiList[i].search_str08 ); // パーティールームあり
		html += getService9( obj.poiList[i].search_str09 ); // 少人数個室あり
		html += getService10( obj.poiList[i].search_str10 ); // 席の予約可
		html += getService11( obj.poiList[i].search_str11 ); // テイクアウトのみ
		html +="</td>";
		html +="</tr>";
	}
	return html;
};



/**
 * POI属性検索(POI用)
 */
function searchPOI( poi_name ) {
	// 空なら何もしない
	if( !poi_name ) return false;
	
	var free1 = encodeURI( poi_name );	
	ph.put('xsl','searchTop');
	if( br != "01" ) ph.put("disp_str40", br);
	location.href = "/map/uc/Top?" + ph + "&q=" + free1;
	return false;
};

/**
 * POI再属性検索(POI用)
 */
function searchPOI2( poi_name ) {
	ph.remove("xsl");
	ph.remove("q");
	ph.remove("callback");
	ph.remove("vo");
	ph.remove("srt");
	var free1 = encodeURI( poi_name );

	ph.put('xsl','searchTop');
	location.replace("/map/uc/Top?" + ph + "&q=" + free1);
	return false;
};

var brandStr = "disp_str40";
var serviceArray = ["search_str01","search_str02","search_str03","search_str04","search_str05","search_str06","search_str07","search_str08","search_str09","search_str10","search_str11"];
/*
 * Formないでパラメータを作成する(ブランド絞り込みの場合)
 */
function createParam( form ) {
	var element = form.elements.length;
	var brp = '';
	elm = document.getElementsByName(brandStr);
	for( var i=0; i<elm.length; i++ ) {
		if( elm[i].checked ) {
			if( brp != '' ) brp += ",";
			brp += elm[i].value;
		}	
	}
	return brp;
};

/*
 * Formないでパラメータを作成する2(サービス絞り込みの場合)
 */
function createParam2( form ) {
	var element = form.elements.length;
	var srvp = "";
	for( var i=0; i<serviceArray.length; i++ ) {
			elm = document.getElementById(serviceArray[i]);
			if( !elm ) continue;
			if( elm.checked ) {
				if( srvp != '' ) srvp += ",";
				srvp += elm.id;
			}	
		}
	return srvp;
};

/*
 * Formないでパラメータを作成する(サービス絞り込み用)
 */
function createParamForService( form ) {
	var element = form.elements.length;
	var srvph = new mapionFuncs.text.ParamHashForUC();
	// チェックついてない場合のため
	var nonChk = "";
	
	for( var i=0; i<element; i++ ) {
		if( form.elements[i].type != 'checkbox' ) continue;
		if( nonChk == "" ) nonChk = form.elements[i].name;
		if( form.elements[i].checked ) {
			srvph.put(form.elements[i].name, form.elements[i].value);
		} else {
			//srvph.put(form.elements[i].name, "null");
		}
	}
	var srvp = "";
	if( srvph.getkeys().length < 1 ) {
		if( br == "01" ) srvp += "&" + nonChk + "=9999";
		else return "";
	} else {
		srvp = "&" + srvph;
	}

	return srvp;
};

var chkflg = "";

/*
 * checkeboxにチェックをつける・はずす
 */
function checkboxed( form, id, flg ) {
	if( chkflg == id ) return;
	
	for( i=0; i<form.elements.length; i++ ) {
		if( form.elements[i].type == 'checkbox') {
			form.elements[i].checked = flg;
		}
	}
	chkflg = id;
	// PoiCount再検索
	research(true);
};

/*
 * 全角チェック、郵便番号の棒線チェック
 */
function chkZen( str ) {
	
	while( str.match(/[０-９]/) ) {
		for( var i=0; i<zenkaku.length; i++ ) {
			str = str.replace(zenkaku[i], hankaku[i]);
		}
	}
	str = str.replace('-','');
	str = str.replace('ー','');
	str = str.replace('－','');
	str = str.replace('―','');
	str = str.replace('‐','');
	return str;
}

/*
 * ログを残す
 */
function log(){
	var log_str = "/map/Top/";
	if( ph.get("sgrp") ) log_str += ph.get("sgrp");
	else log_str += "poi";
	mapionTracker(log_str);
};



