var mediatisSimulator_ppr = { data:{amountSliceList:[{amountMin:0,amountMax:500,monthlyPaymentList:[{mp:20.0,teg:17.68000030517578,txn:16.28},{mp:25.0,teg:15.949999809265137,txn:14.8},{mp:35.0,teg:9.949999809265137,txn:9.49}],durationList:[36, 24, 12]},{amountMin:501,amountMax:3000,monthlyPaymentList:[{mp:0.0393,teg:17.68000030517578,txn:16.28},{mp:0.05,teg:15.949999809265137,txn:14.8},{mp:0.07,teg:9.949999809265137,txn:9.49}],durationList:[36, 24, 12]},{amountMin:3001,amountMax:6000,monthlyPaymentList:[{mp:0.0268,teg:17.68000030517578,txn:16.28},{mp:0.05,teg:15.949999809265137,txn:14.8},{mp:0.07,teg:9.949999809265137,txn:9.49}],durationList:[36, 24, 12]}]}, // -------------------------------------------------------- amountList:[ 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0, 6000.0, 6500.0, 7000.0, 7500.0, 8000.0, 8500.0, 9000, 9500, 10000.0 ], amountIndex:0, amountSliceIndex:0, monthlyPaymentIndex:0, isInitState:true, // -------------------------------------------------------- getAmountCount:function(){return this.amountList.length;}, getAmountMax:function(){return this.amountList[this.amountList.length-1];}, getAmountMin:function(){return this.amountList[0];}, getAmount:function(){return this.amountList[this.amountIndex];}, getAmountSlice:function(){return this.data.amountSliceList[this.amountSliceIndex];}, getTeg:function(){return this.data.amountSliceList[this.amountSliceIndex].monthlyPaymentList[this.monthlyPaymentIndex].teg;}, getTxn:function(){return this.data.amountSliceList[this.amountSliceIndex].monthlyPaymentList[this.monthlyPaymentIndex].txn;}, getMonthlyPaymentCount:function(){return this.data.amountSliceList[this.amountSliceIndex].monthlyPaymentList.length;}, getMonthlyPaymentMin:function(){return this.getMonthlyPaymentList()[0];}, getMonthlyPaymentMax:function(){return this.getMonthlyPaymentList()[this.getMonthlyPaymentCount()-1];}, getSelectedMonthlyPayment:function(){return this.getMonthlyPaymentList()[this.monthlyPaymentIndex];}, getMonthlyPaymentList:function(){ var mpValues = this.data.amountSliceList[this.amountSliceIndex].monthlyPaymentList; var res = new Array(); for(var i in mpValues) if(mpValues[i].mp < 1.0) res[i] = mpValues[i].mp * this.getAmount(); else res[i] = mpValues[i].mp; return res; }, setMonthlyPaymentListForAmount:function(a){ for (var i=0; i= this.data.amountSliceList[i].amountMin && a <= this.data.amountSliceList[i].amountMax) { this.amountSliceIndex = i; break; } } }, setAmount:function(val){ var currentVal = this.getAmount(); var smallestInterval = Math.abs(val - currentVal); for(var i=0;i=0 && i<=(this.getAmountCount()-1)){ this.amountIndex = i; this.setMonthlyPaymentListForAmount(this.getAmount()); } }, setMonthlyPaymentIndex:function(i){ if(i>=0 && i<=(this.getMonthlyPaymentCount()-1)) this.monthlyPaymentIndex = i; }, setPlusAmount:function() { if(this.amountIndex < this.amountList.length-1) this.setAmountIndex(this.amountIndex+1); }, setMinusAmount:function() { if(this.amountIndex > 0) this.setAmountIndex(this.amountIndex-1); } };