// repayment types// 0 - interest only// 1 - normal repaymentfunction calculateRepayments(){		loan = parseInt(document.calcform.loan.value);		rate = document.calcform.rate.value;		mtype = document.calcform.mortgagetype.selectedIndex; 				if (!parseInt(loan) > 0){			alert("Please enter a value for the loan. Must be whole pounds.");			return false;		}		if (!parseInt(rate) > 0 | isNaN(rate)){			alert("Please enter an interest rate.");			return false;		}		term = parseInt(document.calcform.period.value);		rate100 = (rate / 100)		// (loan amount * decimal rate) / 12		monthlyrepayments = ((loan * rate100) / 12);				if (mtype == 0) { 			monthlyrepayments = (Math.round(monthlyrepayments * 100)) / 100;			document.calcform.answer.value = monthlyrepayments;			return false; 		} else if (mtype == 1) { // Full Repayment 			var topline = (loan * rate * 12);			var midline = Math.pow((1+(rate/1200)), (-term * 12));			midline = (100 * 12 * (1 - midline));			var answer = ((topline / midline) / 12);			answer = (Math.round(answer * 100)) / 100;			document.calcform.answer.value = answer; 		}			return false;			}function calculateRange(){		income1 = parseInt(document.rangeform.income1.value);		income2 = parseInt(document.rangeform.income2.value);		bonus = parseInt(document.rangeform.income3.value);		commitment1 = parseInt(document.rangeform.commitments1.value);		commitment2 = parseInt(document.rangeform.commitments2.value);				if(isNaN(income1)){			income1 = 0;		}				if(isNaN(income2)){			income2 = 0;		}				if(isNaN(commitment1)) {			commitment1 = 0;		}				if(isNaN(commitment2)) {			commitment2 = 0;		}				if (bonus >= 1){			bonus = (bonus * 0);		}else{			bonus = 0;		}				if(income2=0){		   totalincome = (income1 * 4);		}else{		   totalincome = (income1 + income2) * 3.5 + bonus;		}		low = 0;				high = 89000;				document.rangeform.low.value = low;		document.rangeform.high.value = high;				return false;	}
