// JavaScript Document

// MORTGAGE GUIDE CALC ============

	var TotalAmountBorrowed = '';

	var OutstandingBalance = '';

	var LoanDurationY = '';

	var LoanDurationM = '';

	var BaseRate = '';

	var MonthlyNoInt = '';

	var YearCapital = '';

	var TotalInterest = '0';

	var TotalInterest1 = '';

	function calcM()
		{
		LoanDurationY = window.document.getElementById('FLDduration').value;
		LoanDurationM = window.document.getElementById('FLDduration').value*12;
		MonthlyNoInt = window.document.getElementById('FLDamount').value/LoanDurationM;
		TotalAmountBorrowed = window.document.getElementById('FLDamount').value;
		YearCapital = parseInt(TotalAmountBorrowed/LoanDurationY);
		OutstandingBalance = window.document.getElementById('FLDamount').value;
		BaseRate = window.document.getElementById('FLDintrate').value/100;

		TotalInterest1 = TotalAmountBorrowed*BaseRate;

		while (OutstandingBalance > 1)
			{
			OutstandingBalance = OutstandingBalance - YearCapital;
			TotalInterest = parseInt(TotalInterest)+parseInt(OutstandingBalance*BaseRate);
			}

		FinalMonthly = parseInt(parseInt(TotalInterest1)+parseInt(TotalInterest)+parseInt(TotalAmountBorrowed))/LoanDurationM;
		FinalMonthly2 = parseInt(parseInt(TotalAmountBorrowed)*BaseRate)/12;
	//REPAYMENT
		window.document.getElementById('MonthlyPayment').innerHTML = "&pound;"+Math.round(FinalMonthly)+'*';
	//INTEREST ONLY
		window.document.getElementById('MonthlyPayment2').innerHTML = "&pound;"+Math.round(FinalMonthly2)+'*';
	//DEPOSIT REQD
		window.document.getElementById('DepReqd').innerHTML = "&pound;"+Math.round(TotalAmountBorrowed)*.1;
	//RESET VARS	
			TotalAmountBorrowed = '';
			OutstandingBalance = '';
			LoanDurationY = '';
			LoanDurationM = '';
			BaseRate = '';
			MonthlyNoInt = '';
			YearCapital = '';
			TotalInterest = '0';
			TotalInterest1 = '';	
			FinalMonthly = '';	
			FinalMonthly2 = '';
		}

		function Frst(){
			window.document.getElementById('MonthlyPayment').innerHTML = '';
			window.document.getElementById('MonthlyPayment2').innerHTML = '';
			window.document.getElementById('DepReqd').innerHTML = '';	
			}

//END MORTGAGE CALC===================