if (if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#loan-calculator-1").length) {
jQuery( function( if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        } ) {
            

            var monthtoyear = if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('#totalmonth').text()/12;
            var yeartomonth = if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('#totalyear').text()*12;

            if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('#totalmonth').text()/12;
                var yeartomonth = if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('#totalyear').text()*12;

                if (if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.loan-yearly-changer').length) {

                    if (if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.loan-yearly-changer input').prop('checked')) {  
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalyear").text(if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#total-year-slide").slider("value"));                  
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.yearly').addClass('active');
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalmonth").text(if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#total-month-slide").slider("value"));
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.yearly').removeClass('active');
                        if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalmonth").text(if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#total-month-slide").slider("value"));

            if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest").text(if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest").text();
                numberOfMonths =if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#pricipal").text();
                var rateOfInterest=if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#intrest").text();
                numberOfMonths =if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //if (Ksh("#loan-calculator-1").length) {
jQuery( function( Ksh ) {
            

            var monthtoyear = Ksh('#totalmonth').text()/12;
            var yeartomonth = Ksh('#totalyear').text()*12;

            Ksh('.loan-yearly-changer input').on('click',function(){
                var monthtoyear = Ksh('#totalmonth').text()/12;
                var yeartomonth = Ksh('#totalyear').text()*12;

                if (Ksh('.loan-yearly-changer').length) {

                    if (Ksh('.loan-yearly-changer input').prop('checked')) {  
                        Ksh("#total-year-slide").slider({
                            range: "min",
                            min: 1,
                            max: 30,
                            step: 0.5,
                            value: monthtoyear,
                            slide: function(event, ui) {
                                Ksh("#totalyear").text(ui.value);
                                loancalculateyear();
                            }
                        });

                         Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));                  
                        Ksh('.yearly').addClass('active');
                        Ksh('.monthly').removeClass('active');
                        loancalculateyear();
                    }
                    else{
                        Ksh("#total-month-slide").slider({
                            range: "min",
                            min: 12,
                            max: 360,
                            step: 6,
                            value: yeartomonth,
                            slide: function(event, ui) {
                                Ksh("#totalmonth").text(ui.value);
                                loancalculate();
                            }
                        });

                        Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));
                        Ksh('.yearly').removeClass('active');
                        Ksh('.monthly').addClass('active');
                        loancalculate();
                    }
                }
            })

           

            Ksh("#pricipal-slide").slider({
                range: "min",
                min: 10000,
                max: 5000000,
                value: 100000,
                step: 1000,
                slide: function(event, ui) {
                    Ksh("#pricipal").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#pricipal").text(Ksh("#pricipal-slide").slider("value"));

            ("#total-year-slide").slider({
                range: "min",
                min: 1,
                max: 30,
                step: 0.5,
                value: monthtoyear,
                slide: function(event, ui) {
                    ("#totalyear").text(ui.value);
                    loancalculateyear();
                }
            });

            Ksh("#totalyear").text(Ksh("#total-year-slide").slider("value"));

            Ksh("#total-month-slide").slider({
                range: "min",
                min: 12,
                max: 360,
                step: 6,
                value: yeartomonth,
                slide: function(event, ui) {
                    Ksh("#totalmonth").text(ui.value);
                    loancalculate();
                }
            });

            Ksh("#totalmonth").text(Ksh("#total-month-slide").slider("value"));

            Ksh("#intrest-slide").slider({
                range: "min",
                min: 4.10,
                max: 16.20,
                step: 0.01,
                value: 10,
                slide: function(event, ui) {
                    Ksh("#intrest").text(ui.value);
                    loancalculate();
                }
            });
            Ksh("#intrest").text(Ksh("#intrest-slide").slider("value"));

            loancalculate();
         });
    
         //if (typeof(functionName) != 'loancalculate') {

            function loancalculate()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalmonth").text();
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

            function loancalculateyear()
            {

                
                var loanAmount =Ksh("#pricipal").text();
                var rateOfInterest=Ksh("#intrest").text();
                numberOfMonths =Ksh("#totalyear").text()*12;
                var monthlyInterestRatio = (rateOfInterest/100)/12;

                var top = Math.pow((1+monthlyInterestRatio),numberOfMonths);
                var bottom = top -1;
                var sp = top / bottom;
                var emi = ((loanAmount * monthlyInterestRatio) * sp);
                var full = numberOfMonths * emi;
                var interest = full - loanAmount;
                var int_pge =  (interest / full) * 100;
                //Ksh("#tbl_int_pge").html(int_pge.toFixed(2)+" %");
                //Ksh("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }("#tbl_loan_pge").html((100-int_pge.toFixed(2))+" %");

                var emi_str = emi.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var loanAmount_str = loanAmount.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var full_str = full.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                var int_str = interest.toFixed(2).toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");


                jQuery("#emi").html(emi_str);
                jQuery("#tbl_emi").html(int_str);
                jQuery("#tbl_la").html(full_str);           

            }

           
        //}
        }