window.onload = function(){
var currentUrl = window.location.href,
loanPurposesText = {
'en-hk' : 'Car purchase',
'zh-hk' : '汽車購買',
'zh-cn' : '汽车购买'
},
loanDocumentList = {
'en-hk':'<ol id="li-before-dot"><li><span class="sr-only">.</span>HKID Card</li><li><span class="sr-only">.</span><u>Income proof</u>: For <u>regular income earners</u>, please enclose the latest Tax Demand Note / Bank account monthly statement / passbook showing your latest one month\'s salary (if you have payroll account with Hang Seng, no income proof is required); as for <u>irregular income earners</u>, please enclose the latest Tax Demand Note / Bank account monthly statement / passbook showing your latest two month\'s salary</li><li><span class="sr-only">.</span><u>Current residential address proof <u class="aria-hidden" aria-hidden="true">e.g.</u><span class="sr-only">example.</span> </u>utility bills, bank statement</li><li><span class="sr-only">.</span>Electric vehicle order agreement<br/>Hang Seng will request customers to provide the Vehicle Registration Document or related documents as the proof of electric vehicle’s ownership within 6 months of loan drawdown. </li></ol>',
'zh-hk':'<ol id="li-before-dot"><li><span class="sr-only">.</span>香港身份證</li><li><span class="sr-only">.</span><u>薪金證明</u>:<u>固定收入人仕</u>請附本年度之薪俸稅單或最近1個月顯示薪金之銀行月結單或存摺(如過去一個月透過恒生自動轉賬支薪,可獲豁免提供入息證明);而<u>非固定收入人仕</u>請附本年度之薪俸稅單或最近兩個月顯示薪金之銀行月結單或存摺</li><li><span class="sr-only">.</span><u>現時住址證明,例如:</u>電費單/銀行月結單等</li><li><span class="sr-only">.</span>電動車訂購協議<br/>恒生會於提取貸款後6個月內要求客戶提供車輛登記文件或相關文件作為電動車所有權的證明。</li></ol>',
'zh-cn':'<ol id="li-before-dot"><li><span class="sr-only">.</span>香港身份证</li><li><span class="sr-only">.</span><u>薪金证明</u>:<u>固定收入人仕</u>请附本年度之薪俸税单或最近1个月显示薪金之银行月结单或存折(如过去一个月透过恒生自动转账支薪,可获豁免提供入息证明);而<u>非固定收入人仕</u>请附本年度之薪俸税单或最近两个月显示薪金之银行月结单或存折</li><li><span class="sr-only">.</span><u>现时住址证明,例如:</u>水、电费单/银行月结单等</li><li><span class="sr-only">.</span>电动车订单协议<br/>恒生会于提取贷款后6个月内要求客户提供车辆登记文件或相关文件作为电动车所有权的证明。</li></ol>'
},
loanRepaymentPeriodA11Y = {
'en-hk' : 'The minimum and maximum repayment period is 12 and 60 months.',
'zh-hk' : '還款期應大於12個月及應小於60個月。',
'zh-cn' : '还款期应大于12个月及小于60个月。'
},
currentLanguage,
$radioBtnContanier = $('#rwd-ploan-applicationForm-radio-loanPurposesList'),
searchParams = new URLSearchParams(window.location.search);
if(currentUrl.indexOf('zh-hk') > -1 || currentUrl.indexOf('zh_hk') > -1){
currentLanguage = 'zh-hk';
}else if(currentUrl.indexOf('zh-cn') > -1 || currentUrl.indexOf('zh_cn') > -1 ){
currentLanguage = 'zh-cn';
}else{
currentLanguage = 'en-hk';
}
if(!searchParams.has('pcode') || searchParams.get('pcode')!='EV8S' ){
window.location.href = 'https://' + window.location.host + '/' + currentLanguage + '/personal/loans/electric-vehicle-loan/';
}
(function init(){
$radioBtnContanier.find('.rwd-form-custom-radio:not(:last)').hide();
$('#rwd-ploan-applicationForm-loanPurposesList-4').trigger('click');
$('#rwd-ploan-applicationForm-loanPurposesList-4').siblings('label').find('div').text(loanPurposesText[currentLanguage]);
$('#rwd-ploan-applicationForm-loan-ack-modal').find('.rwd-ploan-applicationForm-info-container').find('.rwd-form-row').html(loanDocumentList[currentLanguage]);
$("#rwd-ploan-applicationForm-accordion-loan").find("[data-loan-type='PIL,TAX']").find(".rwd-ploan-applicationForm-tenor-swiper").attr("aria-label",loanRepaymentPeriodA11Y[currentLanguage]);
})();
document.querySelector('[data-form-button-action="next"]:not(.rwd-button-isDisabled)').addEventListener("click", function(){
setTimeout(function(){
$("#rwd-ploan-applicationForm-confirm-loanPurposesList").text(loanPurposesText[currentLanguage]);
}, 1000);
});
}