function round(x) {
  return Math.round(x*100)/100;
}
function uk(form) {
a=eval(form.box1.value)      //Box 1 - Cost of plot
b=0                       //Box 2 - Country
c=eval(form.box3.value)      //Box 3 - Term in years
e=500                    //Box 5 - Reservation Fee
f=4500                    //Box 6 - Balance of deposit
d=e+f                     //Box 4 - Total deposit
g=(a-d)/(c*4)            //Box 7 - Monthly instalment

// Check that the result is a finite number. If so, display the results
if (!isNaN(g) && 
        (g != Number.POSITIVE_INFINITY) &&
        (g != Number.NEGATIVE_INFINITY)) {
// Display values on UK side
form.box4.value = round(d)
form.box5.value = round(e)
form.box6.value = round(f)
form.box7.value = round(g)
// Hide values on Other side
form.box44.value = ""
form.box55.value = ""
form.box66.value = ""
form.box77.value = ""
}
    // Otherwise, the user's input was probably invalid, so don't
    // display anything.
    else {
   }
}

function other(form) {
a=eval(form.box1.value)      //Box 1 - Cost of plot
b=0                       //Box 2 - Country
c=eval(form.box3.value)      //Box 3 - Term in years
e=a*0.05                  //Box 5 - Reservation Fee
f=a*0.25                  //Box 6 - Balance of deposit
d=e+f                     //Box 4 - Total deposit
g=(a-d)/(c*4)            //Box 7 - Monthly instalment
// Check that the result is a finite number. If so, display the results
if (!isNaN(g) && 
        (g != Number.POSITIVE_INFINITY) &&
        (g != Number.NEGATIVE_INFINITY)) {
// Display values on Other side
form.box44.value = round(d)
form.box55.value = round(e)
form.box66.value = round(f)
form.box77.value = round(g)
// Hide values on UK side
form.box4.value = ""
form.box5.value = ""
form.box6.value = ""
form.box7.value = ""
}
    // Otherwise, the user's input was probably invalid, so don't
    // display anything.
    else {
    }
}
