function putupwarning() {
	alert("Mortgage Insurance is not available for loans with a loan to value ratio above 100%. These loans typically carry higher interest rates. Please lower the amount of debts that you wish to consolidate.");
}

function mtgIns(LoanAmt,TermIndex)
	{
	var x;
	var dwnpmt;
	
	dwnpmt = 1 - (parseFloat(LoanAmt) / parseFloat(document.forms[0].CurrentValue.value));
	dwnpmt = Math.round(dwnpmt*10000)/100;
	//alert(dwnpmt + " percent");
	
if (LoanAmt > ""){

if (TermIndex == 0){
		if (dwnpmt < 0) {
			putupwarning();
			return 0;
			}
		if ((dwnpmt >= 0)&& (dwnpmt < 5)){
				return (.96);
				}
		if ((dwnpmt >= 5)&& (dwnpmt < 10)) {
				return (.78);
				}
		if ((dwnpmt >= 10)&& (dwnpmt < 15)){
				return (.52);
				}
		if ((dwnpmt >= 15)&& (dwnpmt < 20)){
				return (.32);
				}
		if (dwnpmt >= 20) {
				return (0);
				}
	}

	if (TermIndex == 1) {
		if (dwnpmt < 0) {
			putupwarning();
			return 0
			}
		if ((dwnpmt >= 0)&& (dwnpmt < 5)){
				return (.85);
				}
		if ((dwnpmt >= 5)&& (dwnpmt < 10)) {
				return (.67);
				}
		if ((dwnpmt >= 10)&& (dwnpmt < 15)){
				return (.41);
				}
		if ((dwnpmt >= 15)&& (dwnpmt < 20)){
				return (.21);
				}
		if (dwnpmt >= 20) {
				return (0);
				}
	}
	
	if (TermIndex == 2) {
		if (dwnpmt < 0) {
			putupwarning();
			return 0
			}
		if ((dwnpmt >= 0)&& (dwnpmt < 5)){
				return (.80);
				}
		if ((dwnpmt >= 5)&& (dwnpmt < 10)) {
				return (.56);
				}
		if ((dwnpmt >= 10)&& (dwnpmt < 15)){
				return (.23);
				}
		if ((dwnpmt >= 15)&& (dwnpmt < 20)){
				return (.19);
				}
		if (dwnpmt >= 20) {
				return (0);
				}
	}
	
	if ((TermIndex == 3) || (TermIndex == 4)){
		if (dwnpmt < 0) {
			putupwarning();
			return 0
			}
		if ((dwnpmt >= 0)&& (dwnpmt < 5)){
				return (.80);
				}
		if ((dwnpmt >= 5)&& (dwnpmt < 10)) {
				return (.56);
				}
		if ((dwnpmt >= 10)&& (dwnpmt < 15)){
				return (.23);
				}
		if ((dwnpmt >= 15)&& (dwnpmt < 20)){
				return (.19);
				}
		if (dwnpmt >= 20) {
				return (0);
				}
	}
	
	}
}