function calculate() {
var userinput = document.calculator.input.value;
document.calculator.input.value = eval(userinput);
}
function plus() {
document.calculator.input.value += '+';
}
function minus() {
document.calculator.input.value += '-';
}
function mult() {
document.calculator.input.value += '*';
}
function div() {
document.calculator.input.value += '/';
}
function decimal() {
document.calculator.input.value += '.';
}
function num(x) {
document.calculator.input.value += x;
}
function plus_or_minus() {
document.calculator.input.value *= -1;
}
function loan()
{
  var monthly = document.rate.value / 12 / 100;
  var start = 1;
  var length = 1 + monthly;
  for (i=0; i<document.interest.months.value; i++)
  {	start = start * length
  }
var payment = document.payment.value = Number(document.amount.value * monthly / ( 1 - (1/start)))
document.payment.value = payment.toFixed(2);
var totrepay = Number(document.payment.value) * i;
document.totrepay.value = totrepay.toFixed(2);
var totint = totrepay - document.amount.value;
document.totint.value = totint.toFixed(2);
}