function checkFields() 
{
	var amount_top=document.getElementById('amount').value;
	var purpose_top=document.getElementById('purpose').value;
	var homeowner_top=document.getElementById('homeowner').value;	

	if (amount_top==0 || purpose_top==0 || purpose_top==1 || homeowner_top==0) {
		document.getElementById('errormsg').style.visibility="visible";
		//alert('Make sure you select all the fields:\n\n - Loan Amount \n - Loan Purpose \n - Home Owner?');
		return false;
	} else {
		document.getElementById('errormsg').style.visibility="hidden";
	}
	return true;
}

//Check form for Car Loan
function checkCarFields() {
var amount=document.getElementById('amount_car').value;

//CHECK IF NUMBER
var ValidChars = "0123456789,.";
var IsNumber=true;
var Char;
var sText = amount;
for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
      amount = "";
	  return false;
      }
}
//Continue with check
	if (amount=="") {
		document.getElementById('amount_car').style.border="2px solid #FF0000";
		return false;
	} else {	
	
		var newCarLoan = document.getElementById('amount_car').value;
		var newURL = "process.php?purpose=sloan&amount="+newCarLoan;
		location.href=newURL;
	}
	return false;
}

function showCarLoan()
{
	document.getElementById('carloan').style.visibility="visible";
	return false;
}



//Check form for Debt Consolidation
function checkDebtFields() {
var amount=document.getElementById('amount_debt').value;

var ValidChars = "0123456789,.";
var IsNumber=true;
var Char;
var sText = amount;
for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
      amount = "";
	  return false;
      }
}
//Continue with check
	if (amount=="") {
		document.getElementById('amount_debt').style.border="2px solid #FF0000";
		return false;
	} else {
		var newDebtLoan = document.getElementById('amount_debt').value;
		var newURL = "process.php?purpose=dconsolidation&amount="+newDebtLoan;
		location.href=newURL;
	}
	return true;
}

function showDebtLoan()

{

	document.getElementById('debtconsolidation').style.visibility="visible";

	return false;

}