function setYears_at_company(val){
	document.virtualexamine.years_at_company_rslt.value=val;
}


function checkEmail() {
	if (document.registration_form.email_check.value!="" && document.registration_form.email.value!=""){
		if (document.registration_form.email_check.value==document.registration_form.email.value)
			document.registration_form.email_img.style.display="inline";
		else
			document.registration_form.email_img.style.display="none";
	}else{
		document.registration_form.email_img.style.display="none";
	}
}

function checkMobileEmail() {
	if (document.registration_form.mobile_email_check.value!="" && document.registration_form.mobile_email.value!=""){
		if (document.registration_form.mobile_email_check.value==document.registration_form.mobile_email.value)
			 document.registration_form.mobile_email_img.style.display="inline";
		else
			document.registration_form.mobile_email_img.style.display="none";
	}else{
		document.registration_form.mobile_email_img.style.display="none";
	}
}


function checkPass() {
	if (document.registration_form.password.value!="" && document.registration_form.password2.value!=""){
		if (document.registration_form.password.value==document.registration_form.password2.value)
			 document.registration_form.pass_img.style.display="inline";
		else
			document.registration_form.pass_img.style.display="none";

	}else{
		document.registration_form.pass_img.style.display="none";
	}
}

/**
 * Intにキャスト
 */
function Int(val){
	return new Number(isNaN(val) ? 0 : val);
}

/**
 * ダブル型で表示
 */
function Double(val){
	var ss2,ss3,ss4;
	if (val == ""){
		return "0.00";
	} else {
		if(isNaN(val))
			return "0.00";　

		ss4 = Math.floor((val)*100);

		//小数点以下第２位を算出
		ss3 = ss4 - Math.floor(ss4/10)*10;

		//小数点以下第１位を算出
	ss2 = Math.floor(ss4/10) - Math.floor(ss4/100)*10;
	return  Math.floor(ss4/100) + "." + ss2 + ss3;
	}
}

/**
 * 桁区切り
 */
function nuberFormat(str) {
	var num = new String(str).replace(/,/g, "");
	while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
	return num;
}

/**------------------------------------------------------------------------
 * フォームのサブミット
 */

/**
 * 仮登録確認ページリンク
 */
function registComfirm(){
	document.registration_form.submit();
}

/**
 * 仮審査確認ページリンク
 */
function goVirtualexamineRslt(){
	document.virtualexamine.submit();
}

/**
 * ボロワー申請1ページリンク
 */
function goBorrower1(){
	document.borrower0.submit();
}

/**
 * ボロワー申請2ページリンク
 */
function goBorrower2(){
	document.borrower1.submit();
}

/**
 * ボロワー申請3ページリンク
 */
function goBorrower3(){
	document.borrower2.submit();
}

/**
 * ボロワー申請4ページリンク(確認画面へ)
 */
function goBorrower4(){
	document.borrower3.submit();
}

/**
 * レンダー申請1ページリンク(利用規約画面へ)
 */
function goLender1(){
	document.lenderForm0.submit();
}

/**
 * レンダー申請2ページリンク(個人情報入力1)
 */
function goLender2(){
	document.lenderForm1.submit();
}

/**
 * レンダー申請3ページリンク(申請情報入力)
 */
function goLender3(){
	document.lenderForm2.submit();
}

/**
 * レンダー申請4ページリンク(確認ページへ)
 */
function goLender4(){
	document.lenderForm3.submit();
}

/**
 * 募集ローン作成画面(maneo,g-loan共通)
 */
function registAuction(form,param){
	var form = form;
	if(param==1)
		form.save.value="save";
	form.submit();
}

function editAuction(form){
	form.action = "/apl/auction/release/edit";
	form.submit();
}

/**
 * メルマガ登録リンク
 */
function registMailMagazine(){
	document.registration_form.submit();
}

/**
 * 入札
 */
function bid(){
	document.bid_form.submit();
}

editAuction
/**------------------------------------------------------------------------
 * 利用規約のサブミット
 */

/**
 * ボロワー登録利用規約同意
 */
function agreementBorrower(){
	if(document.risk_exp.risk_exp_terms.checked!=true){
		$("#risk_exp_terms_error_block").html("");
		$("#risk_exp_terms_error_block").html("<p id=\"risk_exp_terms_error\">個人情報保護方針に同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		return false;
	}else{
		document.risk_exp.submit();
	}

}

/**
 * レンダーリスク利用規約同意
 */
function agreementLender(){
	if(document.risk_exp.risk_exp_terms.checked!=true){
		$("#risk_exp_terms_error_block").html("");
		$("#risk_exp_terms_error_block").html("<p id=\"risk_exp_terms_error\">レンダーリスクについて同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		return false;
	}else{
		document.risk_exp.submit();
	}
}

/**
 * レンダー登録利用規約同意
 */
function agreementLender2(){
	if(document.risk_exp.risk_exp_terms.checked!=true){
		$("#risk_exp_terms_error_block").html("");
		$("#risk_exp_terms_error_block").html("<p id=\"risk_exp_terms_error\">個人情報保護方針に同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		return false;
	}else{
		document.risk_exp.submit();
	}
}

/**
 * レンダーリスク利用規約同意
 */
function agreementLender2(){
	if(document.risk_exp.risk_exp_terms.checked!=true){
		$("#risk_exp_terms_error_block").html("");
		$("#risk_exp_terms_error_block").html("<p id=\"risk_exp_terms_error\">レンダーリスクについて同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		return false;
	}else{
		document.risk_exp.submit();
	}
}

/**
 * レンダー申請PDF同意/レンダー申請情報の取り扱いに関する同意
 */
function agreementLender3(){

	var ret1=true;
	var ret2=true;

	if(document.lenderForm.risk_exp_terms1.checked!=true){
		$("#agree_check_box_error").html("");
		$("#agree_check_box_error").html("<p id=\"risk_exp_terms_error1\">PDFダウンロードによる書面交付について同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		ret1 = false;
	}else{
		$("#agree_check_box_error").html("");
	}

	if(document.lenderForm.risk_exp_terms2.checked!=true){
		$("#agree_check_box_error2").html("");
		$("#agree_check_box_error2").html("<p id=\"risk_exp_terms_error2\">レンダー申請情報の取り扱いに関して同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		ret2 = false;
	}else{
		$("#agree_check_box2_error").html("");
	}
	if(ret1 && ret2)
		document.lenderForm.submit();
	else
		return false;
}

/**
 * ボロワー申請PDF同意/ボロワー申請情報の取り扱いに関する同意
 */

function agreementBorrower3(){

	var ret1=true;
	var ret2=true;

	if(document.borrowerForm.risk_exp_terms1.checked!=true){
		$("#agree_check_box_error").html("");
		$("#agree_check_box_error").html("<p id=\"risk_exp_terms_error1\">PDFダウンロードによる書面交付について同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「ボロワー申請」ボタンを押してください。</p>");
		ret1 = false;
	}else{
		$("#agree_check_box_error").html("");
	}

	/*if(document.borrowerForm.risk_exp_terms2.checked!=true){
		$("#agree_check_box_error2").html("");
		$("#agree_check_box_error2").html("<p id=\"risk_exp_terms_error2\">ボロワー申請情報の取り扱いに関して同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「ボロワー申請」ボタンを押してください。</p>");
		ret2 = false;
	}else{
		$("#agree_check_box2_error").html("");
	}*/
	if(ret1 && ret2){
		document.borrowerForm.submit();
	}else{
		return false;
	}
}

/**
 * g-loan利用規約同意
 */
function agreementRegistAuction(form){
	if(form.risk_exp_terms.checked!=true){
		$("#risk_exp_terms_error_block").html("");
		$("#risk_exp_terms_error_block").html("<p id=\"risk_exp_terms_error\">G-Loan&nbsp;個人情報保護方針に同意していただく必要があります。<br />「以上の記載内容を読み、その内容について了承いたします。」にチェックを入れ、<br/>再度「同意して申請入力へ」ボタンを押してください。</p>");
		return false;
	}else{
		form.submit();
	}
}

/**
 * 出向元出力切替
 */
function changeParentInput(){
	$("#parent_company_flag_dummy").click(function () {
		if(document.borrower2.parent_company_flag_dummy.checked==true){
			$("#parent_company_flag").val(1);
			$("#parent_company_block").show(100);

		}else{
			$("#parent_company_block").hide(100);
			$("#parent_company_flag").val(0);
			$("#parent_company_block input,#parent_company_block select").val("");
			$("#parent_company_block input,#parent_company_block select").removeClass("error");
		}
		sendRealForm('borrowerRegist');
	});

}

/**------------------------------------------------------------------------
 * 画面制御関連
 */

function inpCtl(id,type){
	if(type==false){
		$(id).attr("readOnly", true);
		$(id).val("").css("background","#dfdfdf");
	}else{
		$(id).removeAttr("readOnly").css("background","#ffffff");
		if($(id).val()==0){
			$(id).val("0");
		}
	}
}

/**
 * maneoID登録チェック
 */
function registCheck(){
	$("#maneoid").html("");
	if(document.registration_form.username.value!=""){

		$.ajax({
			type: "post",
			url: "/apl/regist/temporary/idcheck",
			data: "username="+document.registration_form.username.value ,
			dataType: "json",
			cache : false,
			success:function(json){
				//alert(json.rslt);
				if(json.rslt==0){
					$("#maneoid").removeClass("msg_error").addClass("msg_ok").append('<p id="errors_id">このmaneo&nbsp;IDはご利用できます。</p>');
				}else{
					$("#maneoid").removeClass("msg_ok").addClass("msg_error").append('<p id="errors_id">入力されたmaneo IDは既に登録されております。他のmaneo&nbsp;IDを入力してください。</p>');
				}
			},
		 	error:function(){
		 		$("#maneoid").append('<div class="msg_error"><p style="color:red" id="errors_id">入力されたmaneo&nbsp;IDは既に登録されております。他のmaneo&nbsp;IDを入力してください。</p></div>');
		 	}
	 	});
	 }else{
	 	$("#maneoid").append('<li class="msg_error"><p id="errors_id">maneo&nbsp;IDを入力してください。</p></li>');
	 }
}

/**
 * 秘密の質問チェック
 */
function secretQuestionCheck(){
	$("#maneoid").html("");
	$.ajax({
		type: "post",
		url: "/apl/ajax/secretquestioncheck",
		data: "secret_question="+document.secret_question_form.secret_question.value+"&secret_answer="+document.secret_question_form.secret_answer.value+"&u_id="+document.secret_question_form.u_id.value ,
		dataType: "json",
		cache : false,
		success:function(json){
//			$("#secretBox").html("登録が完了しました。");

//alert(json.id);
			if(json.check == true){
				$("#secretBox").html('<span style="padding:4px;background:#E9F4C8;color:#009900;font-weight:bold;">秘密の質問の登録が完了しました。</span>');
			}else{
				$("#secret_question_msg").removeClass("msg_error").empty();
				if(json.secret_q_check==false){
					$("#secret_question_msg").addClass("msg_error").append('<p id="errors_id">'+json.secret_q_msg+'</p>');
				}

				$("#secret_answer_msg").removeClass("msg_error").empty();
				if(json.secret_a_check==false){
					$("#secret_answer_msg").addClass("msg_error").append('<p id="errors_id">'+json.secret_a_msg+'</p>');
				}
			}
		},
	 	error:function(){
	 		$("#maneoid").append('<div class="msg_error"><p style="color:red" id="errors_id">入力されたmaneo&nbsp;IDは既に登録されております。他のmaneo&nbsp;IDを入力してください。</p></div>');
	 	}
 	});
}

/**
 * 保険選択時の切替
 */
function setWorkBlock(id){
	if(id==1 || id==2){
		$("#work2").hide();
		$("#work3").hide();
		$("#work1,#work0").show(100);
	}else if(id==3 || id==4){
		$("#work1").hide();
		$("#work3").hide();
		$("#work2,#work0").show(100);
	}else{
		$("#work1,#work0").hide(100);
		$("#work2").hide();
		$("#work3").hide();
	}
}

/**
 * 前年度年収選択時の切替
 */
var setIncomeTypeBlockStatus=0;
function setIncomeTypeBlock(id){
	if(id==1){
		$("#incomeType01").show();
		$("#incomeType02,#incomeType03,#incomeType04").hide();
		$("#incomeType02 input, #incomeType03 input, #incomeType04 input").val(0);

	}else if(id==2){
		$("#incomeType02,#incomeType03,#incomeType04").show();
		$("#incomeType01").hide();
		$("#incomeType01 input").val(0);

	}else if(id==3){
		$("#incomeType02,#incomeType03").show();
		$("#incomeType01,#incomeType04").hide();
		$("#incomeType01 input,#incomeType04 input").val(0);

	}else{
		$("#incomeType01,#incomeType02,#incomeType03,#incomeType04").hide();
		$("#incomeType01 INPUT,#incomeType02 INPUT,#incomeType03 INPUT,#incomeType04 INPUT").val(0);
	}
}

/**
 * 前年度年収の自動計算用
 */
function incomeCalc(){
	var ret1  = Int($("#income_salary1").val()) + Int($("#income_pay_slip_last_month1").val()) + Int($("#income_pay_slip_month_before_last1").val()) + Int($("#income_bonus1").val());
	var ret2  = Int($("#income_salary2").val()) + Int($("#income_pay_slip_last_month2").val()) + Int($("#income_pay_slip_month_before_last2").val()) + Int($("#income_bonus2").val());
	incomeCalcLogic();
	//$("#incomeCalc")
	//	.html( nuberFormat((ret1*10000) + (ret2*1000)) + "&nbsp;円" );
}

/**
 *　前年度年収の自動計算用
 */
function incomeCalcLogic(){

	var option = $("#income_calc_type_id").children('option:selected').val();
	var income_salary =
		(Int($("#income_salary1").val()) * 10000) + (Int( $("#income_salary2").val()) * 1000);
	var income_pay_slip_last_month =
		(Int($("#income_pay_slip_last_month1").val()) * 10000) + (Int( $("#income_pay_slip_last_month2").val()) * 1000);
	var income_pay_slip_month_before_last =
		(Int($("#income_pay_slip_month_before_last1").val()) * 10000) + (Int($("#income_pay_slip_month_before_last2").val()) * 1000);
	var	income_bonus =
		(Int($("#income_bonus1").val()) * 10000) + (Int($("#income_bonus2").val()) * 1000);

	var rslt = 0;

	if (option==1) {
		rslt = 	income_salary;

	} else if(option==2) {
		rslt = ((income_pay_slip_month_before_last + income_pay_slip_last_month) / 2) * 12 + (income_bonus * 2);


	} else if(option==3) {
		rslt = ((income_pay_slip_month_before_last + income_pay_slip_last_month) / 2) * 12;
	}

	if(rslt > 0){

		var total_man =parseInt(rslt / 10000);
		var total_sen = (rslt % 10000) / 1000;

		$("#income1").val(total_man);
		$("#income2").val(total_sen);

		if(total_man > 0){
			total_man = total_man + "&nbsp;万&nbsp;"
		}else{
			total_man="";
		}

		total_sen = total_sen + "&nbsp;千"

		$("#incomeCalc")
			.html(total_man + total_sen + "円" );

		$("#incomeTotalData").val(rslt);
		//alert(rslt);

	}else{
			$("#incomeCalc").html("0&nbsp;円" );
			$("#incomeTotalData").val(rslt);
	}
}


function incomeCalcZero(){
	$("#incomeCalc").html("0&nbsp;円" );
	$("#income_salary1,#income_salary2,#income_pay_slip_last_month1,#income_pay_slip_last_month2,#income_pay_slip_month_before_last1,#income_pay_slip_month_before_last2,#income_bonus1,#income_bonus2").val("0");
}

function auctionUP(maxStartPrice,aucType){
	$("#startprice")
		.blur(function(){
			var st =Int($(this).val());
			var min =Int($("#rpvalue").val());

			if(maxStartPrice < st){
				alert("借入希望金額は、最大"+ maxStartPrice +"万円以下の金額になります。");
				$(this).val(maxStartPrice);
				$("#rpvalue").val(Math.ceil(maxStartPrice*0.8));
				return;

			}

			if(10 > st){
				alert("借入希望金額は、10万円以上の金額になります。");
				$(this).val(10);
			}

			if(13 > st){
				$("#rpvalue").val(10);

			}else{
				$("#rpvalue").val(Math.ceil(st*0.8));
			}

		});

	if(aucType=="std"){
		$("#rpvalue").blur(function(){

			if(isNaN($(this).val())){
				alert("半角数字で入力してください。");
				$(this).val(10);
				return;
			}

			var STP = Int($("#startprice").val());
			var MIP = Int($(this).val());
			var STP_CEIL = Math.ceil(STP*0.8);

			if(MIP<STP_CEIL){
				alert("スタンドローンの場合、「最低成立金額」が「借入希望金額」の80%以上になるように設定してください。(最低金額は10万円以上になります。)");
				$(this).val(STP_CEIL);
				return;
			}

			if(MIP>STP){
				alert("スタンドローンの場合、「最低成立金額」が「借入希望金額」の80%以上になるように設定してください。(最低金額は10万円以上になります。)");

				//return;
			}

			if(STP >= 10 && STP < 13){
				$(this).val(10);
				return;
			}

			if(STP_CEIL <10){
				$(this).val(10);
				return;
			}
			//$(this).val(STP_CEIL);
		});
	}

}


/**
 * 募集ローン作成画面1ページ目の画面制御
 * @param int score
 * @param int maxmonth
 * @param int maxprice
 */
function setAuctionRegistDisplayManager(max){

	if($("#qik").attr("checked")==true){
			$("#rpvalue")
				.attr("readOnly", true)
				.css("background","#dfdfdf");
	}

	//借入希望金利
	$("#maxrate")
		.keyup(function(event){
			render_rate();
		}
	);

	//月間支出の合計
	$("#rent_or_mortgage_monthly_sum,#rent_or_mortgage_monthly_sum_s,#utilities_expenses,#utilities_expenses_s,#food_expenses,#food_expenses_s,#school_expenses,#school_expenses_s,#leisure_expenses,#leisure_expenses_s,#repayment_expenses,#repayment_expenses_s,#other_expenses,#other_expenses_s,#bonus,#bonus_s")
		.keyup(function(event){
			total_value();
		}
	);

	//スタンダードローン
	/*$("#std").click(function(){
		if($(this).attr("checked")==true){
			ret = $("#startprice").val();
			$("#rpvalue")
				.attr("readOnly", false).removeAttr("readOnly")
				.css("background","#ffffff");

			if($("#startprice").val()<13)
				$("#rpvalue").val(10);
			else
				$("#rpvalue").val(Math.ceil($("#startprice").val()*0.8));
		}
	});*/

	//クイックローン
	/*$("#qik").click(function(){
		if($(this).attr("checked")==true){
			$("#rpvalue")
				.attr("readOnly", true)
				.css("background","#dfdfdf");
			$("#rpvalue").val($("#startprice").val());
		}
	});*/

	$("#rpvalue").val($("#startprice").val());

	//借入希望金額の制御
	$("#startprice")
		.blur(function(){

			if(isNaN($(this).val())){
				alert("半角数字で入力してください。");
				$(this).val(10);
				return;
			}

			STP = Int($(this).val());
			MIP = Int($("#rpvalue").val());
			STP_CEIL = Math.ceil(STP*0.8);

			//STP <10
			if(STP < 10){
				alert("借入希望金額は、10万円以上の金額になります。");
				$(this).val(10);
				if($("#std").attr("checked")==true){
					$("#rpvalue").val(10);
				}else{
					$("#rpvalue").val(10);
				}
				return;
			}

			if(STP > max){
				alert("借入希望金額は、最大"+max+"万円以下の金額になります。");
				return;
			}

			$("#rpvalue").val(STP);

			/*if($("#qik").attr("checked")==true){
				$("#rpvalue").val(STP);
				return;

			}else if($("#std").attr("checked")==true){
				//$("#rpvalue").val(STP_CEIL);
				if(MIP<STP_CEIL){
					$("#rpvalue").val(STP_CEIL);
					return;
				}
				if(MIP>STP){
					$("#rpvalue").val(STP);
					return;
				}
			}*/

		})
		.keyup(function(){

			STP = Int($(this).val());
			MIP = Int($("#rpvalue").val());
			STP_CEIL = Math.ceil(STP * 0.8);

			if($("#std").attr("checked")==true){
				if(STP >= 10 && STP < 13){
					$("#rpvalue").val(10);
					return;
				}

				if(STP_CEIL <10){
					$("#rpvalue").val(10);
					return;
				}
			}
		});

	////最低成立金額の制御
	$("#rpvalue")
		.blur(function(){
			STP = Int($("#startprice").val());
			MIP = Int($(this).val());
			STP_CEIL = Math.ceil(STP*0.8);

			if(isNaN($(this).val())){
				alert("半角数字で入力してください。");
				return;
			}

			if(MIP < 10){
				alert("最低成立金額は10万円以上となります。");
				//$(this).val(10);
				return;

			}
			if(STP < MIP){
				alert("スタンドローンの場合、「最低成立金額」が「借入希望金額」の80%以上になるように設定してください。(最低金額は10万円以上になります。)");
				$(this).val(10);
				return;
			}
		});
}

/**
 * レンダー金利の自動計算用
 */
function render_rate(){
	var rate  = Int($("#maxrate").val());
	$("#render_rate")
		.html( Double(rate-1.50) + "&nbsp;％" );

	$("#maxrateLender")
		.val(Double(rate-1.50));
}

/**
 * 月間支出の自動計算用
 */
function total_value(){

	var ret1  = Int($("#rent_or_mortgage_monthly_sum").val())
						+ Int($("#utilities_expenses").val())
						+ Int($("#food_expenses").val())
					  + Int($("#school_expenses").val())
					  + Int($("#leisure_expenses").val())
					  + Int($("#repayment_expenses").val())
					  + Int($("#other_expenses").val())
					  + Int($("#bonus").val());

	var ret2  = Int($("#rent_or_mortgage_monthly_sum_s").val())
						+ Int($("#utilities_expenses_s").val())
						+ Int($("#food_expenses_s").val())
						+ Int($("#school_expenses_s").val())
						+ Int($("#leisure_expenses_s").val())
						+ Int($("#repayment_expenses_s").val())
						+ Int($("#other_expenses_s").val())
						+ Int($("#bonus_s").val());

	var total_value = (ret1*10000) + (ret2*1000);

	var total_man =parseInt(total_value / 10000);
	var total_sen = (total_value % 10000) / 1000;

	$("#total_value").val(total_man);
	$("#total_value_s").val(total_sen);

	if(total_man > 0){
		total_man = total_man + "&nbsp;万&nbsp;"
	}else{
		total_man="";
	}

	total_sen = total_sen + "&nbsp;千"

	$("#total_value_view")
		.html(total_man + total_sen + "円" );

	checkIncome(total_value);

}

/**
 * maneo借入合計と、年収1/12の比較
 */
	function checkIncome(total_value){
		var income = Int($("#income").val())/12;
		var commpless = total_value/1000;
		var url = "javascript:registAuction(document.registAuction,0)";
		if(income<commpless){
			$(".btn_bor_purpose a").css("background-position","bottom left");
			$("#compareIncome").css("display","block");
			$("#compareIncomeArea").css("background","#FADBE0");
			$("#nextPageing a").attr("href","#");

		}else{
			$(".btn_bor_purpose a").css("background-position","top left");
			$("#compareIncome").css("display","none");
			$("#compareIncomeArea").css("background","#FFFFF0");
			$("#nextPageing a").attr("href",url);
		}
	}

/**
 * G-LOANの借り入れ金額制御
 */

function setStartupPriveEvent(max,min){

	var _max = max;
	var _min = min;

	$("#startpricee")
		.keydown(function(e){
			var max_price = _max - 1;
			var min_price = _min + 1;
			startprice = Int($(this).val());

			if(e.which==38 && startprice <= max_price){
				$(this).val(++startprice);

			}else if(e.which==40 && startprice >= min_price){
				$(this).val(--startprice);
			}
		})
		.blur(function(e){
			startprice = Int($(this).val());
			if(startprice > _max  || startprice < _min)
				alert("借入希望金額の設定が間違っています。");
		});
}


/**
 * maneoLoan借入希望金利の入力制御
 */
function setRatePriveEvent(max,min){
	$("#maxrate").blur(function(e){
			rate = parseFloat($(this).val());
			if( (rate > max)  || (rate < min) ){
				alert("借入希望金利の設定が間違っています。");
				$(this).val("0.00");
			}
	});
}

/**
 * メールマガジン購読画面でウィンドウ制御
 */
function openParent(){
	var win;
	try{
		window.opener.document.location.href= "http://www.maneo.jp/";
		window.close();
	}catch(e){
		win = window.open("http://www.maneo.jp/","newWin");
		win.focus();
	}
}

/**
 * 退会フォームSUBMIT
 */
function deleteUserAction(){
	document.deleteUserForm.submit();
}


/**
 *
 */
function sendRealForm(id){
	try{
		$.ajax({
			type: "post",
			url: "/apl/regist/save/borrower",
			data: $("#"+id).serialize(),
			dataType: "json",
			cache : false,
			success:function(json){
				if(json=="OK"){

				}else{

				}
			},
		 	error:function(json){

			}
	 	});
	}catch(e){}
}

