// 一覧全てのチェックボックスの状態変更
function AllCheckBox(value) {
	for (var i = 0; i<document.getElementsByName("PropChk").length; i++) {
		document.getElementsByName("PropChk")[i].checked = value;
	}
}
function AllCheckBox2(value) {
	for (var i = 0; i<document.getElementsByName("PropChk").length; i++) {
		document.getElementsByName("PropChk")[i].checked = value;
	}
	for (var i = 0; i<document.getElementsByName("PropChk2").length; i++) {
		document.getElementsByName("PropChk2")[i].checked = value;
	}
}

//都道府県
function get_PrefParam() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PrefCd').length; i++) {
		if (document.getElementsByName('PrefCd')[i].value != '') {
			strTmpVal += document.getElementsByName('PrefCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'PrefCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//市区郡町村
function get_City_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('CityCd').length; i++) {
		if (document.getElementsByName('CityCd')[i].value != '') {
			strTmpVal += document.getElementsByName('CityCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'CityCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//市区郡町村カテゴリ
function get_Cate_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('CateCd').length; i++) {
		if (document.getElementsByName('CateCd')[i].value != '') {
			strTmpVal += document.getElementsByName('CateCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'CateCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//大字通称
function get_Region_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('RgCd').length; i++) {
		if (document.getElementsByName('RgCd')[i].value != '') {
			strTmpVal += document.getElementsByName('RgCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'RgCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}


//ブロックコード
function get_BlockParam_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('BlkCd').length; i++) {
		if (document.getElementsByName('BlkCd')[i].value != '') {
			strTmpVal += document.getElementsByName('BlkCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'BlkCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//沿線コード
function get_LineParam_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('LineCd').length; i++) {
		if (document.getElementsByName('LineCd')[i].value != '') {
			strTmpVal += document.getElementsByName('LineCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'LineCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//駅コード
function get_StationParam_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('StnCd').length; i++) {
		if (document.getElementsByName('StnCd')[i].value != '') {
			strTmpVal += document.getElementsByName('StnCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'StnCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}
//通勤時間検索
function get_TsParam_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('TsCd').length; i++) {
		if (document.getElementsByName('TsCd')[i].value != '') {
			strTmpVal += document.getElementsByName('TsCd')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'TsCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//Ext駅選択
function get_StnCd() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('StnChk').length; i++) {
		if (document.getElementsByName('StnChk')[i].checked) {
			strTmpVal += document.getElementsByName('StnChk')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'StnCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//Ext駅選択
function get_TsCd() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('StnChk').length; i++) {
		if (document.getElementsByName('StnChk')[i].checked) {
			strTmpVal += document.getElementsByName('StnChk')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'TsCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//表示件数
function get_DispCnt_Select() {

	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('DispCnt').length; i++) {
			var n = document.getElementsByName('DispCnt')[0];
			return '/' + 'DispCnt/' + n.options[n.selectedIndex].value;
			break; 
	}

	if (strTmpVal.length > 0) {
		return '/' + 'DispCnt/' + strTmpVal;
	} else {
		return '';
	}
}

//一覧パラメータ取得
function search_chk_list(intNum,flag) {

	var InfoPath = '';
	var cnt = 0;
	var StnCnt = 0;
	var TsCnt = 0;

	InfoPath += get_PrefParam();

	if (flag == 1){

		InfoPath += get_City_hidden();
		InfoPath += get_Cate_hidden();
		InfoPath += get_Region_hidden();

	}else if (flag == 2){ 

		for (i=0;i < document.getElementsByName('StnChk').length; i++) {
			if (document.getElementsByName('StnChk')[i].checked) {
				cnt++;
			}
		}
		//ExtCheckなし
		if (cnt == 0) {

			//InfoPath += get_BlockParam_hidden();
			InfoPath += get_LineParam_hidden();
			InfoPath += get_StationParam_hidden();
			InfoPath += get_TsParam_hidden();

		//ExtCheckあり
		} else {

			if(document.getElementsByName('TsCd').length>0) {
				InfoPath += get_TsCd();
			} else{
				//InfoPath += get_BlockParam_hidden();
				InfoPath += get_StnCd();
			}
		}
	}

	InfoPath += get_DispCnt_Select();

	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();

	InfoPath += get_PropKdCd();
	InfoPath += get_HuRtFrom();
	InfoPath += get_HuRtTo();

	InfoPath += get_Layout();

	InfoPath += get_UseSzSquFrom();
	InfoPath += get_UseSzSquTo();

	InfoPath += get_CompDt();
	InfoPath += get_WalkTm();

	InfoPath += get_PjRmEnvFrom();
//	InfoPath += get_PjRmEnvTo();

	InfoPath += get_PjSusBit();

	if (location.search == '') {
		if (InfoPath != '') {
			InfoPath = InfoPath.substring(1, InfoPath.length);
		}
	} else {
		if (InfoPath != '') {
			InfoPath = InfoPath.substring(1, InfoPath.length);
		}
	}

	if (intNum == '1') {
		if (document.search.action.substring(document.search.action.length - 1) == '/') {
			document.search.action = document.search.action + InfoPath;
		} else {
			document.search.action = document.search.action + '/' + InfoPath;
		}
	}
//	alert(InfoPath);
	document.search.submit();
}

//チェックボックスのグループIDを取得
//→チェックボックスの物件IDを取得
function get_RentGroupID() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk')[i].value + ','; 
		}
	}
	return '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);
}


//チェックボックスのグループIDを取得
//→チェックボックスの物件IDを取得
function get_RentGrId() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk')[i].value + ','; 
		}
	}
	return '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);
}

//チェックボックスのグループIDを取得
//→チェックボックスの物件IDを取得
function get_RentGrId2() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk')[i].value + ','; 
		}
	}
	for (i=0;i < document.getElementsByName('PropChk2').length; i++) {
		if (document.getElementsByName('PropChk2')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk2')[i].value + ','; 
		}
	}
	return '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);
}

//パラメータを取得
function get_Param_hidden() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('Param').length; i++) {
		strTmpVal += document.getElementsByName('Param')[i].value + ','; 
	}

	if (strTmpVal.length > 0) {
		return strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}


// 物件詳細（通常一覧）
function search_id_detail() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_Param_hidden();
	InfoPath += get_RentGroupID();

	document.detail.action = document.detail.action + InfoPath;

	document.detail.submit();
}


// 物件詳細（お気に入り/最近チェック）
function search_id_detail_submit() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_RentGrId();

	document.detail.action = document.detail.action + InfoPath;
	document.detail.submit();
}

// 物件詳細（お気に入り/最近チェック）
function search_id_detail_submit2() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}
	for (i=0;i < document.getElementsByName('PropChk2').length; i++) {
		if (document.getElementsByName('PropChk2')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_RentGrId2();

	document.detail.action = document.detail.action + InfoPath;
	document.detail.submit();
}


// お問い合わせ（通常一覧）
function search_id_inquire() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_Param_hidden();
	InfoPath += get_RentGroupID();

	document.inquire.action = document.inquire.action + InfoPath;
	document.inquire.submit();
}


// お問い合わせ（お気に入り/最近チェック）
function search_id_inquire_submit() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_RentGrId();

	document.inquire.action = document.inquire.action + InfoPath;
	document.inquire.submit();
}

// お問い合わせ（お気に入り/最近チェック）
function search_id_inquire_submit2() {
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}
	for (i=0;i < document.getElementsByName('PropChk2').length; i++) {
		if (document.getElementsByName('PropChk2')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	InfoPath += get_RentGrId2();

	document.inquire.action = document.inquire.action + InfoPath;
	document.inquire.submit();
}

// 物件コード取得(30物件選択)
function search_PropId() {

	var strTmpVal = '';
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	} else if (cnt>30) {
		alert("物件選択が30件を超えています");
		return ;
	}
	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk')[i].value + ','; 
		}
	}
	
	InfoPath = '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1) + '/history/1';
	document.search.action = document.search.action + InfoPath;
	document.search.submit();
}


// 物件コード取得（一覧お気に入り）
function search_PropId_hidden() {

	var strTmpVal = '';
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}
	
	InfoPath = 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);

	document.search_prop.action = document.search_prop.action + InfoPath;
	document.search_prop.submit();
}

// 物件コード取得（物件比較）
function search_PropId_hidden2() {

	var strTmpVal = '';
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	for (i=0;i < document.getElementsByName('PropChk2').length; i++) {
		if (document.getElementsByName('PropChk2')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	}

	//1つの物件に対して、2つのチェックボックスがある為
	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}

	//1つの物件に対して、2つのチェックボックスがある為
	for (i=0;i < document.getElementsByName('PropChk2').length; i++) {
		if (document.getElementsByName('PropChk2')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}

	InfoPath = '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);

	document.search_prop.action = document.search_prop.action + InfoPath;
	document.search_prop.submit();
}


//物件種別
function get_PropKdCd() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PropKdCd').length; i++) {
		if (document.getElementsByName('PropKdCd')[i].checked) {
			strTmpVal += document.getElementsByName('PropKdCd')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'PropKdCd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//家賃FROM
function get_HuRtFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('HuRtFrom')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'HuRtFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//家賃TO
function get_HuRtTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('HuRtTo')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'HuRtTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//間取り
function get_Layout() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('Layout').length; i++) {
		if (document.getElementsByName('Layout')[i].checked) {
			strTmpVal += document.getElementsByName('Layout')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'Layout/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//専有面積FROM
function get_UseSzSquFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('UseSzSquFrom')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'UseSzSquFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//専有面積TO
function get_UseSzSquTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('UseSzSquTo')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'UseSzSquTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//築年
function get_CompDt() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('CompDt').length; i++) {
		if (document.getElementsByName('CompDt')[i].checked && document.getElementsByName('CompDt')[i].value != '0') {
			strTmpVal = 'CompDt/' + document.getElementsByName('CompDt')[i].value;
			break;
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + strTmpVal;
	} else {
		return '';
	}
}

//徒歩
function get_WalkTm() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('WalkTm').length; i++) {
		if (document.getElementsByName('WalkTm')[i].checked && document.getElementsByName('WalkTm')[i].value != '0') {
			strTmpVal = 'WalkTm/' + document.getElementsByName('WalkTm')[i].value;
			break; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + strTmpVal;
	} else {
		return '';
	}
}

//部屋階数FROM
function get_PjRmEnvFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('PjRmEnvFrom')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'PjRmEnvFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//部屋階数TO
/*
function get_PjRmEnvTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('PjRmEnvTo')[0];

	if (n.options[n.selectedIndex].value != '0') {
		return '/' + 'PjRmEnvTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}
*/

//物件番号
function get_PropChk() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropChk')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'PropChk/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//擬似ビットフラグ
function get_PjSusBit() {
	var bitValue = '__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________';
	var bitCheckValue = '';
	var bitArray = new Array(bitValue.length);
	var ChoosyArray = new Array('HuRtOth','PjRmEnv','PjMvCnd','PjBTK','PjRmEp','PjBdEp','PjInfo','PjSec','PjOth','PjUd','Info');

	for (i=0;i < bitValue.length; i++) {
		bitArray[i] = bitValue.charAt(i);
	}
	for (j=0;j < ChoosyArray.length; j++) {
		for (i=0;i < document.getElementsByName(ChoosyArray[j]).length; i++) {
			if (document.getElementsByName(ChoosyArray[j])[i].checked) {
				bitArray[document.getElementsByName(ChoosyArray[j])[i].value] = '1';
			}
}
	}

	for (j=0;j < bitArray.length; j++) {
		bitCheckValue += bitArray[j];
	}

	//こだわり条件、外したいこだわり条件ダブりチェック
	if (bitCheckValue.substr(55, 1) == '1' && bitCheckValue.substr(215, 1) == '1') {
		if (window.confirm('入居条件「女性専用」と外したいこだわり条件「女性専用」は同時に選択できません。外したいこだわり条件「女性専用」を優先させます。よろしいですか？')) {
			for (i=0;i < bitCheckValue.length; i++) {
				bitArray[i] = bitCheckValue.charAt(i);
			}

			bitCheckValue = '';

			for (j=0;j < bitArray.length; j++) {
				if (j == 55) {
					bitCheckValue += '_';
				} else {
					bitCheckValue += bitArray[j];
				}
			}
		} else {
			return false;
		}
	}

	if (bitCheckValue.substr(53, 1) == '1' && bitCheckValue.substr(216, 1) == '1') {
		if (window.confirm('入居条件「ペット相談」と外したいこだわり条件「ペット相談」は同時に選択できません。外したいこだわり条件「ペット相談」を優先させます。よろしいですか？')) {
			for (i=0;i < bitCheckValue.length; i++) {
				bitArray[i] = bitCheckValue.charAt(i);
			}

			bitCheckValue = '';

			for (j=0;j < bitArray.length; j++) {
				if (j == 53) {
					bitCheckValue += '_';
				} else {
					bitCheckValue += bitArray[j];
				}
			}
		} else {
			return false;
		}
	}

	if (bitCheckValue.substr(66, 1) == '1' && bitCheckValue.substr(217, 1) == '1') {
		if (window.confirm('入居条件「楽器相談」と外したいこだわり条件「楽器相談」は同時に選択できません。外したいこだわり条件「楽器相談」を優先させます。よろしいですか？')) {
			for (i=0;i < bitCheckValue.length; i++) {
				bitArray[i] = bitCheckValue.charAt(i);
			}

			bitCheckValue = '';

			for (j=0;j < bitArray.length; j++) {
				if (j == 66) {
					bitCheckValue += '_';
				} else {
					bitCheckValue += bitArray[j];
				}
			}
		} else {
			return false;
		}
	}

	if (bitCheckValue.indexOf('1') >= 0) {
		return '/' + 'PjSusBit/' + bitCheckValue;
	} else {
		return '';
	}
}


//半径
function get_List_Radius() {
	var strTmpVal = '';
	var n = document.getElementsByName('Radius')[0];

	for (i=0; i < 7; i++) {
		if (document.getElementsByName('Facility')[i].checked) {
			strTmpVal += document.getElementsByName('Facility')[i].value + ','; 
		}
	}

	if ( strTmpVal != '' ) {
		return '/' + 'Radius/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//周辺施設
function get_List_Facility() {
	var strTmpVal = '';

	for (i=0; i < 7; i++) {

		if (document.getElementsByName('Facility')[i].checked) {
			strTmpVal += document.getElementsByName('Facility')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'Facility/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

function openImg(strName,strName2){

	if (document.getElementById(strName)) {
	  if(document.getElementById)
	    document.getElementById(strName).style.display='block'
	  else if(document.all) 
	    document.all(strName).style.visibility='visible'
	  else if(document.layers) 
	    document.layers[strName].visibility='show'
	}
	if (document.getElementById(strName2)) {
		if(document.getElementById)
			document.getElementById(strName2).style.display='block'
		else if(document.all) 
			document.all(strName2).style.visibility='visible'
		else if(document.layers) 
			document.layers[strName2].visibility='show'
	}
}

function openImg2(strName,strName2,strName3){

	if (document.getElementById(strName)) {
	  if(document.getElementById)
	    document.getElementById(strName).style.display='inline'
	  else if(document.all) 
	    document.all(strName).style.visibility='visible'
	  else if(document.layers) 
	    document.layers[strName].visibility='show'
	}
	if (document.getElementById(strName2)) {
		if(document.getElementById)
			document.getElementById(strName2).style.display='inline'
		else if(document.all) 
			document.all(strName2).style.visibility='visible'
		else if(document.layers) 
			document.layers[strName2].visibility='show'
	}
	if (document.getElementById(strName3)) {
		if(document.getElementById)
			document.getElementById(strName3).style.display='inline'
		else if(document.all) 
			document.all(strName3).style.visibility='visible'
		else if(document.layers) 
			document.layers[strName3].visibility='show'
	}
}

function closeImg(strName,strName2){

	if (document.getElementById(strName)) {
		if(document.getElementById)
			document.getElementById(strName).style.display='none'
		else if(document.all) 
			document.all(strName).style.visibility='hidden'
		else if(document.layers) 
			document.layers[strName].visibility='hide'
	}
	if (document.getElementById(strName2)) {
		if(document.getElementById)
			document.getElementById(strName2).style.display='none'
		else if(document.all) 
			document.all(strName2).style.visibility='hidden'
		else if(document.layers) 
			document.layers[strName2].visibility='hide'
	}
}

function closeImg2(strName,strName2,strName3){

	if (document.getElementById(strName)) {
		if(document.getElementById)
			document.getElementById(strName).style.display='none'
		else if(document.all) 
			document.all(strName).style.visibility='hidden'
		else if(document.layers) 
			document.layers[strName].visibility='hide'
	}
	if (document.getElementById(strName2)) {
		if(document.getElementById)
			document.getElementById(strName2).style.display='none'
		else if(document.all) 
			document.all(strName2).style.visibility='hidden'
		else if(document.layers) 
			document.layers[strName2].visibility='hide'
	}
	if (document.getElementById(strName3)) {
		if(document.getElementById)
			document.getElementById(strName3).style.display='none'
		else if(document.all) 
			document.all(strName3).style.visibility='hidden'
		else if(document.layers) 
			document.layers[strName3].visibility='hide'
	}
}

//駅選択オセロ機能
function func_Othello_station(checkBox,key) {
	var stations = document.getElementsByName('StnChk');
	var intCheckNo = '';

	//alert(checkBox.id);
	var code = checkBox.id.substr(0,7);
	var from_num = -1;
	var to_num = -1;
	var current_num = -1;
	
	if ( document.getElementById('othelloSwitch' + key).checked == false ) {
		return;
	}
	if ( checkBox.checked == true ) {
		for(i=0;i<stations.length;i++) {
			if ( code == stations[i].id.substr(0,7) ) {
				if ( stations[i].id == checkBox.id ) {
					current_num = i;
				} else if ( stations[i].checked == true && current_num == -1 ) {
					from_num = i;
				} else if ( stations[i].checked == true && current_num != -1 && to_num == -1 ) {
					to_num = i;
				}
			}
		}
		for(i=0;i<stations.length;i++) {
			if (  from_num != -1 && from_num <= i && i < current_num ) {
				stations[i].checked = true;
			}
			if ( to_num != -1 && current_num < i && i<= to_num ) {
				stations[i].checked = true;
			}
		}
	}
}

// 物件コード取得（物件比較ページへ）
function search_compare() {

	var strTmpVal = '';
	var InfoPath = '';
	var cnt = 0;

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			cnt++;
		}
	}

	if (cnt == 0) {
		alert("物件を選択してください");
		return ;
	} else if (cnt == 1) {
		alert('物件を比較する場合、2つ以上の物件を選択してください');
		return;
	} else if (cnt > 5) {
		alert("物件は5件まで選択できます。");
		return ;
	}

	for (i=0;i < document.getElementsByName('PropChk').length; i++) {
		if (document.getElementsByName('PropChk')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}
	
	InfoPath = '/' + 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);

	document.compare.action = document.compare.action + InfoPath;
	document.compare.submit();
}

//ポップアップを立ち上げる
function popup(target) {
	var InfoPath = '';

	InfoPath += get_PrefParam();
	InfoPath += get_City_hidden();
	InfoPath += get_Cate_hidden();
	InfoPath += get_Region_hidden();
	InfoPath += get_LineParam_hidden();
	InfoPath += get_StationParam_hidden();

	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();

	InfoPath += get_PropKdCd();
	InfoPath += get_HuRtFrom();
	InfoPath += get_HuRtTo();

	InfoPath += get_Layout();

	InfoPath += get_UseSzSquFrom();
	InfoPath += get_UseSzSquTo();

	InfoPath += get_CompDt();
	InfoPath += get_WalkTm();

	InfoPath += get_PjRmEnvFrom();
//	InfoPath += get_PjRmEnvTo();

	InfoPath += get_PjSusBit();

	if (target == 1) {
		InfoPath += '/origin/1';
	} else if (target == 2) {
		InfoPath += '/origin/2';
	} else if (target == 3) {
		InfoPath += '/origin/3';
	} else {
		InfoPath += '/origin/1';
	}
	document.search.action = '/R0030080/index' + InfoPath;
	window.open(document.search.action, 'popup');
}

//駅再選択用ポップアップ
function station_popup(target) {
	var InfoPath = '';

	InfoPath += get_PrefParam();
	InfoPath += get_City_hidden();
	InfoPath += get_Cate_hidden();
	InfoPath += get_Region_hidden();
	InfoPath += get_LineParam_hidden();
	InfoPath += get_StationParam_hidden();
	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();
	InfoPath += get_PropKdCd();
	InfoPath += get_HuRtFrom();
	InfoPath += get_HuRtTo();
	InfoPath += get_Layout();
	InfoPath += get_UseSzSquFrom();
	InfoPath += get_UseSzSquTo();
	InfoPath += get_CompDt();
	InfoPath += get_WalkTm();
	InfoPath += get_PjRmEnvFrom();
//	InfoPath += get_PjRmEnvTo();
	InfoPath += get_PjSusBit();

	if (target == 1) {
		InfoPath += '/origin/1';
	} else if (target == 2) {
		InfoPath += '/origin/2';
	} else if (target == 3) {
		InfoPath += '/origin/3';
	} else {
		InfoPath += '/origin/1';
	}
	document.search.action = '/R0030090/index' + InfoPath;
	window.open(document.search.action, 'popup');
}

//立ち上げた子ウィンドウから親ウィンドウに値を渡し、リロード
function transfer () {
	var InfoPath = '';

	InfoPath += get_PrefParam();
	if (document.getElementsByName('CityCd')[0].value != '') {
		InfoPath += get_City_hidden();
	}
	if (document.getElementsByName('CateCd')[0].value != '') {
		InfoPath += get_Cate_hidden();
	}
	if (document.getElementsByName('RgCd')[0].value != '') {
		InfoPath += get_Region_hidden();
	}
	if (document.getElementsByName('LineCd')[0].value != '') {
		InfoPath += get_LineParam_hidden();
	}
	if (document.getElementsByName('StnCd')[0].value != '') {
		InfoPath += get_StationParam_hidden();
	}
	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();
	InfoPath += get_PropKdCd();
	InfoPath += get_HuRtFrom();
	InfoPath += get_HuRtTo();
	InfoPath += get_Layout();
	InfoPath += get_UseSzSquFrom();
	InfoPath += get_UseSzSquTo();
	InfoPath += get_CompDt();
	InfoPath += get_WalkTm();
	InfoPath += get_PjRmEnvFrom();
//	InfoPath += get_PjRmEnvTo();
	InfoPath += get_PjSusBit();

	if (document.getElementsByName('CityCd')[0].value != '' || document.getElementsByName('RgCd')[0].value != '') {
		if (document.getElementsByName('origin')[0].value == '1') {
			document.search.action += '/R0020040/index';
		} else if (document.getElementsByName('origin')[0].value == '2') {
			document.search.action += '/R0020050/index';
		} else if (document.getElementsByName('origin')[0].value == '3') {
			document.search.action += '/R0020060/index';
		}
	} else if (document.getElementsByName('LineCd')[0].value != '' || document.getElementsByName('StnCd')[0].value != '') {
		if (document.getElementsByName('origin')[0].value == '1') {
			document.search.action += '/R0030040/index';
		} else if (document.getElementsByName('origin')[0].value == '2') {
			document.search.action += '/R0030050/index';
		} else if (document.getElementsByName('origin')[0].value == '3') {
			document.search.action += '/R0030060/index';
		}
	}
	window.opener.open(document.search.action + InfoPath, '_self');
	window.close();
	return false;
}

//立ち上げた子ウィンドウから親ウィンドウに値を渡し、リロード
function transferStn() {
	var InfoPath = '';

	InfoPath += get_StnCd();
	InfoPath += document.getElementsByName('Param')[0].value;

	document.search.action += '/' + document.getElementsByName('section')[0].value + '/index';
	window.opener.open(document.search.action + InfoPath, '_self');
	window.close();
	return false;
}
function transferLink(url) {
	window.opener.open(url, '_self');
	window.close();
	return false;
}

