﻿function SendData() {

	var txbExistingLienAmount = document.getElementById("txbExistingLienAmount");
	var txbCashOutAmount = document.getElementById("txbCashOutAmount");
	var LoanAmount = document.getElementById("LoanAmount");
	var PurchasePrice = document.getElementById("PurchasePrice");
	var txbDownPaymentAmount = document.getElementById("txbDownPaymentAmount");
	var txbZip = document.getElementById("txbZip");
	var CreditScore = document.getElementById("CreditScore");

	var BorFirstName = document.getElementById("BorFirstName");
	var BorLastName = document.getElementById("BorLastName");
	var BorEmail = document.getElementById("BorEmail");
	var lblDownPaymentAmount = document.getElementById("lblDownPaymentAmount");
	var lblExistingLienAmount = document.getElementById("lblExistingLienAmount");

	//if (CreditScore == null) return;
	if (txbDownPaymentAmount == null) return;
	if (txbZip == null) return;
	if (PurchasePrice == null) return;
	if (txbExistingLienAmount == null) return;
	if (txbCashOutAmount == null) return;
	if (LoanAmount == null) return;

	if (BorFirstName == null) return;
	if (BorLastName == null) return;
	if (BorEmail == null) return;
	if (lblDownPaymentAmount == null) return;
	if (lblExistingLienAmount == null) return;

	var s = "firstname=" + BorFirstName.value;
	s += "&lastname=" + BorLastName.value;
	s += "&email=" + BorEmail.value;

	if (lblDownPaymentAmount.style.display != 'none') {
		s += "&propertyvalue=" + PurchasePrice.value;
		s += "&downpayment=" + txbDownPaymentAmount.value;
		s += "&loanamount=" + LoanAmount.value;
		s += "&ttype=p";
	}
	else if (lblDownPaymentAmount.style.display == 'none' && lblExistingLienAmount.style.display == 'none') {
		s += "&propertyvalue=" + PurchasePrice.value;
		s += "&loanamount=" + LoanAmount.value;
		s += "&ttype=r";
	}
	else if (lblExistingLienAmount.style.display != 'none') {
		s += "&propertyvalue=" + PurchasePrice.value;
		s += "&existingloanamount=" + txbExistingLienAmount.value;
		s += "&cashoutamount=" + txbCashOutAmount.value;
		s += "&loanamount=" + LoanAmount.value;
		s += "&ttype=co";
	}
	s += "&zip=" + txbZip.value;
	s += "&creditscore=" + CreditScore.value;
	s = "pricing.htm?" + s;
	location.replace(s);
}