function mtgIns()
	{

if ((document.forms[0].CurrentValue.value > "")&&(document.forms[0].LoanAmt5.value > "")){
	dwnpmtA = ( ( parseFloat(document.forms[0].LoanAmt5.value)/parseFloat(document.forms[0].CurrentValue.value)))*100;
	dwnpmtA = Math.round((dwnpmtA*100)+0.499)/100;
	dwnpmtA = 100 - dwnpmtA;
	//alert (dwnpmtA);

	if ((document.forms[0].loanterm5.options.selectedIndex == 0) || (document.forms[0].loanterm5.options.selectedIndex == 1)) {
		if ((dwnpmtA >= 0) && (dwnpmtA < 5)){
				document.forms[0].mtgInsPmtAmt5.value = .96;
				}
		if ((dwnpmtA >= 5)&& (dwnpmtA < 10)) {
				document.forms[0].mtgInsPmtAmt5.value = .78;
				}
		if ((dwnpmtA >= 10)&& (dwnpmtA < 15)){
				document.forms[0].mtgInsPmtAmt5.value = .52;
				}
		if ((dwnpmtA >= 15)&& (dwnpmtA < 20)){
				document.forms[0].mtgInsPmtAmt5.value = .32;
				}
		if (dwnpmtA >= 20) {
				document.forms[0].mtgInsPmtAmt5.value = 0;
				}
	}
	
	if (document.forms[0].loanterm5.options.selectedIndex == 2){
		if ((dwnpmtA >= 0) && (dwnpmtA < 5)){
				document.forms[0].mtgInsPmtAmt5.value = .96;
				}
		if ((dwnpmtA >= 5)&& (dwnpmtA < 10)) {
				document.forms[0].mtgInsPmtAmt5.value = .78;
				}
		if ((dwnpmtA >= 10)&& (dwnpmtA < 15)){
				document.forms[0].mtgInsPmtAmt5.value = .52;
				}
		if ((dwnpmtA >= 15)&& (dwnpmtA < 20)){
				document.forms[0].mtgInsPmtAmt5.value = .32;
				}
		if (dwnpmtA >= 20) {
				document.forms[0].mtgInsPmtAmt5.value = 0;
				}
	}

	if (document.forms[0].loanterm5.options.selectedIndex == 3) {
		if ((dwnpmtA >= 0) && (dwnpmtA < 5)) {
				document.forms[0].mtgInsPmtAmt5.value = .85;
				}
		if ((dwnpmtA >= 5)&& (dwnpmtA < 10)) {
				document.forms[0].mtgInsPmtAmt5.value = .67;
				}
		if ((dwnpmtA >= 10)&& (dwnpmtA < 15)){
				document.forms[0].mtgInsPmtAmt5.value = .41;
				}
		if ((dwnpmtA >= 15)&& (dwnpmtA < 20)){
				document.forms[0].mtgInsPmtAmt5.value = .21;
				}
		if (dwnpmtA >= 20) {
				document.forms[0].mtgInsPmtAmt5.value = 0;
				}
	}
	
	if (document.forms[0].loanterm5.options.selectedIndex == 4) {
		if ((dwnpmtA >= 0) && (dwnpmtA < 5)) {
				document.forms[0].mtgInsPmtAmt5.value = .80;
				}
		if ((dwnpmtA >= 5)&& (dwnpmtA < 10)) {
				document.forms[0].mtgInsPmtAmt5.value = .56;
				}
		if ((dwnpmtA >= 10)&& (dwnpmtA < 15)){
				document.forms[0].mtgInsPmtAmt5.value = .23;
				}
		if ((dwnpmtA >= 15)&& (dwnpmtA < 20)){
				document.forms[0].mtgInsPmtAmt5.value = .19;
				}
		if (dwnpmtA >= 20) {
				document.forms[0].mtgInsPmtAmt5.value = 0;
				}
	}
	
	if ((document.forms[0].loanterm5.options.selectedIndex == 5) || 		(document.forms[0].loanterm5.options.selectedIndex == 5)){
		if ((dwnpmtA >= 0) && (dwnpmtA < 5)) {
				document.forms[0].mtgInsPmtAmt5.value = .80;
				}
		if ((dwnpmtA >= 5)&& (dwnpmtA < 10)) {
				document.forms[0].mtgInsPmtAmt5.value = .56;
				}
		if ((dwnpmtA >= 10)&& (dwnpmtA < 15)){
				document.forms[0].mtgInsPmtAmt5.value = .23;
				}
		if ((dwnpmtA >= 15)&& (dwnpmtA < 20)){
				document.forms[0].mtgInsPmtAmt5.value = .19;
				}
		if (dwnpmtA >= 20) {
				document.forms[0].mtgInsPmtAmt5.value = 0;
				}
				}
				
		l = parseFloat(document.forms[0].LoanAmt5.value) * parseFloat(document.forms[0].mtgInsPmtAmt5.value)/1200;
	l = Math.round((l*100)+0.499)/100;
	document.forms[0].mtgInsPmtAmt5.value = l;
	
	}
	}

function format(expr,decplaces){
	var str = "" + Math.round(eval(expr)*Math.pow(10,decplaces))
	while (str.length <= decplaces){
		str = "0" + str
		}
	var decpoint = str.length - decplaces;
	return str.substring(0,decpoint) + "" + str.substring(decpoint,str.length);
	}
	
function dollarize(expr){
	return "$" + format(expr,0)
	}
