//表示件数
function get_List_DispCnt() {

	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; 
	}
	return '';
}

//表示件数
function get_Radio_DispCnt(intNum) {
	var strTmpVal = '';

	if (intNum == '1') {
		for (i=0;i < document.getElementsByName('DispCnt').length; i++) {
			if (document.getElementsByName('DispCnt')[i].checked) {
				strTmpVal = document.getElementsByName('DispCnt')[i].value;
				break; 
			}
		}
	} else {
		for (i=0;i < document.getElementsByName('DispCntPreju').length; i++) {
			if (document.getElementsByName('DispCntPreju')[i].checked) {
				strTmpVal = document.getElementsByName('DispCntPreju')[i].value;
				break; 
			}
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'DispCnt/' + strTmpVal;
	} else {
		return '';
	}
}


//カテゴリ
function get_List_Division() {

	if (document.getElementsByName('Z')[0]) {
		return '/' + 'Z/' + document.getElementsByName('Z')[0].value;
	}
	return '';
}

//都道府県
function get_List_Pref() {

	if (document.getElementsByName('PrefCd')[0]) {
		if (document.getElementsByName('PrefCd')[0].value != "") {
			return '/' + 'PrefCd/' + document.getElementsByName('PrefCd')[0].value;
		}
	}
	return '';
}

//市区郡町村
function get_List_City() {

	if (document.getElementsByName('CityCd')[0]) {
		if (document.getElementsByName('CityCd')[0].value != "") {
			return '/' + 'CityCd/' + document.getElementsByName('CityCd')[0].value;
		}
	}
	return '';
}

//大字通称
function get_List_Region() {

	if (document.getElementsByName('RgCd')[0]) {
		if (document.getElementsByName('RgCd')[0].value != "") {
			return '/' + 'RgCd/' + document.getElementsByName('RgCd')[0].value;
		}
	}
	return '';
}


//沿線コード
function get_List_Line() {

	if (document.getElementsByName('LineCdParam')[0]) {
		if (document.getElementsByName('LineCdParam')[0].value != "") {
			return '/' + 'LineCd/' + document.getElementsByName('LineCdParam')[0].value;
		}
	}
	return '';
}

//駅コード
function get_List_Station() {

	if (document.getElementsByName('StnCd')[0]) {
		if (document.getElementsByName('StnCd')[0].value != "") {
			return '/' + 'StnCd/' + document.getElementsByName('StnCd')[0].value;
		}
	}
	return '';
}

//通勤時間検索
function get_List_TimeStation() {

	if (document.getElementsByName('TsCd')[0]) {
		if (document.getElementsByName('TsCd')[0].value != "") {
			return '/' + 'TsCd/' + document.getElementsByName('TsCd')[0].value;
		}
	}
	return '';
}

//フリーワード物件名
function getPropNmParam() {

	if (document.getElementsByName('PropNm')[0]) {
		if (document.getElementsByName('PropNm')[0].value != "") {
			return '/' + 'PropNm/' + encodeURI(document.getElementsByName('PropNm')[0].value);
		}
	}
	return '';
}

//フリーワード住所
function getAdrsNmParam() {

	if (document.getElementsByName('freeAdNm')[0]) {
		if (document.getElementsByName('freeAdNm')[0].value != "") {
			return '/' + 'freeAdNm/' + encodeURI(document.getElementsByName('freeAdNm')[0].value);
		}
	}
	return '';
}

//フリーワード駅
function getStnNmParam() {
	var strTmpVal = '';

	if (document.getElementsByName('StnCd')[0]) {
		if (document.getElementsByName('StnCd')[0].value != "") {
			strTmpVal+= '/' + 'StnCd/' + document.getElementsByName('StnCd')[0].value;
		}
	}
	if (document.getElementsByName('freeStNm')[0]) {
		if (document.getElementsByName('freeStNm')[0].value != "") {
			strTmpVal+= '/' + 'freeStNm/' + encodeURI(document.getElementsByName('freeStNm')[0].value);
		}
	}
	return strTmpVal;
}

//フリーワード駅選択
function get_List_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_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 '';
	}
}

//価格FROM
function get_List_PriceFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('PriceFrom')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'PriceFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//価格TO
function get_List_PriceTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('PriceTo')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'PriceTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//間取り（マンション）
function get_List_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 '';
	}
}

//間取り（一戸建て）
function get_List_K_Layout() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('K_Layout').length; i++) {
		if (document.getElementsByName('K_Layout')[i].checked) {
			strTmpVal += document.getElementsByName('K_Layout')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'K_Layout/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//専有面積FROM
function get_List_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_List_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 '';
	}
}

//建物面積FROM（一戸建て）
function get_List_BdSzFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('BdSzFrom')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'BdSzFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//建物面積TO（一戸建て）
function get_List_BdSzTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('BdSzTo')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'BdSzTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}


//専有面積FROM（土地）
function get_List_LandSzFrom() {
	var strTmpVal = '';
	var n = document.getElementsByName('LandSzFrom')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'LandSzFrom/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}

//専有面積TO（土地）
function get_List_LandSzTo() {
	var strTmpVal = '';
	var n = document.getElementsByName('LandSzTo')[0];

	if (n.options[n.selectedIndex].value != "0") {
		return '/' + 'LandSzTo/' + n.options[n.selectedIndex].value;
	} else {
		return '';
	}
}


//築年
function get_List_CompDt() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('CompDt').length; i++) {
		if (document.getElementsByName('CompDt')[i].checked) {
			strTmpVal = 'CompDt/' + document.getElementsByName('CompDt')[i].value;
			break;
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + strTmpVal;
	} else {
		return '';
	}
}

//徒歩
function get_List_WalkTm() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('WalkTm').length; i++) {
		if (document.getElementsByName('WalkTm')[i].checked) {
			strTmpVal = 'WalkTm/' + document.getElementsByName('WalkTm')[i].value;
			break; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + strTmpVal;
	} else {
		return '';
	}
}

//部屋階数FROM
function get_List_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_List_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_List_PjUse() {
	var strTmpVal = '';

	for (i=0;i < 2; i++) {

		if (document.getElementsByName('PjUse')[i].checked) {
			strTmpVal += document.getElementsByName('PjUse')[i].value + ','; 
		}
	}

	if (strTmpVal.length > 0) {
		return '/' + 'PjUse/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//種別[事]
function get_List_ProKd() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('ProKd').length; i++) {

		if (document.getElementsByName('ProKd')[i].checked) {
			strTmpVal += document.getElementsByName('ProKd')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'ProKd/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//所有形態[事]
function get_List_PossForm() {
	var strTmpVal = '';

	for (i=0;i < 2; i++) {

		if (document.getElementsByName('PossForm')[i].checked) {
			strTmpVal += document.getElementsByName('PossForm')[i].value + ','; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + 'PossForm/' + strTmpVal.substring(0, strTmpVal.length - 1);
	} else {
		return '';
	}
}

//利回り
function get_List_Yield() {
	var strTmpVal = '';

	for (i=0;i < document.getElementsByName('Yield').length; i++) {
		if (document.getElementsByName('Yield')[i].checked) {
			strTmpVal = 'Yield/' + document.getElementsByName('Yield')[i].value;
			break; 
		}
	}
	if (strTmpVal.length > 0) {
		return '/' + strTmpVal;
	} 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 get_List_PjSusBit() {
	var bitValue = '________________________________________________________________________________________________________________________________________________________________________________________________________';
	var bitCheckValue = '';
	var bitArray = new Array(bitValue.length);
	var ChoosyArray = new Array('PjRmEnv','PjOth','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.indexOf('1') >= 0) {
		return '/' + 'PjSusBit/' + bitCheckValue;
	} else {
		return '';
	}
}


function open_window() {

	var url = '/buy/M1120033/';
	window.open(url,null,'width=400,height=400,directories=0,location=0 menubar=0,toolbar=0,resizable=1,left=0,top=0');
}

function popup(target, url) {
	var InfoPath = '';

	InfoPath += get_List_Division();
	InfoPath += get_List_Pref();
	InfoPath += get_List_City();
	InfoPath += get_List_Region();
	InfoPath += get_List_Line();
	InfoPath += get_List_Station();
	InfoPath += get_List_PriceFrom();
	InfoPath += get_List_PriceTo();
	InfoPath += get_List_WalkTm();
	InfoPath += get_List_PjSusBit();
	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();

	if (document.getElementsByName('Z')[0].value == 'm') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_Layout();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_PjRmEnvFrom();
//		InfoPath += get_List_PjRmEnvTo();

	} else if (document.getElementsByName('Z')[0].value == 'k') {

		InfoPath += get_List_K_Layout();
		InfoPath += get_List_BdSzFrom();
		InfoPath += get_List_BdSzTo();
		InfoPath += get_List_CompDt();

	} else if (document.getElementsByName('Z')[0].value == 't') {

		InfoPath += get_List_LandSzFrom();
		InfoPath += get_List_LandSzTo();

	} else if (document.getElementsByName('Z')[0].value == 'j') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_Yield();
		InfoPath += get_List_PjUse();
		InfoPath += get_List_ProKd();
		InfoPath += get_List_PossForm();

	}

	if (target == 1) {
		InfoPath += '/origin/1';
	} else if (target == 2) {
		InfoPath += '/origin/2';
	} else {
		InfoPath += '/origin/1';
	}

	document.search.action = url + 'M1120130/index' + InfoPath;
	window.open(document.search.action, 'popup');
}

function popupStn(target, url) {
	var InfoPath = '';

	InfoPath += get_List_Division();
	InfoPath += get_List_Pref();
	InfoPath += get_List_City();
	InfoPath += get_List_Region();
	InfoPath += get_List_Line();
	InfoPath += get_List_Station();
	InfoPath += get_List_PriceFrom();
	InfoPath += get_List_PriceTo();
	InfoPath += get_List_WalkTm();
	InfoPath += get_List_PjSusBit();
	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();

	if (document.getElementsByName('Z')[0].value == 'm') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_Layout();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_PjRmEnvFrom();
//		InfoPath += get_List_PjRmEnvTo();

	} else if (document.getElementsByName('Z')[0].value == 'k') {

		InfoPath += get_List_K_Layout();
		InfoPath += get_List_BdSzFrom();
		InfoPath += get_List_BdSzTo();
		InfoPath += get_List_CompDt();

	} else if (document.getElementsByName('Z')[0].value == 't') {

		InfoPath += get_List_LandSzFrom();
		InfoPath += get_List_LandSzTo();

	} else if (document.getElementsByName('Z')[0].value == 'j') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_Yield();
		InfoPath += get_List_PjUse();
		InfoPath += get_List_ProKd();
		InfoPath += get_List_PossForm();

	}

	if (target == 1) {
		InfoPath += '/origin/1';
	} else if (target == 2) {
		InfoPath += '/origin/2';
	} else {
		InfoPath += '/origin/1';
	}

	document.search.action = url + 'M1120140/index' + InfoPath;
	window.open(document.search.action, 'popup');
}

function transfer() {
	var InfoPath = '';

	InfoPath += get_List_Division();
	InfoPath += get_List_Pref();
	InfoPath += get_List_City();
	InfoPath += get_List_Region();
	InfoPath += get_List_Line();
	InfoPath += get_List_Station();
	InfoPath += get_List_PriceFrom();
	InfoPath += get_List_PriceTo();
	InfoPath += get_List_WalkTm();
	InfoPath += get_List_PjSusBit();
	InfoPath += get_List_Radius();
	InfoPath += get_List_Facility();

	if (document.getElementsByName('Z')[0].value == 'm') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_Layout();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_PjRmEnvFrom();
//		InfoPath += get_List_PjRmEnvTo();

	} else if (document.getElementsByName('Z')[0].value == 'k') {

		InfoPath += get_List_K_Layout();
		InfoPath += get_List_BdSzFrom();
		InfoPath += get_List_BdSzTo();
		InfoPath += get_List_CompDt();

	} else if (document.getElementsByName('Z')[0].value == 't') {

		InfoPath += get_List_LandSzFrom();
		InfoPath += get_List_LandSzTo();

	} else if (document.getElementsByName('Z')[0].value == 'j') {

		InfoPath += get_List_CompDt();
		InfoPath += get_List_UseSzSquFrom();
		InfoPath += get_List_UseSzSquTo();
		InfoPath += get_List_Yield();
		InfoPath += get_List_PjUse();
		InfoPath += get_List_ProKd();
		InfoPath += get_List_PossForm();

	}

	if (document.getElementsByName('CityCd')[0].value != '' || document.getElementsByName('RgCd')[0].value != '') {
		if (document.getElementsByName('origin')[0].value == '1') {
			document.search.action += '/M1120030/index';
		} else if (document.getElementsByName('origin')[0].value == '2') {
			document.search.action += '/M1120040/index';
		}
	} else if (document.getElementsByName('LineCdParam')[0].value != '' || document.getElementsByName('StnCd')[0].value != '') {
		if (document.getElementsByName('origin')[0].value == '1') {
			document.search.action += '/M1120070/index';
		} else if (document.getElementsByName('origin')[0].value == '2') {
			document.search.action += '/M1120080/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;
}

