	function getAmortization(a,n,p) {
		var i=0;
		var sCR=String.fromCharCode(13);
		//var sTab=String.fromCharCode(27);

		/* Calculate amortization and write table to text area **/
		var payment = getPayment(a,n,p);
		return sCR + (Math.round(payment*100)/100) + sCR + sCR;
	}

	function getSpaces(n) {
		var i=0; 
		var sSpaces="";
		for (i=0;i<n;i++) {sSpaces += " ";}
		return sSpaces;
	}

	function getPayment(a,n,p) {
		/* Calculates the monthly payment from annual percentage
		   rate, term of loan in months and loan amount. **/
		var acc=0;
		var base = 1 + p/1200;
		for (i=1;i<=n;i++) 
			{ acc += Math.pow(base,-i); }
		return a/acc;
	}