				function changeMortCurrency()
				{
					form = document.forms.formMortgage;
					currency = form.currency.options[form.currency.selectedIndex].value;
					if(currency == "usd")
						currency = "$";
					else if(currency == "eur")
						currency = "&euro;";
					else if(currency == "naf")
						currency = "&fnof;";
					
					document.getElementById("currency_1").innerHTML = currency + "&nbsp;";
					document.getElementById("currency_2").innerHTML = currency + "&nbsp;";
					
					return currency;
				}
				
				function calcMortgage()
				{
					form = document.forms.formMortgage;
					
					currency 		= changeMortCurrency();
					
					amount 			= form.amount.value;
					downpayment		= form.downpayment.value;
					amount 			= (((100-downpayment)/100) * amount);
					interest 		= form.interest.value;
					amortization	= form.payment.value;
					
					if(amount > 0 && interest > 0 && amortization > 0)
					{
						payments = amortization * 12;
						intRate = (interest/100) / 12;
						months = amortization * 12;
						 
						payment = Math.round((amount*intRate)/(1-Math.pow(1+intRate,(-1*months))));
						
						
						document.getElementById("paymentamount").innerHTML = payment;
						document.getElementById("monthlypayment").style.display = "";
						document.getElementById("preapprovelink").style.display = "";
						
					}
				}
				
				function preApprove()
				{
					form = document.forms.formMortgage;
					
					form.onSubmit = "";
					form.submit();
				}	
