﻿// JScript File

//******************* UPDATE FREQUENTLY-ASKED QUESTIONS ***************************
//Add mort info to FAQ, to improve (hopefully) SEO
function js_add_mort_info() 
{
    //Initialize variables
    var mort = document.form1.ddlMort.selectedIndex;
    var goal = document.form1.ddlGoal.selectedIndex;
    var spn = document.getElementById("spnMortgageInfo");
    var MortType = "";
    var T ="";
    
    //Assign value to MortType
    switch(mort)
    {
    case 0:
        MortType="Fixed-Rate Mortgage";
        break;
    case 1:
        MortType="Biweekly Mortgage";
        break;
    case 2:
        MortType="Fixed-Rate Balloon Loan";
        break;
    case 3:
        MortType="Fixed-Rate Interest-Only Loan";
        break;
    case 4:
        MortType="Adjustable-Rate Mortgage (ARM)";
        break;
    case 5:
        MortType="Convertible Adjustable-Rate (ARM) Mortgage";
        break;
    case 6:
        MortType="Two-Step Mortgage";
        break;
    case 7:
        MortType="Adjustable-Rate Balloon Loan (Balloon ARM)";
        break;
    case 8:
        MortType="Interest-Only Adjustable-Rate Mortgage (ARM)";
        break;
    case 9:
        MortType="Graduated Payment Loan";
        break;
    }
     
    //Set mortgage info, based on goal and mortgage type
    T = '<p class="Answer">To specify the mortgage that you want to work with, '; 
    T += 'select an entry from the "Mortgage Type" dropdown box.';

    switch (goal)
    {
    case 0:
        T += '  The current entry is "' + MortType + '", ';
        T += 'so the current analysis will find the monthly mortgage payment ';
        T += 'for a ' + MortType + '.';
        break;
    case 1:
        T += '  The current entry is "' + MortType + '", ';
        T += 'so the current analysis will find the total mortgage ';
        T += 'cost for a ' + MortType + '.';
        break;
    case 2:
        T += '  The current entry is "' + MortType + '", ';
        T += 'so the current analysis will assess mortgage prepayment effects ';
        T += 'for a ' + MortType + '.';
        break;
    case 5:
        T += '  The current entry is "' + MortType + '", ';
        T += 'so the current analysis will produce an amortization table ';
        T += 'for a ' + MortType + '.';
        break;
    }

    //Add mortgage info
    spn.innerHTML = T + "</p>";
}