function calculatePayment(form)
{
	mortcalc = document.getElementById('MortgageCalculator');
	CALC=false;
for (ic=0;ic<5;ic++) {
if (mortcalc.mortgagetype[0].checked) CALC=true;
}
/** If Interest Only **/
    princ = form.price.value;
    intRate = (form.ir.value) / 12;
    months = form.term.value * 12;
	if (isNaN(princ) || isNaN(intRate) || isNaN(months)) {
		form.pmt.value = 'Invalid details';
	}	
	else {
    	var pmtAmount = Math.floor(princ*intRate,(-1*months)*100)/100;
		var result = pmtAmount.toFixed(2);
		if (isNaN(result))
			form.pmt.value = 'Invalid details';
		else
			form.pmt.value = '£ ' + result;
	}

if (mortcalc.mortgagetype[1].checked) CALC=false;
/** If repayment **/
if (CALC) {
    princ = form.price.value;
    intRate = (form.ir.value/100) / 12;
    months = form.term.value * 12;
	if (isNaN(princ) || isNaN(intRate) || isNaN(months)) {
		form.pmt.value = 'Invalid details';
	}
	else {
		var pmtAmount = Math.floor((princ*intRate)/(1-Math.pow(1+intRate,(-1*months)))*100)/100;
		var result = pmtAmount.toFixed(2);
    		if (isNaN(result))
			form.pmt.value = 'Invalid details';
		else
			form.pmt.value = '£ ' + result; 
	}
}

}