function calc1() {
var amount = document.getElementById("amount").value
var time = document.getElementById("time").value
var procent_lo = 6.35
var procent_hi = 6.35
var result, procent, manadsranta, z

if (time < 10) {
procent = procent_lo
} else {
procent = procent_hi
}

if (!isNaN(amount) && (amount.length > 0)) {
manadsranta=procent/1200
z = Math.pow(1 + manadsranta,time*12)
result = Math.round((amount * z)/((z-1)/manadsranta)+25)
document.getElementById("result").value = result
}
}

function calc2() {
var amount = document.getElementById("amount2").value
var cost = document.getElementById("cost").value
var procent_lo = 6.35
var procent_hi = 6.35
var result, procent, manadsranta, z, time

if (time < 10) {
procent = procent_lo
} else {
procent = procent_hi
}

if ( (!isNaN(amount) && (amount.length > 0)) && (!isNaN(cost) && (cost.length > 0)) ) {

if (amount/cost/12 > 48) {
result = Math.round(((amount*1.10)/cost)/12)
} else {
result = Math.round(((amount*1.20)/cost)/12)
}

document.getElementById("result2").value = result + " år"
}
}
