function isNum(passedVal) {	
			if (passedVal == "") {
				return false
			}
			for (i=0; i<passedVal.length; i++) {
				if (passedVal.charAt(i) < "0") {
					return false
				}
				if (passedVal.charAt(i) > "9") {
					return false
				}
			}
			return true
		}
		
		function validNumber(blah) {					
			if (blah == "") {
				return true
			}
			if (isNum(blah)) {						// Check if blah is numeric
				return true
			}
			return false
		}

function stampduty()
{
var topay;

if (!validNumber(document.stamp_duty.houseprice.value)) {
				alert("Please enter a property value in numbers only")
				document.stamp_duty.houseprice.focus()
				document.stamp_duty.houseprice.select()
				return false
			}

houseprice = Number(document.stamp_duty.houseprice.value);

if (houseprice <= 0)  {
alert ("Please enter a property value greater than zero");
document.stamp_duty.houseprice.value = '';
document.stamp_duty.pay.value = '';
return;
}

houseprice = Math.round(houseprice*100)/100;
//disadvantaged = (document.stamp_duty.disadvantaged[0].checked) ? 175372 : 175373;

//if (houseprice <= disadvantaged) {
//topay = 0;
//} 
if (houseprice <= 125000) {
topay = 0;
} 
//if (houseprice > disadvantaged && houseprice <= 250000) {
//topay = houseprice * 0.01;
//} 
if (houseprice > 125001 && houseprice <= 250000) {
topay = houseprice * 0.01;
}
if (houseprice > 250001 && houseprice <= 500000) {
topay = houseprice * 0.03;
}
if (houseprice > 500001) {
topay = houseprice * 0.04;
}

document.stamp_duty.pay.value = topay;
}

