
   function clearDefault(clearCell) {
  if (clearCell.defaultValue==clearCell.value) clearCell.value = ""}
   
    function Calculate()
    {
        form = document.form1
		HomePrice = 0		
        HomePrice = form.HomePrice.value
        DownPayment = form.DownPayment.value

       if (DownPayment == "")  {
          DownPayment = "0"
   	   }
       if (HomePrice == "")  {
          HomePrice = "0"
   	   }
        AnnualInterestRate = form.InterestRate.value / 100
        Years = form.NumberOfYears.value
        MonthRate = AnnualInterestRate / 12
        NumPayments = Years * 12
        LoanAmount = HomePrice - DownPayment
        
        MonthlyPandI = Math.floor((LoanAmount*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100
		
	      
        form.LoanAmount.value = LoanAmount
        form.NumberOfPayments.value = NumPayments
        form.MonthlyPandI.value = MonthlyPandI
    }