function CurrencyFormatted(amount) { var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s; return s; } function sayHello() { alert("Hello"); } function validateDebtConsole(id) { var inputTotal = document.getElementById('tot_' + id); var inputRepay = document.getElementById('rep_' + id); inputRepay.style.backgroundColor = '#ffdddd'; inputTotal.style.backgroundColor = '#ffdddd'; // blank-out non-numeric illegal entries if((inputTotal.value*1)>0) { inputTotal.style.backgroundColor = '#ffffff'; } else {inputTotal.value="";} if((inputRepay.value*1)>0) { inputRepay.style.backgroundColor = '#ffffff'; } else {inputRepay.value="";} if ((inputTotal.value+inputRepay.value)==0) { inputTotal.value=''; inputRepay.value=''; inputTotal.style.backgroundColor = '#ffffff'; inputRepay.style.backgroundColor = '#ffffff'; } DoCalc(); } function round(num) { return Math.round(num * 100) / 100; } function DoCalc() { var SubPrimeRate = 0.00575; var PrimeRate =0.00575; var TotalOwed = 0; var TotalRepayment = 0; for (i=1;i 15000) { callToAction = "http://www.moneyexpert.com/partners/aol/loans/loans.asp?consolidatehigh=true&xslt=/partners/aol/xslt/debtconsolidation.xslt"; } else { callToAction = "http://www.moneyexpert.com/partners/aol/loans/loans.asp?amount="+TotalOwed+"&period="+RepaymentMonths+"&pageno=0&xslt=/partners/aol/xslt/debtconsolidation.xslt"; } } //change message according to whether savings are possible document.getElementById("couldBePaying").innerHTML = (TotalRepayment > 0)?("Your new monthly payments could be £" + NewTotalRepayment + "
"):"" document.getElementById("savingYou").innerHTML = (TotalRepayment - NewTotalRepayment > 0)?("- a reduction of £" + CurrencyFormatted(TotalRepayment - NewTotalRepayment) + " a month"):"- increase the repayment period for lower monthly payments" document.getElementById("exit").href = callToAction; return false; } function getCurrentNumber() { return parseInt(document.forms["consolidator"].otherCount.value); } function incrementCurrent() { current = parseInt(document.forms["consolidator"].otherCount.value); document.forms["consolidator"].otherCount.value = current + 1; } function addRow() { var rowIndex = getCurrentNumber() + 1; var theTable = document.getElementById('AmountsTable'); var newRow = document.createElement('TR'); var newCell = document.createElement('TD'); newCell.setAttribute("className", "consoleBodyText"); newCell.setAttribute("class", "consoleBodyText"); //NS var newCell2 = document.createElement('TD'); newCell2.setAttribute("className", "consoleBodyText"); newCell2.setAttribute("class", "consoleBodyText"); //NS newCell2.innerHTML = "£ "; var newCell3 = document.createElement('TD'); newCell3.setAttribute("className", "consoleBodyText"); newCell3.setAttribute("class", "consoleBodyText"); //NS newCell3.innerHTML = "£ "; // add new table row to table newRow.appendChild(newCell); newRow.appendChild(newCell2); newRow.appendChild(newCell3); theTable.tBodies[0].appendChild(newRow); incrementCurrent(); }