function roundNumber(num, dec) { var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); return result; } function calcvic(myfrm, amt) { var total, result; total = 0; if (amt <= 20000) { total = 0.014 * amt; total = roundNumber(total, 2); result = "$" + total; } if (amt >= 20001){ total = 280 + (0.024 * (amt - 20000)); total = roundNumber(total, 2); result = "$" + total; } if (amt >= 115001) { result = "Price is over $115,000"; } myfrm.txtstampduty.value = result; } function calcnt(myfrm, amt) { var total, result; total = 0; if (amt <= 500000) { var x = amt/1000; total = (0.065 * (x*x)) + (21*x); total = roundNumber(total, 2); result = "$" + total; } if (amt >= 500001) { total = amt * 0.054; total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function calctas(myfrm, amt) { var total, result, x, y; x = 0; //bracket amount y = 0; //bracket addition total = 0; if (amt <= 1300) { x = 0; y = 0; total = 20; total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 1301) && (amt <= 10000)) { amt = amt - 1300; x = 1.50; y = 20.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 10001) && (amt <= 30000)) { amt = amt - 10000; x = 2.00; y = 150.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 30001) && (amt <= 75000)) { amt = amt - 30000; x = 2.50; y = 550.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 75001) && (amt <= 150000)) { amt = amt - 75000; x = 3.00; y = 1675.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function calcqld(myfrm, amt) { var total, result, x, y; x = 0; //bracket amount y = 0; //bracket addition total = 0; if (amt <= 20000) { x = 0; y = 0; total = 300; total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 20001) && (amt <= 50000)) { amt = amt - 20000; x = 2.25; y = 300.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 50001) && (amt <= 100000)) { amt = amt - 50000; x = 2.75; y = 975.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function calcnsw(myfrm, amt) { var total, result, x, y; x = 0; //bracket amount y = 0; //bracket addition total = 0; if (amt <= 14000) { x = 0; y = 0; total = 175; total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 14001) && (amt <= 30000)) { amt = amt - 14000; x = 1.50; y = 175.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 30001) && (amt <= 80000)) { amt = amt - 30000; x = 1.75; y = 415.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 80001) && (amt <= 300000)) { amt = amt - 80000; x = 3.50; y = 1290.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function calcwa(myfrm, amt) { var total, result, x, y; x = 0; //bracket amount y = 0; //bracket addition total = 0; if (amt <= 80000) { x = 0; y = 0; total = 1600; total = roundNumber(total, 2); result = "$" + total; } if ((amt >= 80001) && (amt <= 100000)) { amt = amt - 80000; x = 3.00; y = 1600.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function calcact(myfrm, amt) { var total, result, x, y; x = 0; //bracket amount y = 0; //bracket addition total = 0; if (amt <= 100000) { x = 2.00; total = y + ((amt/100) * x); total = roundNumber(total, 2); result = "$" + total; } myfrm.txtstampduty.value = result; } function selstate(state, myfrm, amt) { switch (state) { case "vic": calcvic(myfrm,amt); break; case "nt": calcnt(myfrm,amt); break; case "act": calcact(myfrm,amt); break; case "tas": calctas(myfrm,amt); break; case "qld": calcqld(myfrm,amt); break; case "nsw": calcnsw(myfrm,amt); break; case "wa": calcwa(myfrm,amt); break; case "na": break; default: break; } }