#!/bin/bash
#
# "jazz_it_up" - an improved text-mode menu

tput civis        # Turn off the cursor

while [ 1 ]
do
    echo -e '\E[44;38m'    # Set colors: bg=blue, fg=white
    clear                  # Note: colors may be different in xterms
    echo -e '\E[41;38m'    # bg=red

    for n in `seq 6 20`
    do
        tput cup $n 15
        echo " "
    done

    echo -ne '\E[45;38m'    # bg=magenta
    tput cup 8 25 ; echo -n " M A I N   M E N U "
    echo -e '\E[41;38m'     # bg=red

    tput cup 10 25 ; echo -n " 1. Business auto policies "
    tput cup 11 25 ; echo -n " 2. Private auto policies "
    tput cup 12 25 ; echo -n " 3. Claims "
    tput cup 13 25 ; echo -n " 4. Accounting "
    tput cup 14 25 ; echo -n " 5. Quit "

    # I would have really liked to make the cursor invisible here -
    # but my "xterm" does not implement the `civis' option for "tput"
    # which is what does that job. I could experiment and hack it
    # into "terminfo"... but I'm not *that* ambitious.

    echo -ne '\E[44;38m'     # bg=blue
    tput cup 16 28 ; echo -n " Enter your choice: "
    tput cup 16 48

    read choice
    tput cup 18 30

    case $choice
    in
        1|B|b) bizpol ;;
        2|P|p) perspol ;;
        3|C|c) claims ;;
        4|A|a) acct ;;
        5|Q|q) tput sgr0; clear; exit ;;
        *) tput cup 18 26; echo "\"$choice\" is not a valid option.";
            sleep 2 ;;
    esac
done
