
/*-------以下は、占いサイト専用-------*/

//デバッグ用
var g_uranai_debug = false;//{true:ログ表示/false:ログ非表示}
var g_uranai_debug_id = 'test';

//鑑定料金集計フラグ
var g_total_price_falg = false;//{true:集計する/false:集計しない}


//■バイオリズム(個人)の料金------------------------------------------------------
var g_biorhythm_personal_price = 4900;
//■バイオリズムオプションの料金--------------------------------------------------
var g_biorhythm_personal_option_price = 4900;//5人までは4,900円
var g_biorhythm_personal_option_num = 5;
var g_biorhythm_personal_option_add_price = 1500;//1人追加ごとに1,500円
var g_biorhythm_personal_option_add_num = 1;
//■バイオリズム(法人)の料金------------------------------------------------------
var g_biorhythm_corporate_price = 8900;
//■会社設立日の料金--------------------------------------------------------------
var g_establish_appraise_type_price_standard = 3900;//標準鑑定
var g_establish_appraise_type_price_easy = 1400;//簡易鑑定
//■選名(社名)の料金--------------------------------------------------------------
var g_company_name_price = 29000;
//■方位の料金--------------------------------------------------------------------
var g_bearing_price = 5900;
//■手相の料金--------------------------------------------------------------------
var g_palmistry_price = 4900;
//■人相の料金--------------------------------------------------------------------
var g_physiognomy_price = 4900;
//■メール相談の料金--------------------------------------------------------------
var g_mail_consult_price = 3900;
//■電話相談の料金----------------------------------------------------------------
var g_tel_consult_price = 3900;//30分毎
var g_tel_consult_time = 30;//30分
//■出張鑑定の料金----------------------------------------------------------------
var g_trip_appraise_price = 4900;//1人
var g_trip_appraise_price_add = '交通費';
//■動物占いの料金--------------------------------------------------------------------
var g_pet_price = 4900;
//■鑑定結果のお知らせ方法の料金--------------------------------------------------
var g_deliver_price_mail = 0;//メール
var g_deliver_price_post = 500;//郵送
//■オプションの料金--------------------------------------------------------------
var g_option_price_data = 1500;//テキストデータ化オプション


//add start 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加
//今までのバイオリズム(個人)、バイオリズム(法人)は、標準鑑定(個人)、標準鑑定(法人)に変更する。→【注意】ソース上の変数名、コメントは変更しないので、読み替えること。
//以下の料金がバイオリズム(個人)、バイオリズム(法人)の料金となる。

//■【オプション】バイオリズム鑑定(個人)の料金------------------------------------------------------
var g_option_biorhythm_personal_price = 4900;
//■【オプション】バイオリズム鑑定(法人)の料金------------------------------------------------------
var g_option_biorhythm_corporate_price = 4900;
//add end 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加


//サービスのマスタID(添え字)と対応するid(値)
var g_idList = new Array();
g_idList['1'] = 'biorhythm_personal';
g_idList['2'] = 'biorhythm_corporate';
g_idList['3'] = 'establish';
g_idList['4'] = 'company_name';
g_idList['5'] = 'bearing';
g_idList['6'] = 'palmistry';
g_idList['7'] = 'physiognomy';
g_idList['8'] = 'mail_consult';
g_idList['9'] = 'tel_consult';
g_idList['10'] = 'trip_appraise';
g_idList['11'] = 'pet';


/**
 * [初期設定(入力画面用)]
 * チェックボックスのON/OFFによって、ノードを表示・非表示する。
 *
 * @param   string	フォーム名
 * @param   string	チェックボックス名
 * @param   boolean	鑑定料金集計フラグ{true:集計する/false:集計しない}
 *
 * @return  boolean
 */
function init4input(formName, checkboxName, totalFlag) {

	if (typeof(document.forms[formName]) == 'undefined') {
		alert('フォーム名 = "'+formName+'"が不正です。');
		return false;
	}

	if (typeof(document.forms[formName].elements[checkboxName]) == 'undefined') {
		alert('チェックボックス名 = "'+checkboxName+'"が不正です。');
		return false;
	}

	var checkboxes = document.forms[formName].elements[checkboxName];
    var checkboxesCount  = (typeof(checkboxes.length) != 'undefined')?checkboxes.length:0;
    if (checkboxesCount) {
        for (var i = 0; i < checkboxesCount; i++) {
			//alert('checkboxes[i].checked='+checkboxes[i].checked+'/checkboxes[i].value='+checkboxes[i].value);
        	showNode(checkboxes[i].checked, g_idList[checkboxes[i].value]);
        }
    } else {
        if (checkboxes.checked  == true) {
        }
    }

	//鑑定料金を集計する。
	g_total_price_falg = totalFlag;
	totalPrice('init4input');
}



window.document.onchange = function () {totalPrice('onchange');}
window.document.onkeypress = function () {totalPrice('onkeypress');}
window.document.onkeydown = function () {totalPrice('onkeydown');}
window.document.onselect = function () {totalPrice('onselect');}
window.document.onclick = function () {totalPrice('onclick');}
window.document.onmousedown = function () {totalPrice('onmousedown');}

function totalPrice(val) {

	if (!g_total_price_falg) return;

	if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML = '';

	var total = 0;


	//希望のサービスの選択状態をチェックする。
	var serviceCheckboxes = document.forms['frmRequest'].elements['service_id[]'];
	var serviceCheckboxesCount  = (typeof(serviceCheckboxes.length) != 'undefined')?serviceCheckboxes.length:0;
    if (serviceCheckboxesCount) {
        for (var i = 0; i < serviceCheckboxesCount; i++) {
        	//チェックONの場合
        	if (serviceCheckboxes[i].checked == true) {
        		var serviceValue = serviceCheckboxes[i].value;
        		serviceValue += '';
				switch (serviceValue) {
					case '1':
						//バイオリズム(個人)

						//■バイオリズム(個人)の料金------------------------------------------------------

						//バイオリズム(個人)の人数を取得する。
						var count = countBiorhythmPersonalObject();
						//合計は？
						var totalBiorhythmPersonal = g_biorhythm_personal_price * count;

						total += totalBiorhythmPersonal;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />バイオリズム(個人):'+totalBiorhythmPersonal+'円='+g_biorhythm_personal_price+'円*'+count+'人';


						//■バイオリズムオプションの料金--------------------------------------------------

						//バイオリズムオプションの人数を取得する。
						var count = countBiorhythmCompatibilityObject();
						var countBase = 0;
						var countAdd = 0;
						if (count == 0) {
						} else if (count <= g_biorhythm_personal_option_num) {
							countBase = count;
						} else {
							countBase = g_biorhythm_personal_option_num;
							countAdd = count - g_biorhythm_personal_option_num;
						}
						//合計は？
						var totalBiorhythmCompatibility = 0;
						if (countBase == 0) {

						} else {
							totalBiorhythmCompatibility = g_biorhythm_personal_option_price;
							totalBiorhythmCompatibility += g_biorhythm_personal_option_add_price * countAdd;
						}

						total += totalBiorhythmCompatibility;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />バイオリズムオプション:'+totalBiorhythmCompatibility+'円='+(countBase==0?0:g_biorhythm_personal_option_price)+'円['+countBase+'人]+('+g_biorhythm_personal_option_add_price+'円*'+countAdd+'人)';

						
						//add start 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加
						//■【オプション】バイオリズム鑑定(個人)の料金------------------------------------------------------
						var bpValue = '';
						var bpCheckboxes = document.forms['frmRequest'].elements['biorhythm_personal_id[]'];
						var checkboxesCount  = (typeof(bpCheckboxes.length) != 'undefined')?bpCheckboxes.length:0;
						if (checkboxesCount) {
						    for (var bpIdx = 0; bpIdx < checkboxesCount; bpIdx++) {
						    	if (bpCheckboxes[dlIdx].checked == true) {
									bpValue = bpCheckboxes[bpIdx].value;
					
									var option_price = 0;
									var option_name = '';
									switch (bpValue) {
										case '1':
											//バイオリズム鑑定を依頼 
											option_price = g_option_biorhythm_personal_price;
											option_name = 'バイオリズム鑑定を依頼 '
											break;
									}
					
									//合計は？
									var totalOption = option_price;
					
									total += totalOption;
					
									if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(個人):'+totalOption+'円='+option_name;
					
						    	}
						    }
					
						} else {
					    	if (bpCheckboxes.checked == true) {
								bpValue = bpCheckboxes.value;
					
								var option_price = 0;
								var option_name = '';
								switch (bpValue) {
									case '1':
										//バイオリズム鑑定を依頼 
										option_price = g_option_biorhythm_personal_price;
										option_name = 'バイオリズム鑑定を依頼 '
										break;
								}
					
								//合計は？
								var totalOption = option_price;
					
								total += totalOption;
					
								if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(個人):'+totalOption+'円='+option_name;
					
					    	}
					
						}
						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(個人):checkboxesCount='+checkboxesCount;
						//add end 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加

						
						
						break;

					case '2':
						//バイオリズム(法人)

						//■バイオリズム(法人)の料金------------------------------------------------------

						//バイオリズム(法人)の人数を取得する。
						var count = 1;

						//合計は？
						var totalBiorhythmCorporate = g_biorhythm_corporate_price * count;

						total += totalBiorhythmCorporate;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />バイオリズム(法人):'+totalBiorhythmCorporate+'円='+g_biorhythm_corporate_price+'円*'+count+'社';

						
						//add start 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加
						//■【オプション】バイオリズム鑑定(法人)の料金------------------------------------------------------
						var bcValue = '';
						var bcCheckboxes = document.forms['frmRequest'].elements['biorhythm_corporate_id[]'];
						var checkboxesCount  = (typeof(bcCheckboxes.length) != 'undefined')?bcCheckboxes.length:0;
						if (checkboxesCount) {
						    for (var bcIdx = 0; bcIdx < checkboxesCount; bcIdx++) {
						    	if (bcCheckboxes[dlIdx].checked == true) {
									bcValue = bcCheckboxes[bcIdx].value;
					
									var option_price = 0;
									var option_name = '';
									switch (bcValue) {
										case '1':
											//バイオリズム鑑定を依頼 
											option_price = g_option_biorhythm_corporate_price;
											option_name = 'バイオリズム鑑定を依頼 '
											break;
									}
					
									//合計は？
									var totalOption = option_price;
					
									total += totalOption;
					
									if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(法人):'+totalOption+'円='+option_name;
					
						    	}
						    }
					
						} else {
					    	if (bcCheckboxes.checked == true) {
								bcValue = bcCheckboxes.value;
					
								var option_price = 0;
								var option_name = '';
								switch (bcValue) {
									case '1':
										//バイオリズム鑑定を依頼 
										option_price = g_option_biorhythm_corporate_price;
										option_name = 'バイオリズム鑑定を依頼 '
										break;
								}
					
								//合計は？
								var totalOption = option_price;
					
								total += totalOption;
					
								if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(法人):'+totalOption+'円='+option_name;
					
					    	}
					
						}
						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />【オプション】バイオリズム鑑定(法人):checkboxesCount='+checkboxesCount;
						//add end 2008/04/19 d.ishikawa 標準鑑定(個人・法人)追加
						
						break;

					case '3':
						//会社設立日

						//■会社設立日の料金--------------------------------------------------------------

						//「鑑定の種類」で選択された値を取得する。
						var eatRadios = document.forms['frmRequest'].elements['establish_appraise_type_id'];
						var radiosCount  = (typeof(eatRadios.length) != 'undefined')?eatRadios.length:0;
						var eatValue = '';
						for (var eatIdx = 0; eatIdx < radiosCount; eatIdx++) {
							if (eatRadios[eatIdx].checked == true) {
								eatValue = eatRadios[eatIdx].value;
							}
						}
						//新★会社設立.JPにて会社設立される予定か？
						var establish_plan_falg = false;
						var epCheckboxes = document.forms['frmRequest'].elements['establish_plan_id[]'];
						var checkboxesCount  = (typeof(epCheckboxes.length) != 'undefined')?epCheckboxes.length:0;
						if (checkboxesCount) {
					        for (var epIdx = 0; epIdx < checkboxesCount; epIdx++) {
					        	if (epCheckboxes[epIdx].checked == true) {
					        		establish_plan_falg = true;
					        	}
					        }
						} else {
				        	if (epCheckboxes.checked == true) {
				        		establish_plan_falg = true;
				        	}
						}

						//合計は？
						var establish_appraise_type_price = 0;
						var establish_appraise_type_name = '';
						var establish_plan_name = ''
						switch (eatValue) {
							case '1':
								//標準鑑定
								establish_appraise_type_price = g_establish_appraise_type_price_standard;
								establish_appraise_type_name = '標準鑑定';
								break;
							case '2':
								//簡易鑑定
								establish_appraise_type_price = g_establish_appraise_type_price_easy;
								establish_appraise_type_name = '簡易鑑定';

								//新★会社設立.JPにて会社設立される方は簡易鑑定は無料
								if (establish_plan_falg) {
									establish_appraise_type_price = 0;
								}
								break;
						}

						if (establish_plan_falg) {
							establish_plan_name = '新★会社設立.JPにて会社設立される方は簡易鑑定は無料';
						}

						total += establish_appraise_type_price;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />会社設立日:'+establish_appraise_type_price+'円='+establish_appraise_type_name+(establish_plan_falg?'('+establish_plan_name+')':'');

						break;

					case '4':
						//選名(社名)

						//■選名(社名)の料金--------------------------------------------------------------

						//社名の社数を取得する。
						var count = 1;

						//合計は？
						var totalCompanyName = g_company_name_price * count;

						total += totalCompanyName;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />選名(社名):'+totalCompanyName+'円='+g_company_name_price+'円*'+count+'社';


						break;

					case '5':
						//方位

						//■方位の料金--------------------------------------------------------------------

						//方位の鑑定数を取得する。
						var count = countBearingt();

						//合計は？
						var totalBearing = g_bearing_price * count;

						total += totalBearing;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />方位:'+totalBearing+'円='+g_bearing_price+'円*'+count+'鑑定';


						break;

					case '6':
						//手相

						//■手相の料金--------------------------------------------------------------------

						//手相の鑑定数を取得する。
						var count = 1;

						//合計は？
						var totalPalmistry = g_palmistry_price * count;

						total += totalPalmistry;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />手相:'+totalPalmistry+'円='+g_palmistry_price+'円*'+count+'鑑定';


						break;

					case '7':
						//人相

						//■人相の料金--------------------------------------------------------------------

						//人相の鑑定数を取得する。
						var count = 1;

						//合計は？
						var totalPhysiognomy = g_physiognomy_price * count;

						total += totalPhysiognomy;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />人相:'+totalPhysiognomy+'円='+g_physiognomy_price+'円*'+count+'鑑定';


						break;

					case '8':
						//メール相談

						//■メール相談の料金--------------------------------------------------------------

						//メール相談の鑑定数を取得する。
						var count = 1;

						//合計は？
						var totalMailConsult = g_mail_consult_price * count;

						total += totalMailConsult;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />メール相談:'+totalMailConsult+'円='+g_mail_consult_price+'円*'+count+'メール';


						break;

					case '9':
						//電話相談

						//■電話相談の料金----------------------------------------------------------------

						//電話相談の時間(分)を取得する。
						var count = countTelConsultTime();

						//合計は？
						var totalTelConsult = g_tel_consult_price * (count / g_tel_consult_time);

						total += totalTelConsult;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />電話相談:'+totalTelConsult+'円='+g_tel_consult_price+'円/'+g_tel_consult_time+'分*'+count+'分';


						break;

					case '10':
						//出張鑑定

						//■出張鑑定の料金----------------------------------------------------------------

						//出張鑑定の人数を取得する。
						var count = countTripNum();

						//合計は？
						var totalTripAppraise = g_trip_appraise_price * count;

						total += totalTripAppraise;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />出張鑑定:'+totalTripAppraise+'円='+g_trip_appraise_price+'円*'+count+'人+'+g_trip_appraise_price_add;


						break;

					case '11':
						//動物占い

						//■動物占いの料金----------------------------------------------------------------

						//動物占いの鑑定数を取得する。
						var count = 1;

						//合計は？
						var totalPet = g_pet_price * count;

						total += totalPet;

						if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />動物占い:'+totalPet+'円='+g_pet_price+'円*'+count+'匹';


						break;
						
				}
        	}

        }
    } else {
        if (serviceCheckboxes.checked  == true) {
        }
    }


	//■鑑定結果のお知らせ方法の料金--------------------------------------------------

	var dlValue = '';
	var dlCheckboxes = document.forms['frmRequest'].elements['deliver_id[]'];
	var checkboxesCount  = (typeof(dlCheckboxes.length) != 'undefined')?dlCheckboxes.length:0;
	if (checkboxesCount) {
	    for (var dlIdx = 0; dlIdx < checkboxesCount; dlIdx++) {
	    	if (dlCheckboxes[dlIdx].checked == true) {
				dlValue = dlCheckboxes[dlIdx].value;

				var deliver_price = 0;
				var deliver_name = '';
				switch (dlValue) {
					case '1':
						//メール
						deliver_price = g_deliver_price_mail;
						deliver_name = 'メール'
						break;
					case '2':
						//郵送
						deliver_price = g_deliver_price_post;
						deliver_name = '郵送'
						break;
				}

				//合計は？
				var totalDeliver = deliver_price;

				total += totalDeliver;

				if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />鑑定結果のお知らせ方法:'+totalDeliver+'円='+deliver_name;

	    	}
	    }

	} else {
    	if (dlCheckboxes.checked == true) {
			dlValue = dlCheckboxes.value;

			var deliver_price = 0;
			var deliver_name = '';
			switch (dlValue) {
				case '1':
					//メール
					deliver_price = g_deliver_price_mail;
					deliver_name = 'メール'
					break;
				case '2':
					//郵送
					deliver_price = g_deliver_price_post;
					deliver_name = '郵送'
					break;
			}

			//合計は？
			var totalDeliver = deliver_price;

			total += totalDeliver;

			if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />鑑定結果のお知らせ方法:'+totalDeliver+'円='+deliver_name;

    	}
	}


	//■オプションの料金--------------------------------------------------------------

	var opValue = '';
	var opCheckboxes = document.forms['frmRequest'].elements['option_id[]'];
	var checkboxesCount  = (typeof(opCheckboxes.length) != 'undefined')?opCheckboxes.length:0;
	if (checkboxesCount) {
	    for (var opIdx = 0; opIdx < checkboxesCount; opIdx++) {
	    	if (opCheckboxes[dlIdx].checked == true) {
				opValue = opCheckboxes[opIdx].value;

				var option_price = 0;
				var option_name = '';
				switch (opValue) {
					case '1':
						//メール
						option_price = g_option_price_data;
						option_name = 'テキストデータ化オプション'
						break;
				}

				//合計は？
				var totalOption = option_price;

				total += totalOption;

				if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />オプション:'+totalOption+'円='+option_name;

	    	}
	    }

	} else {
    	if (opCheckboxes.checked == true) {
			opValue = opCheckboxes.value;

			var option_price = 0;
			var option_name = '';
			switch (opValue) {
				case '1':
					//メール
					option_price = g_option_price_data;
					option_name = 'テキストデータ化オプション'
					break;
			}

			//合計は？
			var totalOption = option_price;

			total += totalOption;

			if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />オプション:'+totalOption+'円='+option_name;

    	}

	}
	if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />オプション:checkboxesCount='+checkboxesCount;


	if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />合計='+total+' / ('+val+')';


	//鑑定料金をフォーマットして表示する。
	var showTotal = '';

	if (total > 0) {
		var re = new RegExp('([0-9]+)([0-9]+[0-9]+[0-9]+)');
		showTotal = total.toString();
		while (re.test(showTotal)) {
			showTotal = showTotal.replace(re, '$1,$2');
		}
		showTotal = '￥ '+showTotal;
	}
	showTotal += '<input type="hidden" name="appraise_price" value="'+total+'" />';
	document.getElementById('appraise_price_label').innerHTML = showTotal;

}

/**
 * バイオリズム(個人)の人数を取得する。
 *
 * @return  int
 */
function countBiorhythmPersonalObject() {
	var count = 0;

	//親ノードを取得する。
	var parent = document.getElementById('personalObject');

	//Div子ノードのを取得する。
	var divChildren = parent.getElementsByTagName('div');
	var l = divChildren.length;
	for (var i = 0; i < l; i++) {
		//子ノードを取得する。
		var divChild = divChildren[i];

		//select要素の入力有無を確認する。
		var slFlag = true;
		var select = divChild.getElementsByTagName('select');
		for (var slIdx = 0; slIdx < select.length; slIdx++) {
			if (select[slIdx].value == '') {
				slFlag = false;
			} else {

			}
		}
		//input要素の入力有無を確認する。
		var inFlag = true;
		var input = divChild.getElementsByTagName('input');
		for (var inIdx = 0; inIdx < input.length; inIdx++) {
			if (input[inIdx].value == '') {
				inFlag = false;
			} else {

			}
		}

		if (slFlag && inFlag) {
			count++;
		}
	}

	return count;

}

/**
 * バイオリズムオプションの人数を取得する。
 *
 * @return  int
 */
function countBiorhythmCompatibilityObject() {
	var count = 0;

	//親ノードを取得する。
	var parent = document.getElementById('compatibilityObject');

	//Div子ノードのを取得する。
	var divChildren = parent.getElementsByTagName('div');
	var l = divChildren.length;
	for (var i = 0; i < l; i++) {
		//子ノードを取得する。
		var divChild = divChildren[i];

		//select要素の入力有無を確認する。
		var slFlag = true;
		var select = divChild.getElementsByTagName('select');
		for (var slIdx = 0; slIdx < select.length; slIdx++) {
			if (select[slIdx].value == '') {
				slFlag = false;
			} else {

			}
		}
		//input要素の入力有無を確認する。
		var inFlag = true;
		var input = divChild.getElementsByTagName('input');
		for (var inIdx = 0; inIdx < input.length; inIdx++) {
			if (input[inIdx].value == '') {
				inFlag = false;
			} else {

			}
		}

		if (slFlag && inFlag) {
			count++;
		}
	}

	return count;

}

/**
 * 方位の鑑定数を取得する。
 *
 * @return  int
 */
function countBearingt() {
	var count = 0;

	var batCheckboxes = document.forms['frmRequest'].elements['bearing_appraise_type_id[]'];
	var checkboxesCount  = (typeof(batCheckboxes.length) != 'undefined')?batCheckboxes.length:0;
	if (checkboxesCount) {
	    for (var batIdx = 0; batIdx < checkboxesCount; batIdx++) {
	    	if (batCheckboxes[batIdx].checked == true) {
				count++;
	    	}
	    }
	} else {
		if (batCheckboxes.checked == true) {
			count++;
		}
	}

	return count;

}


/**
 * 電話相談の時間(分)を取得する。
 *
 * @return  int
 */
function countTelConsultTime() {
	var count = 0;

	var tctSelect = document.forms['frmRequest'].elements['tel_consult_time_id'];
	var l = tctSelect.options.length;
	var value = '';
	var label = '';
	for (var i = 0; i < l; i++) {
		if (tctSelect.options[i].selected) {
			value = tctSelect.options[i].value;
			label = tctSelect.options[i].label;
			if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />電話相談の時間(分):value='+value+'/label='+label;
			break;
		}
	}
	if (value != '') {
		count = label;
	}

	return count;

}


/**
 * 出張鑑定の鑑定人数を取得する。
 *
 * @return  int
 */
function countTripNum() {
	var count = 0;

	var tnSelect = document.forms['frmRequest'].elements['trip_num_id'];
	var l = tnSelect.options.length;
	var value = '';
	var label = '';
	var num = '';
	for (var i = 0; i < l; i++) {
		if (tnSelect.options[i].selected) {
			value = tnSelect.options[i].value;
			label = tnSelect.options[i].label;
			num = label.replace(/[^0-9]/g, '');//NN名、NN名以上のNN以外を削除して、数字のみを取得する。
			if (g_uranai_debug) document.getElementById(g_uranai_debug_id).innerHTML += '\n<br />出張鑑定の鑑定人数:value='+value+'/label='+label+'/num='+num;
			break;
		}
	}
	if (value != '') {
		count = num;
	}

	return count;

}

