function calculateMonthlyPayment(n){try{var t=n.PrincipalAmount,i=n.MonthlyInterestRate,r=n.NumberOfInstallments;if(r==1)return ret=t+t*n.AnnualInterestRate*n.LoanTermDays/360;var f=1+i,u=Math.pow(f,r),e=i*u/(u-1);return t*e}catch(s){return 0}}function generateRepaymentPlan(n){for(var t,e,o,i=[],s=n.PrincipalAmount,c=n.AnnualInterestRate,r=n.NumberOfInstallments,u=calculateMonthlyPayment(n),l=u*100,a=Math.round(l)/100,v=(u*r-a*r)*100,y=Math.round(v)/100,h=0,f=1;f<=r;f++)t={},t.InstallmentNumber=f,t.Days=30,n.LoanTermDays<30&&(t.Days=n.LoanTermDays),t.Amount=s-h,s=t.Amount,t.MonthlyPayment=u,t.Interest=t.Amount*c*t.Days/360,t.Repayment=t.MonthlyPayment-t.Interest,h=t.Repayment,i.push(t);return e=0,o=n.PrincipalAmount,i.forEach(function(t){var c=o*100,f,s,h,u;t.Amount=Math.round(c)/100;f=t.MonthlyPayment*100;t.MonthlyPayment=Math.round(f)/100;t.InstallmentNumber==r&&(t.MonthlyPayment=(t.MonthlyPayment*100+y*100)/100);s=t.Interest*100;t.Interest=Math.round(s)/100;h=t.Repayment*100;t.Repayment=Math.round(h)/100;t.Interest+t.Repayment!=t.MonthlyPayment&&(t.Repayment=(t.Repayment*100+t.MonthlyPayment*100-(t.Interest*100+t.Repayment*100))/100);o=(t.Amount*100-t.Repayment*100)/100;e+=t.Repayment;i[i.length-1].InstallmentNumber==t.InstallmentNumber&&(u=(n.PrincipalAmount*100-e*100)/100,t.Repayment=(t.Repayment*100+u*100)/100,t.Interest=(t.Interest*100-u*100)/100)}),i}function calculateInterestOnLoan(n){var i=generateRepaymentPlan(n),t=0;return i.forEach(function(n){t+=n.Interest*100}),t=Math.round(t)/100}function calCulateBankIntrestRate(n,t){var r=_privateBank1891InterestRate.replace(",","."),i={};return i.PrincipalAmount=parseFloat(t),i.NumberOfInstallments=n<=30?1:parseInt(n/30),i.LoanTermDays=n,i.AnnualPercentageRate=parseFloat(r),i.AnnualInterestRate=parseFloat(i.AnnualPercentageRate/100),i.MonthlyInterestRate=parseFloat(i.AnnualInterestRate/12),calculateInterestOnLoan(i)}function getBlackFridayCampaign2022Price(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,1,6),o=new Date(2023,1,7);return i>=e&&i<=o?(n=49,$("#vcBlackFriday2022").length&&$("#vcBlackFriday2022").css("display","block")):$("#vcBlackFriday2022").length&&$("#vcBlackFriday2022").css("display","none"),n}function getEasterCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,2,27),s=new Date(2023,2,31);return r>=o&&r<=s&&t>=3?(n=49,$("#easterCamapginDiv").length&&$("#easterCamapginDiv").css("display","block")):$("#easterCamapginDiv").length&&$("#easterCamapginDiv").css("display","none"),n}function getWomanDayCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,2,8),o=new Date(2023,2,8);return i>=e&&i<=o?(n=49,$("#womanDayCamapginDiv").length&&$("#womanDayCamapginDiv").css("display","block")):$("#womanDayCamapginDiv").length&&$("#womanDayCamapginDiv").css("display","none"),n}function getStepThreeRejectionOfferPrice(n){return n=49,$("#stepThreeRejectionOfferDiv").length&&$("#stepThreeRejectionOfferDiv").css("display","block"),n}function getSpringCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,3,24),s=new Date(2023,3,27);return r>=o&&r<=s&&t>=4?(n=49,$("#springCamapginDiv").length&&$("#springCamapginDiv").css("display","block")):$("#springCamapginDiv").length&&$("#springCamapginDiv").css("display","none"),n}function getMotherDayCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,4,10),s=new Date(2023,4,11);return r>=o&&r<=s&&t>=3?(n=49,$("#motherDayCampaignDiv").length&&$("#motherDayCampaignDiv").css("display","block")):$("#motherDayCampaignDiv").length&&$("#motherDayCampaignDiv").css("display","none"),n}function getFathersDayCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,4,15),s=new Date(2023,4,16);return r>=o&&r<=s&&t>=3?(n=49,$("#fathersDayCampaignDiv").length&&$("#fathersDayCampaignDiv").css("display","block")):$("#fathersDayCampaignDiv").length&&$("#fathersDayCampaignDiv").css("display","none"),n}function getSummerCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,5,14),s=new Date(2023,5,16);return r>=o&&r<=s&&t>=4?(n=49,$("#summerCampaignDiv").length&&$("#summerCampaignDiv").css("display","block")):$("#summerCampaignDiv").length&&$("#summerCampaignDiv").css("display","none"),n}function getJulyCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,6,17),s=new Date(2023,6,21);return r>=o&&r<=s&&t>=3?(n=49,$("#julyCampaignDiv").length&&$("#julyCampaignDiv").css("display","block")):$("#julyCampaignDiv").length&&$("#julyCampaignDiv").css("display","none"),n}function getFreshlyClosedCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2024,0,8),o=new Date(2024,0,12);return i>=e&&i<=o?(n=59,$("#freshlyClosedCampaignDiv").length&&$("#freshlyClosedCampaignDiv").css("display","block")):$("#freshlyClosedCampaignDiv").length&&$("#freshlyClosedCampaignDiv").css("display","none"),n}function getOneLoanClientCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,9,11),o=new Date(2023,9,25);return i>=e&&i<=o?(n=35,$("#oneLoanClientCampaignDiv").length&&$("#oneLoanClientCampaignDiv").css("display","block")):$("#oneLoanClientCampaignDiv").length&&$("#oneLoanClientCampaignDiv").css("display","none"),n}function getBackToSchoolCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,7,30),s=new Date(2023,8,1);return r>=o&&r<=s&&t>=4?(n=49,$("#backToSchoolCampaignDiv").length&&$("#backToSchoolCampaignDiv").css("display","block")):$("#backToSchoolCampaignDiv").length&&$("#backToSchoolCampaignDiv").css("display","none"),n}function getOktoberFestCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,8,27),o=new Date(2023,8,29);return i>=e&&i<=o?(n=49,$("#oktoberfestCampaignDiv").length&&$("#oktoberfestCampaignDiv").css("display","block")):$("#oktoberfestCampaignDiv").length&&$("#oktoberfestCampaignDiv").css("display","none"),n}function gethalloweenCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,9,26),o=new Date(2023,9,31);return i>=e&&i<=o?(n=49,$("#halloweenCampaignDiv").length&&$("#halloweenCampaignDiv").css("display","block")):$("#halloweenCampaignDiv").length&&$("#halloweenCampaignDiv").css("display","none"),n}function getRejectedByDateCampaignPrice(n){var t=new Date,r=t.getDate(),u=t.getMonth(),f=t.getFullYear(),i=new Date(f,u,r),e=new Date(2023,10,20),o=new Date(2023,10,24);return i>=e&&i<=o?(n=59,$("#rejectedByDateCampaignDiv").length&&$("#rejectedByDateCampaignDiv").css("display","block")):$("#rejectedByDateCampaignDiv").length&&$("#rejectedByDateCampaignDiv").css("display","none"),n}function getBlackFridayCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,10,27),s=new Date(2023,11,1);return r>=o&&r<=s&&t>=3?(n=49,$("#blackFridayCampaignDiv").length&&$("#blackFridayCampaignDiv").css("display","block")):$("#blackFridayCampaignDiv").length&&$("#blackFridayCampaignDiv").css("display","none"),n}function getChristmasCampaignPrice(n,t){var i=new Date,u=i.getDate(),f=i.getMonth(),e=i.getFullYear(),r=new Date(e,f,u),o=new Date(2023,11,18),s=new Date(2023,11,22);return r>=o&&r<=s&&t>=3?(n=49,$("#christmasCampaignDiv").length&&$("#christmasCampaignDiv").css("display","block")):$("#christmasCampaignDiv").length&&$("#christmasCampaignDiv").css("display","none"),n}function getGeneralCampaignPrice(){var n=69;return _canUseCampaign==="True"?(n=_campaignPrice,$("#generalCampaignDiv").length&&$("#generalCampaignDiv").css("display","block")):$("#generalCampaignDiv").length&&$("#generalCampaignDiv").css("display","none"),n}function getSmartPackageSubscriptionPrice(){var n=69;return $("#generalCampaign").val()=="True"?n=getGeneralCampaignPrice():$("#customerIsSTepThreeRejected").val()=="True"&&(n=getStepThreeRejectionOfferPrice(n)),n}function calculateInterest(){var r=$("#fvLoanAmount").val(),u=$("#fvLoanPeriod").val(),f=$("#vcLoanPayback"),e=$("#vcLoanInterest"),i=parseFloat(r),o=parseFloat(u),n=interestCalculator(i,o),t=i+n;n=n.toFixed(2);t=t.toFixed(2);e.html(n.replace(".",","));f.html(t.replace(".",","))}function interestCalculator(n,t){return calCulateBankIntrestRate(t,n)}$(function(){calculateInterest();$("#vcSliderRangeAmount").slider({range:"min",min:_loanMin,max:_loanMax,step:_loanStep,value:_loanAmount,slide:function(n,t){var i=t.value,r=$(".vc-notification-new-customers");i>1e3&&!r.hasClass("text-danger")?r.addClass("text-danger"):i<=1e3&&r.hasClass("text-danger")&&r.removeClass("text-danger");$("#fvLoanAmount").val(i);$("#vcLoanAmount").html(i);_loanAmount=i;calculateInterest()}});var n={30:0,60:1,90:2},t=[30,60,90];$("#vcSliderRangePeriod").slider({range:"min",min:n[_daysMin],max:n[_daysMax],step:1,value:n[_days],slide:function(n,i){var r=t[i.value];$("#fvLoanPeriod").val(r);$("#vcLoanPeriod").html(r);_days=r;calculateInterest()}});$("#vcBtnLoanCalculatorSubmit").off().on("click",function(n){n.preventDefault();$(this).attr("disabled","disabled");$(this).find("[data-field-name='state-ready']").hide();$(this).find("[data-field-name='state-processing']").show();typeof ga!="undefined"&&ga("send","event","credit-request","main-page-button-click");$("#vcLoanCalculatorForm").submit()})})