function numbersonly() {

if (event.keyCode < 48 || event.keyCode > 57) return false;

}


function numbersandpointonly(){

if (event.keyCode == 46) {
	return true; }

if (event.keyCode < 48 || event.keyCode > 57)  return false;

}

<!--

	function parseInteger(val) {
		
		var i;

		do {
			i = val.indexOf(',');
			val = val.substring(0, i) + val.substring(i+1)	
		} while (val.indexOf(',') != -1);

		return parseInt(val);
	}


	function calculate(){
		var calcs = 12; 
		var loan = 0;
		var rate = 0;
		var intloan = "0"; 
		var intrate = "0"; 
		var term = "0"; 
		var intterm = "0"; 
		var monthlyterm; 
		var rate100 = "0"; 
		var monthlyrepayments = "0"; 
		var mortgagetype = 1;
		
		loan = document.mortgageform.loanvalue.value;
		rate = document.mortgageform.interest.value + '.'+ document.mortgageform.interest2.value;
		
		
		mortgagetype = document.mortgageform.mortgagetype.selectedIndex; 
		
		if (!parseInteger(loan) > 0){
			alert("Please enter a value for the loan, no spaces or commas");
			document.mortgageform.loanvalue.focus();
			return false;
		}

		if (!parseInteger(rate) > 0|isNaN(rate)){
			alert("Please enter a value for the interest rate");
			document.mortgageform.interest.focus();
			return false;
		}

		intloan = parseInteger(loan);
		
		if (!intloan > 0){
			alert("Please enter a number here");
			document.mortgageform.loanvalue.focus();
			return false;
		}
		
		if (!intrate > 0){
			alert("Please enter a number here");
			document.mortgageform.interest.focus();
			return false;
		}
		
		term = document.mortgageform.mortgage[document.mortgageform.mortgage.selectedIndex].value;

		intterm = parseInt(term);
		
		rate100 = (intrate / 100)
		
		monthlyrepayments = ((intloan * rate) / (1200))
		
		monthlyrepayments = (monthlyrepayments * 100);
		monthlyrepayments = Math.round(monthlyrepayments);
		monthlyrepayments = (monthlyrepayments / 100);
		monthlyrepayments = padZero(monthlyrepayments);	
		
		
		if (mortgagetype == 0) { 
			document.mortgageform.CRGanswer.value = monthlyrepayments;
			return false; }
			
		
		if (mortgagetype == 1) { 
			var topline = (intloan * rate * 12);
			var mid = Math.pow((1+(rate/1200)), (-term * 12));
			mid = (100 * 12 * (1 - mid));
			var answer = ((topline / mid) / 12);
			answer = (answer * 100);
			answer = Math.round(answer);
			answer = (answer / 100);
			answer = padZero(answer);
			document.mortgageform.CRGanswer.value = answer; }
		
	return false;			
	}
	
	
	function range1(){
		document.calculationform.range1res.value = ""

		var income1 = 0;
		var income2 = "";
		var newincome1 = 0 
		var newincome2 = 0 
		var bonus1 = "";
		var bonus2 = "";
		var newbonus1 = 0 
		var newbonus2 = 0 
		var inc9 = 0
		var rgeres1 = 0 
		var rgeres2 = 0
		var intres1 = 0
		var intres2 = 0
		
		
		
		income1 = document.calculationform.income1.value;
		income2 = document.calculationform.income2.value;
		bonus1 = document.calculationform.commission1.value;
		bonus2 = document.calculationform.commission2.value;
		
		if (bonus1.length == 0){
			bonus1 = "0"
		}
		
		if (bonus2.length == 0){
			bonus2 = "0"
		}
		
		if (income2.length == 0){
			income2 = "0"
		}
		
		newincome1 = parseInteger(income1);
		newincome2 = parseInteger(income2);
		newbonus1 = parseInteger(bonus1);
		newbonus2 = parseInteger(bonus2);
		
		if (!newincome1 > 0){
			alert("Please enter a value for your annual income, no spaces or commas");
			document.calculationform.income1.focus();
			return false;
			}

		if (income2.length > 1 && !newincome2 > 0) {
			alert("Please enter a number here");
			document.calculationform.income2.focus();
			return false;
		}else{	
			if(income2.length > 1 && newincome2 > 0 && newincome2 > newincome1){
				newincome1 = parseInt(income2);
				newincome2 = parseInt(income1);
			}
		}

		if (bonus1.length > 1 && !newbonus1 > 0) {
			alert("Please enter a number here");
			document.calculationform.commission1.focus();
			return false;
			}
		
		if (bonus2.length > 1 && !newbonus2 > 0) {
			alert("Please enter a number here");
			document.calculationform.commission2.focus();
			return false;
			}
		
		if (newbonus1 >= 1){
			newbonus1 = (newbonus1 * 0.5)
			}else{
			newbonus1 == 0
			}
		
		if (newbonus2 >= 1){
			newbonus2 = (newbonus2 * 0.5)
			}else{
			newbonus2 == 0
			}

		newincome1 = (newincome1 + newbonus1)
		rgeres1 = newincome1 
		newincome2 = (newincome2 + newbonus2)
		rgeres2 = newincome2 
		
		var res1 = (newincome1 + newincome2);
		var res2
		res1 = (res1 * 2.5);
		res2 = (newincome1 * 3.25);
		
		intres1 = ((rgeres1 * 4) + rgeres2)
		intres2 = ((rgeres1 + rgeres2) * 2.75)
		
		
		if (res1 == res2){
			document.calculationform.range1res.value = padZero(res1)
		}else if(res1 > res2){ 
			document.calculationform.range1res.value = padZero(res1)
		}else{
			document.calculationform.range1res.value = padZero(res2)
		}
		
		if (intres1 == intres2){
			document.calculationform.range2res.value = padZero(intres1)
		}else if(intres1 > intres2){
			document.calculationform.range2res.value = padZero(intres1)
		}else{
			document.calculationform.range2res.value = padZero(intres2)
		}
		
		return false;
	}
	
	function padZero(n){
		var a;
		n = n.toString();
		if (n.indexOf(".")!=-1) {
			a=n.split(".");
			n=(a[1].length==1)?n+"0":n;
		}
		return n;
	}
	
	function doCalculate() {calculate();}
	
	function dorange() {range1();}
		
//-->