jQuery.validator.addMethod("checkhouseaddress",function(){var t=$("input:radio[name='Data.Bill']:checked").val(),n=$("#HouseAddress").val();return t==="1"&&(n.length===0||n.trim().length===0)?!1:!0});jQuery.validator.addMethod("checkcompanyaddress",function(){var t=$("input:radio[name='Data.Bill']:checked").val(),n=$("#CompAddress").val();return t==="2"&&(n.length===0||n.trim().length===0)?!1:!0});jQuery.validator.addMethod("checkbilladdress",function(){var t=$("input:radio[name='Data.Bill']:checked").val(),n=$("#BillAddress").val();return t==="3"&&(n.length===0||n.trim().length===0)?!1:!0});jQuery.validator.unobtrusive.adapters.addBool("checkhouseaddress");jQuery.validator.unobtrusive.adapters.addBool("checkcompanyaddress");jQuery.validator.unobtrusive.adapters.addBool("checkbilladdress");jQuery.validator.unobtrusive.adapters.addBool("mandatory","required");$(function(){function u(n,t){var i={url:_SiteRoot+"Apply/GetDeptList",data:{areaId:n},selValue:t,targetId:"UnitNo",defText:"請選擇分行"};updateSelete(i)}function c(n,t){$("#"+t)!==undefined&&$("#"+t).val("").val(n)}function n(n,t,i){var r={url:_SiteRoot+"Apply/GetAreaList",data:{cityCode:n},selValue:t,targetId:i};updateSelete(r)}function r(n,t,i){$("#"+i)!==undefined&&$("#"+i).val("").val(n+t)}function t(n,t){if($("#"+t)!==undefined){var i={url:_SiteRoot+"Apply/GetAreaZipCode",data:{areaCode:n},targetId:t};setCodeText(i)}}function i(n,t){$("#"+t)!==undefined&&$("#"+t).val("").val(n)}function f(n,t){var i={url:_SiteRoot+"Apply/GetLoanItemList",data:{kindCode:n},selValue:t,targetId:"BrdItem"};updateSelete(i)}function e(n,t){var i={url:_SiteRoot+"Apply/GetLoanReturnList",data:{kindCode:n},selValue:t,targetId:"BrdReturn"};updateSelete(i)}function o(n,t){var i={url:_SiteRoot+"Apply/GetCardCateList",data:{typeCode:n},selValue:t,targetId:"CardCate"};updateSelete(i)}function s(n,t,i){var r={url:_SiteRoot+"Apply/GetCardGroupList",data:{typeCode:n,cateCode:t},selValue:i,targetId:"CardGroup"};updateSelete(r);i!==undefined&&i!==""&&h(n,t,i)}function h(n,t,i){var r={url:_SiteRoot+"Apply/GetCardImage",data:{typeCode:n,cateCode:t,groupCode:i},targetId:"CardImage"};updateImage(r)}$("#ChangeCaptcha").click(function(n){n.preventDefault();$("#CaptchaImage").attr("src",_SiteRoot+"Comment/VerificationCode?tt="+(new Date).getTime())});$("input[name='Data.IsSameAddress']").click(function(){$(this).prop("checked")?($("#ConneCity").val($("#HouseCity").val()),$("#HouseArea").val()!==undefined&&$("#HouseArea").val()!=="0"&&$("#HouseArea").val()!==""&&n($("#HouseCity").val(),$("#HouseArea").val(),"ConneArea"),$("#ConneAddress").val($("#HouseAddress").val()),$("#HouseAreaCodeText").val()!==undefined&&$("#HouseAreaCodeText").val()!=="0"&&$("#HouseAreaCodeText").val()!==""&&$("#ConneAreaCodeText").val($("#HouseAreaCodeText").val())):$("#Address2").val("")});$("input[name='Data.RadioAddress2']").click(function(){var t=$(this).val();t==="1"?($("#ConneCity").val($("#HouseCity").val()),$("#HouseArea").val()!==undefined&&$("#HouseArea").val()!=="0"&&$("#HouseArea").val()!==""&&n($("#HouseCity").val(),$("#HouseArea").val(),"ConneArea"),$("#ConneAddress").val($("#HouseAddress").val()),$("#HouseAreaCodeText").val()!==undefined&&$("#HouseAreaCodeText").val()!=="0"&&$("#HouseAreaCodeText").val()!==""&&$("#ConneAreaCodeText").val($("#HouseAreaCodeText").val())):$("#Address2").val("")});$("#HouseArea").change(function(){t($("option:selected",this).val(),"HouseAreaCodeText")});$("input[name='Data.Bill']").click(function(){var n=$(this).val();n==="1"?$("#BillAddress").val($("#HouseAddress").val()):n==="2"?$("#BillAddress").val($("#CompAddress").val()):$("#BillAddress").val("")});$("[id^=CountLoan]").change(function(){for(var n=1;n<=5;n++)$("input[id='CountLoanSum["+n+"]']").val(parseInt($("input[id='CountLoan1["+n+"]']").val(),10)+parseInt($("input[id='CountLoan2["+n+"]']").val(),10)+parseInt($("input[id='CountLoan3["+n+"]']").val(),10))});$("#UnitArea").val()!==undefined&&$("#UnitArea").val()!=="0"&&$("#UnitArea").val()!==""&&u($("#UnitArea").val(),$("#UnitNoHidden").val());$("#UnitArea").change(function(){u($(this).val())});$("#Data_Bank1").change(function(){c($("#Data_Bank1 option:selected").val(),"Data_account1");$.ajax({type:"POST",url:_SiteRoot+"Apply/GetBankArea",data:{unitNo:$("#Data_Bank1 option:selected").val()},dataType:"text",success:function(n){var t=n.replace(/["]/g,"");$("#UnitArea").val("");$("#UnitArea").children().each(function(){$(this).val()==t&&$("#UnitArea").val(t)});$("#UnitArea").change();setTimeout(function(){$("#UnitArea").val()!=""&&$("#UnitNo").val($("#Data_Bank1 option:selected").val())},1e3)},error:function(){}})});$("#HouseCity").val()!==undefined&&$("#HouseCity").val()!=="0"&&$("#HouseCity").val()!==""&&n($("#HouseCity").val(),$("#HouseAreaHidden").val(),"HouseArea");$("#ConneCity").val()!==undefined&&$("#ConneCity").val()!=="0"&&$("#ConneCity").val()!==""&&n($("#ConneCity").val(),$("#ConneAreaHidden").val(),"ConneArea");$("#CompCity").val()!==undefined&&$("#CompCity").val()!=="0"&&$("#CompCity").val()!==""&&n($("#CompCity").val(),$("#CompAreaHidden").val(),"CompArea");$("#HouseCity").change(function(){n($(this).val(),null,"HouseArea");i($("option:selected",this).text(),"Data_HouseCityText")});$("#ConneCity").change(function(){n($(this).val(),null,"ConneArea");i($("option:selected",this).text(),"Data_ConneCityText")});$("#CompCity").change(function(){n($(this).val(),null,"CompArea")});$("#HouseArea").change(function(){t($("option:selected",this).val(),"HouseZipCode");r($("#HouseCity option:selected").text(),$("option:selected",this).text(),"HouseAddress");i($("option:selected",this).text(),"Data_HouseAreaText")});$("#ConneArea").change(function(){r($("#ConneCity option:selected").text(),$("option:selected",this).text(),"ConneAddress");t($("option:selected",this).val(),"ConneAreaCodeText");i($("option:selected",this).text(),"Data_ConneAreaText")});$("#CompArea").change(function(){t($("option:selected",this).val(),"CompZipCode");r($("#CompCity option:selected").text(),$("option:selected",this).text(),"CompAddress")});$("#BrdKind").val()!==undefined&&$("#BrdKind").val()!=="0"&&(f($("#BrdKind").val(),$("#LoanItemHidden").val()),e($("#BrdKind").val(),$("#LoanReturnHidden").val()));$("#BrdKind").change(function(){f($(this).val());e($(this).val())});$("#CardType").val()!==undefined&&$("#CardType").val()!==""&&(o($("#CardType").val(),$("#CardCateHidden").val()),$("#CardCateHidden").val()!==undefined&&$("#CardCateHidden").val()!==""&&s($("#CardType").val(),$("#CardCateHidden").val(),$("#CardGroupHidden").val()));$("#CardType").change(function(){var n=$(this).val();o(n);$(".card_item input[type=text]").val("");$(".card_item input[type=radio]").prop("checked",!1);n?($(".card_item").show(),$(".default_item").hide(),$("strong[class*=CardType],li[class*=CardType]").hide(),$(".CardType_"+n+"").show()):($(".card_item").hide(),$(".default_item").show())});$("#CardCate").change(function(){s($("#CardType").val(),$(this).val())});$("#CardGroup").change(function(){h($("#CardType").val(),$("#CardCate").val(),$(this).val())})})