
		function schedule(event)
		{
			var LoanAmountControl;
			var AnnualInterestRateControl;
			var DownPaymentControl;
			var TermOfLoanControl;
			var MonthlyPaymentControl;
			var TaxesControl;
			var InsuranceControl;
			var AssociationFeeControl;
			var Form;
			
			if (document.getElementById)
			{
				LoanAmountControl = document.getElementById("LoanAmount");
				AnnualInterestRateControl = document.getElementById("AnnualInterestRate");
				DownPaymentControl = document.getElementById("DownPayment");
				TermOfLoanControl = document.getElementById("TermOfLoan");
				MonthlyPaymentControl = document.getElementById("MonthlyPayment");
				TaxesControl = document.getElementById("Taxes");
				InsuranceControl = document.getElementById("Insurance");
				AssociationFeeControl = document.getElementById("AssociationFee");
				Form = document.getElementById("form1");
			}	
			else
			{
				LoanAmountControl = document.forms["form1"].LoanAmount;
				AnnualInterestRateControl = document.forms["form1"].AnnualInterestRate;
				DownPaymentControl = document.forms["form1"].DownPayment;
				TermOfLoanControl = document.forms["form1"].TermOfLoan;
				MonthlyPaymentControl = document.forms["form1"].MonthlyPayment;
				TaxesControl = document.forms["form1"].Taxes;
				InsuranceControl = document.forms["form1"].Insurance;
				AssociationFeeControl = document.forms["form1"].AssociationFee;
				Form = document.forms["form1"];
			}
			
			while (LoanAmountControl.value.search(/^\s+/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/^\s+/, "");
			while (LoanAmountControl.value.search(/\s+$/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/\s+$/, "");	
			while (LoanAmountControl.value.search(/\,/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/\,/, "");		
			while (AnnualInterestRateControl.value.search(/^\s+/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/^\s+/, "");
			while (AnnualInterestRateControl.value.search(/\s+$/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/\s+$/, "");
			while (AnnualInterestRateControl.value.search(/\,/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/\,/, "");			
			while (DownPaymentControl.value.search(/^\s+/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/^\s+/, "");
			while (DownPaymentControl.value.search(/\s+$/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/\s+$/, "");
			while (DownPaymentControl.value.search(/\,/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/\,/, "");	
			while (TermOfLoanControl.value.search(/^\s+/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/^\s+/, "");
			while (TermOfLoanControl.value.search(/\s+$/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/\s+$/, "");
			while (TermOfLoanControl.value.search(/\,/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/\,/, "");
			while (MonthlyPaymentControl.value.search(/^\s+/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/^\s+/, "");
			while (MonthlyPaymentControl.value.search(/\s+$/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/\s+$/, "");
			while (MonthlyPaymentControl.value.search(/\,/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/\,/, "");
			while (TaxesControl.value.search(/^\s+/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/^\s+/, "");
			while (TaxesControl.value.search(/\s+$/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/\s+$/, "");
			while (TaxesControl.value.search(/\,/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/\,/, "");
			while (InsuranceControl.value.search(/^\s+/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/^\s+/, "");
			while (InsuranceControl.value.search(/\s+$/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/\s+$/, "");
			while (InsuranceControl.value.search(/\,/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/\,/, "");
			while (AssociationFeeControl.value.search(/^\s+/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/^\s+/, "");
			while (AssociationFeeControl.value.search(/\s+$/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/\s+$/, "");
			while (AssociationFeeControl.value.search(/\,/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/\,/, "");			
				
			if ((parseFloat(LoanAmountControl.value) <= 0) || (LoanAmountControl.value == "") || (!LoanAmountControl.value.match(regFloat)))
			{
				alert('The Loan Amount specified is not valid. You need to calculate the loan before viewing the Amortization Schedule.');
				LoanAmountControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if ((parseFloat(AnnualInterestRateControl.value) <= 0) || (parseFloat(AnnualInterestRateControl.value) > 1000) || (AnnualInterestRateControl.value == "") || (!AnnualInterestRateControl.value.match(regFloat)))
			{
				alert('The Annual Interest Rate specified is not valid.');
				AnnualInterestRateControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if (!DownPaymentControl.value.match(regFloat))
			{
				alert('The Down Payment specified is not valid.');
				DownPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if ((parseFloat(LoanAmountControl.value) > 0) && (parseFloat(DownPaymentControl.value) > parseFloat(LoanAmountControl.value)))
			{
				alert('The Down Payment cannot be greater than the Loan Amount.');
				DownPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}
			if ((TermOfLoanControl.value == 0) || (TermOfLoanControl.value == "") || (!TermOfLoanControl.value.match(regInt)))
			{
				alert('The Term of Loan specified is not valid.');
				TermOfLoanControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}			
			if ((parseFloat(MonthlyPaymentControl.value) <= 0) || (MonthlyPaymentControl.value == "") || (!MonthlyPaymentControl.value.match(regFloat)))
			{
				alert('The Monthly Payment specified is not valid. You need to calculate the loan before viewing the Amortization Schedule.');
				MonthlyPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}				
			return true;
		}	


		function ValidSubmit(event)
		{
			var LoanAmountControl;
			var AnnualInterestRateControl;
			var DownPaymentControl;
			var TermOfLoanControl;
			var MonthlyPaymentControl;
			var TaxesControl;
			var InsuranceControl;
			var AssociationFeeControl;
			
			if (document.getElementById)
			{
				LoanAmountControl = document.getElementById("LoanAmount");
				AnnualInterestRateControl = document.getElementById("AnnualInterestRate");
				DownPaymentControl = document.getElementById("DownPayment");
				TermOfLoanControl = document.getElementById("TermOfLoan");
				MonthlyPaymentControl = document.getElementById("MonthlyPayment");
				TaxesControl = document.getElementById("Taxes");
				InsuranceControl = document.getElementById("Insurance");
				AssociationFeeControl = document.getElementById("AssociationFee");
			}	
			else
			{
				LoanAmountControl = document.forms["form1"].LoanAmount;
				AnnualInterestRateControl = document.forms["form1"].AnnualInterestRate;
				DownPaymentControl = document.forms["form1"].DownPayment;
				TermOfLoanControl = document.forms["form1"].TermOfLoan;
				MonthlyPaymentControl = document.forms["form1"].MonthlyPayment;
				TaxesControl = document.forms["form1"].Taxes;
				InsuranceControl = document.forms["form1"].Insurance;
				AssociationFeeControl = document.forms["form1"].AssociationFee;
			}
			
			while (LoanAmountControl.value.search(/^\s+/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/^\s+/, "");
			while (LoanAmountControl.value.search(/\s+$/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/\s+$/, "");	
			while (LoanAmountControl.value.search(/\,/) >= 0)		
				LoanAmountControl.value = LoanAmountControl.value.replace(/\,/, "");		
			while (AnnualInterestRateControl.value.search(/^\s+/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/^\s+/, "");
			while (AnnualInterestRateControl.value.search(/\s+$/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/\s+$/, "");
			while (AnnualInterestRateControl.value.search(/\,/) >= 0)		
				AnnualInterestRateControl.value = AnnualInterestRateControl.value.replace(/\,/, "");			
			while (DownPaymentControl.value.search(/^\s+/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/^\s+/, "");
			while (DownPaymentControl.value.search(/\s+$/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/\s+$/, "");
			while (DownPaymentControl.value.search(/\,/) >= 0)		
				DownPaymentControl.value = DownPaymentControl.value.replace(/\,/, "");	
			while (TermOfLoanControl.value.search(/^\s+/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/^\s+/, "");
			while (TermOfLoanControl.value.search(/\s+$/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/\s+$/, "");
			while (TermOfLoanControl.value.search(/\,/) >= 0)		
				TermOfLoanControl.value = TermOfLoanControl.value.replace(/\,/, "");
			while (MonthlyPaymentControl.value.search(/^\s+/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/^\s+/, "");
			while (MonthlyPaymentControl.value.search(/\s+$/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/\s+$/, "");
			while (MonthlyPaymentControl.value.search(/\,/) >= 0)		
				MonthlyPaymentControl.value = MonthlyPaymentControl.value.replace(/\,/, "");
			while (TaxesControl.value.search(/^\s+/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/^\s+/, "");
			while (TaxesControl.value.search(/\s+$/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/\s+$/, "");
			while (TaxesControl.value.search(/\,/) >= 0)		
				TaxesControl.value = TaxesControl.value.replace(/\,/, "");
			while (InsuranceControl.value.search(/^\s+/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/^\s+/, "");
			while (InsuranceControl.value.search(/\s+$/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/\s+$/, "");
			while (InsuranceControl.value.search(/\,/) >= 0)		
				InsuranceControl.value = InsuranceControl.value.replace(/\,/, "");
			while (AssociationFeeControl.value.search(/^\s+/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/^\s+/, "");
			while (AssociationFeeControl.value.search(/\s+$/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/\s+$/, "");
			while (AssociationFeeControl.value.search(/\,/) >= 0)		
				AssociationFeeControl.value = AssociationFeeControl.value.replace(/\,/, "");			
				
			if (!LoanAmountControl.value.match(regFloat))
			{
				alert('The Loan Amount specified is not valid.');
				LoanAmountControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if ((parseFloat(AnnualInterestRateControl.value) == 0) || (parseFloat(AnnualInterestRateControl.value) > 1000) || (AnnualInterestRateControl.value == "") || (!AnnualInterestRateControl.value.match(regFloat)))
			{
				alert('The Annual Interest Rate specified is not valid.');
				AnnualInterestRateControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if (!DownPaymentControl.value.match(regFloat))
			{
				alert('The Down Payment specified is not valid.');
				DownPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}		
			if ((parseFloat(LoanAmountControl.value) > 0) && (parseFloat(DownPaymentControl.value) > parseFloat(LoanAmountControl.value)))
			{
				alert('The Down Payment cannot be greater than the Loan Amount.');
				DownPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}
			if ((TermOfLoanControl.value == 0) || (TermOfLoanControl.value == "") || (!TermOfLoanControl.value.match(regInt)))
			{
				alert('The Term of Loan specified is not valid.');
				TermOfLoanControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}			
			if (!TaxesControl.value.match(regFloat))
			{
				alert('The Tax Rate specified is not valid.');
				TaxesControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}
			if (!InsuranceControl.value.match(regFloat))
			{
				alert('The Insurance Rate specified is not valid.');
				InsuranceControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}
			if (!AssociationFeeControl.value.match(regFloat))
			{
				alert('The Home Owners Association Fee specified is not valid.');
				AssociationFeeControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}
			if (!MonthlyPaymentControl.value.match(regFloat))
			{
				alert('The Monthly Payment specified is not valid.');
				MonthlyPaymentControl.focus();
				event.returnValue = false;
				event.cancelBubble = true;
				return false;
			}			
			return true;	
		}	

		function clearForm(event) {
			var element;
			for (var i = 0; i < document.forms[0].elements.length; i++)
			 {
				element = document.forms[0].elements[i];
				if (element.type == "text" || element.type == "password" || element.type == "textarea") element.value = '';
				else if (element.type.indexOf("select") != -1) element.selectedIndex = -1;
				else if (element.type == "checkbox" && element.checked) element.checked = false;
				else if (element.type == "radio" && element.checked == true) element.checked = false;
			}
			event.returnValue = false;
			event.cancelBubble = true;
			return false;
		}
		