

function f-menu () 
{
clear 

NUM=

fig-col
figlet "inx          Menu"
head-col
echo "Type the number for your choice"
echo " "
echo "I suggest that you try things in this order..."
printf "\n"
info-col
echo "0: Why INX ? "
echo "1: Watch an introduction to inx			(intro)" 
echo "2: Listen to Internet radio streams		(stream)"
echo "3: Follow some basic tutorials			(tutorial)"
echo "4: Time and Clock Settings			(sudo tzconfig)"
echo "5: Take a tour of the GNU Screen program	(tour - do tutorial first!)"
echo "6: Access or eject/unmount usb devices		(usb)"
echo "7: Net, Web, File Sharing and Mail		(netinx)"
echo "8: Office					(office)"  
echo "9: Other Menus"
echo 
fig-col
echo "f: Flip the colour scheme"
echo "x: Just give me a command prompt, and go away!"
echo "t: Toggle clock on|off"
echo "q: Log out, and shut INX down"
echo "<enter>: Refresh this menu (shows newly attached devices)"
printf "\n"
head-col

echo "You can return to this menu any time by typing menu <enter> at a prompt"

# check for mounted usb devices, or stuff in /media and /mnt
info-col
echo
MNT=$(grep /mnt /etc/mtab | cut -d" " -f2)
MEDIA=$(grep /media /etc/mtab | cut -d" " -f2)
SSHFS=$(grep sshfs /etc/mtab | cut -d" " -f2)
if egrep "(media|mnt|sshfs)" /etc/mtab > /dev/null 2>&1 ; then
echo "File system(s) currently mounted on:"
	echo
	bold
	red
	echo "$MNT"
	green
	echo "$MEDIA"
	yellow
	echo "$SSHFS"
fi
white


# Print tty number right edge of terminal
f-ttynum

read -s -n 1

NUM=$REPLY

case $NUM in

	0)
	f-why
	 ;;
	1)
	f-intro
	 ;;
	2)
	f-radiomenu
	 ;;
	3)
	f-tutorial
	 ;;
	4)
	clear
	yellow
	echo
	echo "Your date and time are set to $(date) "
	echo
	white
	sudo tzconfig
	echo
	yellow
	echo "Would you like a clock in the top right corner of your screens? [y]"
	white
	read -s -n 1 VCSTIME
		case $VCSTIME in
			n)
			if pidof vcstime > /dev/null 2>&1 ; then
				sudo killall vcstime  		#user doesn't want a clock now
			fi
			f-menu
			;;
			*)
			if pidof vcstime > /dev/null 2>&1 ; then
				sudo killall vcstime  	# Refresh vcstime clock to reflect setting
				sudo -b vcstime > /dev/null 2>&1
			else
				sudo -b vcstime > /dev/null 2>&1 
			fi
			f-menu
	 		;;
		esac
	 ;;
	5)
	f-tour
	 ;;
	6)
	f-usb
	 ;;
	7)
	f-net
	 ;;
	8)
	f-office
	 ;;
	9)
	clear
	fig-col
	figlet Other"  "Bits
	info-col
	echo "1: Hints and Rants"
	echo "2: Fun"
	echo
	head-col
	echo "Any other key to return to the main inx menu"
	info-col
	f-ttynum
	read -s -n 1 BITS
		case $BITS in
			1)
			f-hints
			;;
			2)
			f-fun
			;;
			*)
			f-menu
			;;
		esac
	 ;;
	q)
	yellow ; bred ; bold 
	printf "Do you want to end your INX session and halt the machine? (y/n)"
	white ; bblack
	read -n 1 "HALT"
		if [ "$HALT" = y ] ; then
			echo
			echo "OK shutting down in 5 seconds ... "
			echo
			sleep 5
			sudo shutdown -h now
		else
			f-menu
		fi
	 ;;
	x)
	clear
	f-prompt
	 ;;
	f)
	export CALL=menu
	f-switch
	f-menu
	;;
	t)
	time-toggle
	f-menu
	;;
	*)
	f-menu
	;;

esac
CURRENT="standard"
}
