function tlwmenu(command) 
%---------------------------------------------------------------
% Matlab Subroutine tlwmenu.M				
%							
% by Robert Hart for Meteo 574 / Fall 1995			
% Penn State University Meteorology       
% Updated 1 March 2018 to fix display bug in newer matlab versions
%								
% Interactive menu system used to control tlwplot.m		
% a program which calculates and displays the airflow over 	
% a mountain in the presence of a two-layer atmosphere.	
%							
% To execute:  tlwmenu					
%---------------------------------------------------------------

omega=7.292e-5;
latit=pi/2;
f=2*omega*sin(latit);

if nargin == 0 
	command = 'new'; 
end 

if isstr(command) 
	if strcmp(lower(command),'initialize') | strcmp(lower(command),'new') 
		command = 0; 
	elseif strcmp(lower(command),lower('h_quit')) 
		command = 1; 
	elseif strcmp(lower(command),lower('h_info')) 
		command = 2; 
	elseif strcmp(lower(command),lower('h_analyze')) 
		command = 3; 
	elseif strcmp(lower(command),lower('h_maxk')) 
		command = 4; 
	elseif strcmp(lower(command),lower('h_mink')) 
		command = 5; 
	elseif strcmp(lower(command),lower('h_H')) 
		command = 6; 
	elseif strcmp(lower(command),lower('h_Llower')) 
		command = 7; 
	elseif strcmp(lower(command),lower('h_wndspd')) 
		command = 8; 
	elseif strcmp(lower(command),lower('h_Lupper')) 
		command = 9; 
	elseif strcmp(lower(command),lower('h_half')) 
		command = 10; 
	elseif strcmp(lower(command),lower('h_maxht')) 
		command = 11; 
	elseif strcmp(lower(command),lower('h_xwidth')) 
		command = 12; 
	elseif strcmp(lower(command),lower('h_vert')) 
		command = 13; 
        end 
end 

if command ~= 0 
	h_fig_list = findobj(get(0,'children'),'flat',... 
		'tag','tlwmenu'); 
		if length(h_fig_list) > 1 
			h_fig_list = gcf; 
		elseif length(h_fig_list) == 0 
			error('There are no figures with Tag = tlwmenu.'); 
		end 
	handle_list = get(h_fig_list,'userdata'); 
	if length(handle_list) > 0 
		h_quit = handle_list(1); 
		h_disp = handle_list(2); 
		h_analyze = handle_list(3); 
		h_maxk = handle_list(4); 
		h_mink = handle_list(5); 
		h_H = handle_list(6); 
		h_Llower = handle_list(7); 
		h_wndspd = handle_list(8); 
		h_Lupper = handle_list(9); 
		h_half = handle_list(10); 
		h_maxht = handle_list(11); 
		h_xwidth = handle_list(12); 
		h_vert = handle_list(13); 
		h_uic_6 = handle_list(14); 
		h_uic_25 = handle_list(15); 
		h_uic_22 = handle_list(16); 
		h_uic_20 = handle_list(17); 
		h_uic_3 = handle_list(18); 
		h_uic_15 = handle_list(19); 
		h_uic_11 = handle_list(20); 
		h_uic_19 = handle_list(21); 
		h_uic_10 = handle_list(22); 
		h_uic_13 = handle_list(23); 
		h_uic_9 = handle_list(24); 
		h_title = handle_list(25); 
		h_mxkval = handle_list(26); 
		h_separ = handle_list(27); 
		h_uic_8 = handle_list(28); 
		h_uic_1 = handle_list(29); 
		h_mnkval = handle_list(30); 
		h_wvalue = handle_list(31); 
		h_Lupval = handle_list(32); 
		h_Lloval = handle_list(33); 
		h_Hval = handle_list(34); 
		h_scorer = handle_list(35); 
		h_wtitle = handle_list(36); 
		h_Lupttl = handle_list(37); 
		h_Llottl = handle_list(38); 
		h_Htitle = handle_list(39); 
		h_rossby = handle_list(40); 
		h_uic_7 = handle_list(41); 
		h_mtnval = handle_list(42); 
		h_hlfval = handle_list(43); 
		h_uic_2 = handle_list(44); 
		h_uic_4 = handle_list(45); 
		h_uic_14 = handle_list(46); 
		h_uic_17 = handle_list(47); 
		h_verval = handle_list(48); 
		h_horval = handle_list(49); 
	end 
end 


if command == 0 
       
	fig = figure('position',[ 320 240 600 450 ],... 
		'resize','on','tag','tlwmenu',... 
		'visible','on'); 

	%  Uicontrol Object Creation 

	h_quit = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_quit'');',... 
		'Position',[ 0.672 0.027 0.279 0.06 ],... 
		'String','Quit',... 
		'Style','pushbutton',... 
		'Tag','h_quit',... 
		'UserData',''); 
	h_info = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_info'');',... 
		'Position',[ 0.014 0.027 0.265 0.062 ],... 
		'String','Info',... 
		'Style','pushbutton',... 
		'Tag','h_info',... 
		'UserData',''); 
	h_analyze = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_analyze'');',... 
		'Position',[ 0.335 0.029 0.293 0.056 ],... 
		'String','Analyze Flow',... 
		'Style','pushbutton',... 
		'Tag','h_analyze',... 
		'UserData',''); 
	h_maxk = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_maxk'');',... 
		'Max',[ 50 ],... 
                'Min',[ 0 ],...
		'Position',[ 0.75 0.201 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 30 ],... 
		'Tag','h_maxk',... 
		'UserData',''); 
	h_mink = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_mink'');',... 
		'Max',[ 50 ],... 
		'Min',[ 0 ],...
                'Position',[ 0.75 0.297 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 0 ],... 
		'Tag','h_mink',... 
		'UserData',''); 
	h_H = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_H'');',... 
		'Max',[ 20 ],... 
		'Position',[ 0.25 0.454 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 3.5 ],... 
		'Tag','h_H',... 
		'UserData',''); 
	h_Llower = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_Llower'');',... 
		'Max',[ 50 ],... 
		'Position',[ 0.25 0.563 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 10 ],... 
		'Tag','h_Llower',... 
		'UserData',''); 
	h_wndspd = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_wndspd'');',... 
		'Max',[ 100 ],... 
		'Position',[ 0.25 0.766 0.2 0.025 ],... 
		'String','Surface Wind Speed',... 
		'Style','slider',... 
		'Value',[ 20 ],... 
		'Tag','h_wndspd',... 
		'UserData',''); 
	h_Lupper = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_Lupper'');',... 
		'Max',[ 50 ],... 
		'Position',[ 0.25 0.666 0.2 0.025 ],... 
		'Style','slider',... 
                'Value',[ 4 ],... 
		'Tag','h_Lupper',... 
		'UserData',''); 
	h_half = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_half'');',... 
		'Max',[ 25 ],... 
		'Position',[ 0.75 0.702 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 2.5 ],... 
		'Tag','h_half',... 
		'UserData',''); 
	h_maxht = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_maxht'');',... 
		'Max',[ 3 ],... 
		'Position',[ 0.75 0.79 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 0.5 ],... 
		'Tag','h_maxht',... 
		'UserData',''); 
	h_xwidth = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_xwidth'');',... 
		'Max',[ 100 ],... 
		'Position',[ 0.75 0.52 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 40 ],... 
		'Tag','h_xwidth',... 
		'UserData',''); 
	h_vert = uicontrol(... 
		'Units','normalized',...
		'CallBack','tlwmenu(''h_vert'');',... 
		'Max',[ 20 ],... 
		'Position',[ 0.75 0.44 0.2 0.025 ],... 
		'Style','slider',... 
		'Value',[ 10 ],... 
		'Tag','h_vert',... 
		'UserData',''); 
	h_uic_6 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_6'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.049 0.139 0.221 0.101 ],... 
		'String','Rossby # (45N):',... 
		'Style','text',... 
		'Tag','h_uic_6',... 
		'UserData',''); 
	h_uic_25 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_25'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.482 0.168 0.157 0.071 ],... 
		'String','Max. Wave# (half-widths):',... 
		'Style','text',... 
		'Tag','h_uic_25',... 
		'UserData',''); 
	h_uic_22 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_22'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.482 0.27 0.157 0.071 ],... 
		'String','Min. Wave# (half-widths):',... 
		'Style','text',... 
		'Tag','h_uic_22',... 
		'UserData',''); 
	h_uic_20 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_20'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.576 0.345 0.299 0.037 ],... 
		'String','SPECTRAL PROFILE',... 
		'Style','text',... 
		'Tag','h_uic_20',... 
		'UserData',''); 
	h_uic_3 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_3'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.035 0.286 0.261 0.098 ],... 
		'String','Scorer Condition: (Trapped > 1)',... 
		'Style','text',... 
		'Tag','h_uic_3',... 
		'UserData',''); 
	h_uic_15 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_15'');',... 
		'Position',[ 0.007 0.117 0.015 0.814 ],... 
		'Style','text',... 
		'Units','normalized',... 
		'Tag','h_uic_15',... 
		'UserData',''); 
	h_uic_11 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_11'');',... 
		'Position',[ 0.476 0.634 0.509 0.013 ],... 
		'Style','text',... 
		'Tag','h_uic_11',... 
		'UserData',''); 
	h_uic_19 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_19'');',... 
		'Position',[ 0.477 0.395 0.515 0.01 ],... 
		'Style','text',... 
		'Tag','h_uic_19',... 
		'UserData',''); 
	h_uic_10 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_10'');',... 
		'Position',[ 0.008 0.112 0.986 0.012 ],... 
		'Style','text',... 
		'Tag','h_uic_10',... 
		'UserData',''); 
	h_uic_13 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_13'');',... 
		'Position',[ 0.983 0.12 0.01 0.82 ],... 
		'Style','text',... 
		'Tag','h_uic_13',... 
		'UserData',''); 
	h_uic_9 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.2 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_uic_9'');',... 
		'Position',[ 0.007 0.922 0.984 0.019 ],... 
		'Style','text',... 
		'Tag','h_uic_9',... 
		'UserData',''); 
	h_title = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_title'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.01 0.939 0.95 0.04 ],... 
		'String','INTERACTIVE MODEL FOR 2-LAYER FLOW OVER AN ISOLATED MOUNTAIN',... 
		'Style','text',... 
		'Tag','h_title',... 
		'UserData',''); 
	h_mxkval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_mxkval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.633 0.19 0.1 0.04 ],... 
		'String','30',... 
		'Style','text',... 
		'Tag','h_mxkval',... 
		'UserData',''); 
	h_separ = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0.1 0.7 0.7 ],... 
		'CallBack','tlwmenu(''h_separ'');',... 
		'Position',[ 0.468 0.118 0.01 0.805 ],... 
		'Style','text',... 
		'Tag','h_separ',... 
		'UserData',''); 
	h_uic_8 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_8'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.024 0.862 0.435 0.033 ],... 
		'String','ATMOSPHERIC PROFILE',... 
		'Style','text',... 
		'Tag','h_uic_8',... 
		'UserData',''); 
	h_uic_1 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_1'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.585 0.848 0.306 0.052 ],... 
		'String','TERRAIN PROFILE',... 
		'Style','text',... 
		'Tag','h_uic_1',... 
		'UserData',''); 
	h_mnkval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_mnkval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.645 0.282 0.091 0.041 ],... 
		'String','0',... 
		'Style','text',... 
		'Tag','h_mnkval',... 
		'UserData',''); 
	h_wvalue = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_wvalue'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.17 0.756 0.06 0.04 ],... 
		'String','20',... 
		'Style','text',... 
		'Tag','h_wvalue',... 
		'UserData',''); 
	h_Lupval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Lupval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.17 0.658 0.06 0.04 ],... 
		'String','4',... 
		'Style','text',... 
		'Tag','h_Lupval',... 
		'UserData',''); 
	h_Lloval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Lloval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.17 0.555 0.06 0.04 ],... 
		'String','10',... 
		'Style','text',... 
		'Tag','h_Lloval',... 
		'UserData',''); 
	h_Hval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Hval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.17 0.44 0.06 0.04 ],... 
		'String','3.5',... 
		'Style','text',... 
		'Tag','h_Hval',... 
		'UserData',''); 
	h_scorer = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_scorer'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.29 0.32 0.12 0.05 ],... 
		'String','3.034',... 
		'Style','text',... 
		'Tag','h_scorer',... 
		'UserData',''); 
	h_wtitle = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_wtitle'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.03 0.7 0.12 0.1 ],... 
		'String','Sfc Wind (m/s):',... 
		'Style','text',... 
		'Tag','h_wtitle',... 
		'UserData',''); 
	h_Lupttl = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Lupttl'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.03 0.603 0.12 0.1 ],... 
		'String','L Upper (10^-4):',... 
		'Style','text',... 
		'Tag','h_Lupttl',... 
		'UserData',''); 
	h_Llottl = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Llottl'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.03 0.5 0.12 0.1 ],... 
		'String','L Lower (10^-4):',... 
		'Style','text',... 
		'Tag','h_Llottl',... 
		'UserData',''); 
	h_Htitle = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_Htitle'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.03 0.395 0.12 0.1 ],... 
		'String','Interface Ht. (km):',... 
		'Style','text',... 
		'Tag','h_Htitle',... 
		'UserData',''); 
	h_rossby = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_rossby'');',... 
		'ForegroundColor',[ 0.5 0.5 0.5 ],... 
		'Position',[ 0.29 0.15 0.12 0.05 ],... 
		'String','1',... 
		'Style','text',... 
		'Tag','h_rossby',... 
		'UserData',''); 
	h_uic_7 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_7'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.487 0.682 0.127 0.066 ],... 
		'String','Half-width (km)',... 
		'Style','text',... 
		'Tag','h_uic_7',... 
		'UserData',''); 
	h_mtnval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_mtnval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.629 0.794 0.11 0.03 ],... 
		'String','0.5',... 
		'Style','text',... 
		'Tag','h_mtnval',... 
		'UserData',''); 
	h_hlfval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_hlfval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.623 0.699 0.119 0.034 ],... 
		'String','2.5',... 
		'Style','text',... 
		'Tag','h_hlfval',... 
		'UserData',''); 
	h_uic_2 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_2'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.528 0.593 0.417 0.032 ],... 
		'String','DOMAIN PROFILE',... 
		'Style','text',... 
		'Tag','h_uic_2',... 
		'UserData',''); 
	h_uic_4 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_4'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.478 0.767 0.149 0.067 ],... 
		'String','Max. Height (km)',... 
		'Style','text',... 
		'Tag','h_uic_4',... 
		'UserData',''); 
	h_uic_14 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_14'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.479 0.493 0.16 0.074 ],... 
		'String','Horizontal (km):',... 
		'Style','text',... 
		'Tag','h_uic_14',... 
		'UserData',''); 
	h_uic_17 = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_uic_17'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.488 0.417 0.135 0.073 ],... 
		'String','Vertical (km):',... 
		'Style','text',... 
		'Tag','h_uic_17',... 
		'UserData',''); 
	h_verval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_verval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.641 0.417 0.071 0.052 ],... 
		'String','10',... 
		'Style','text',... 
		'Tag','h_verval',... 
		'UserData',''); 
	h_horval = uicontrol(... 
		'Units','normalized',...
		'BackgroundColor',[ 0 0 0 ],... 
		'CallBack','tlwmenu(''h_horval'');',... 
		'ForegroundColor',[ 1 1 1 ],... 
		'Position',[ 0.629 0.512 0.098 0.037 ],... 
		'String','40',... 
		'Style','text',... 
		'Tag','h_horval',... 
		'UserData',''); 


	%  Menu Object Creation 


	%  Axes and Text Object Creation 




	handle_list = [ ...  
	 	 h_quit h_info h_analyze ... 
	 	h_maxk h_mink h_H h_Llower ... 
	 	h_wndspd h_Lupper h_half h_maxht ... 
	 	h_xwidth h_vert h_uic_6 h_uic_25 ... 
	 	h_uic_22 h_uic_20 h_uic_3 h_uic_15 ... 
	 	h_uic_11 h_uic_19 h_uic_10 h_uic_13 ... 
	 	h_uic_9 h_title h_mxkval h_separ ... 
	 	h_uic_8 h_uic_1 h_mnkval h_wvalue ... 
	 	h_Lupval h_Lloval h_Hval h_scorer ... 
	 	h_wtitle h_Lupttl h_Llottl h_Htitle ... 
	 	h_rossby h_uic_7 h_mtnval h_hlfval ... 
	 	h_uic_2 h_uic_4 h_uic_14 h_uic_17 ... 
	 	h_verval h_horval ... 
	 	 	]; 

	set(gcf,'userdata',handle_list); 
	pause(.1); drawnow; pause(.1);
   
	set(gcf,'visible','on'); 


elseif command == 1 
	close(gcf);
elseif command == 2 
        ttlStr='Mountain Lee Wave Model Help/Info';
        hlpStr=...
          ['                                            ' 
         '--------------------------------------------'
	   '              INTRODUCTION                  '
         '--------------------------------------------'
         'This is an interactive model for visualizing'
	   'airflow over an isolated mountain in the    '
	   'presence of an atmosphere having varying    '
           'thermodynamical vertical structure.         '
           '                                            '
   	   'The atmosphere is divided into two layers,  '
	   'each having a uniform Scorer parameter.     '
           '                                            '
           'A witch of agnesi shape has been chosen     '
           'for the terrain.                            '
           '                                            '
           'The resulting airflow over the mountain     '
           'is then calculated as a Fourier sum of the  '
	   'individual airflow patterns for each        '
           'wavenumber in the spectral domain.          '
           '                                            '
           'The structure of the atmosphere, terrain    '
           'domain, or wave spectrum can be altered     '
	   'by moving the sliders to the requested      '
	   'values.  Once ANALYZE FLOW is clicked, a    '
	   'contour plot of vertical velocity and an    '
	   'estimate of the corresponding streamlines is'
    	   'be plotted, using the profiles set by the   '
	   'user (and assuming steady flow).            '
	   '                                            '
         'BUTTONS:                                    '
         'INFO - This help screen.                    '
         'ANALYZE FLOW - Calculate and display airflow'
         '               based on chosen parameters.  '
         'QUIT - Close and exit menu.                 '
         '                                            '
         'The following is a description of each of   '
         'the sliders on the menu.                    '
         '--------------------------------------------'
	   '          ATMOSPHERIC PROFILE:              '
         '--------------------------------------------'
 	   'Sfc Wind:                                   '
	   '    the surface wind speed in m/s           '
           '                                            '
	   'Lupper:                                     '
	   '    Scorer parameter of the upper layer,    '
	   '    in multiples of 10^-4.                  '
           '                                            '
	   'Llower:                                     '
	   '    Scorer parameter of the lower layer,    '
 	   '    in multiples of 10^-4                   '
           '                                            '  
           'Interface Height:                           '
           '    Height above the ground (in km) of the  '
	   '    interface between the two layers.       '
           '                                            '
	   'Scorer Condition:                           '
           '    Condition found by Scorer which must    '
	   '    be satisfied for the resulting          '
           '    airflow to contain trapped waves.       '
           '    Mathematically,                         '
           ' 4*(H/pi)^2*(Llower^2 -Lupper^2 ) > 1       '
           '    where H is the interface height.        '
           '                                            '
           'Rossby Number:                              '
           '    The rossby number of the flow at 45 deg.'
           '    This model assumes no rotation;         '
           '    therefore, this number is displayed to  '
           '    let the user know when the chosen       '
           '    combination of wind and domain are such '
           '    that coriolis accelerations make the    '
           '    calculated plots questionable. A number '
           '    less than 1 indicates the rotational    '
           '    effects are significant.                '
           '--------------------------------------------'
           '              TERRAIN PROFILE:              '
           '--------------------------------------------'
           'Max Height:                                 '
           '    The maximum height of the isolated      '
           '    mountain, in kilometers.                '
           '                                            ' 
           'Half-width:                                 '
           '    The horizontal distance from the center '
           '    of the mountain at which the mountain   '
           '    height decreases to one-half the maximum'
           '    height.  (in km).                       '
           '--------------------------------------------'
           '             DOMAIN PROFILE:                '
           '--------------------------------------------'
           'Horizontal:                                 ' 
           '    The width (in km) of the horizontal     '
           '    domain to be analyzed.                  '   
           '                                            '
           'Vertical:                                   '
           '    The height (in km) of the vertical      '
           '    domain to be analyzed.                  '
           '--------------------------------------------'
           '            SPECTRAL PROFILE:               '
           '--------------------------------------------'
           'Mininum Wavenumber:                         '
           '    The smallest wavenumber wave to be      '
           '    included in the calculation             '
           '    (in multiples of mtn half-widths).      '
           '    This is the lower limit on the Fourier  '
           '    integration for wavenumber.             '
           '                                            '
           'Maximum Wavenumber:                         '
           '    The largest wavenumber wave to be       '
           '    included in the airflow calculation     '
           '    (in multiples of mtn half-widths).      '
           '    This is the upper limit on the Fourier  '
           '    integration for wavenumber.             '
           '--------------------------------------------'
           '                                            '];
  	   helpwin(ttlStr,hlpStr);	 
elseif command == 3 
	a=1000*get(h_half,'value');   
	H=1000*get(h_H,'value');   
	ho=1000*get(h_maxht,'value');           
	U=get(h_wndspd,'value');     
	Lupper=.0001*get(h_Lupper,'value');     
	Llower=.0001*get(h_Llower,'value');    
	xdom=1000*get(h_xwidth,'value');   
	zdom=1000*get(h_vert,'value');    
	mink=get(h_mink,'value')/a;   
	maxk=get(h_maxk,'value')/a;   
	tlwplot(Lupper,Llower,U,H,a,ho,xdom,zdom,mink,maxk);      
elseif command == 4 
	maxk=get(h_maxk,'value');    
	set(h_mxkval,'string',num2str(maxk));    
elseif command == 5 
	mink=get(h_mink,'value');    
	set(h_mnkval,'string',num2str(mink));    
elseif command == 6 
	H=get(h_H,'value');     
	set(h_Hval,'string',num2str(H));     
elseif command == 7 
	Llower=get(h_Llower,'value');      
	set(h_Lloval,'string',num2str(Llower));  
elseif command == 8 
	U=get(h_wndspd,'value');        
	set(h_wvalue,'string',num2str(U));    
elseif command == 9 
	Lupper=get(h_Lupper,'value');       
	set(h_Lupval,'string',num2str(Lupper));       
elseif command == 10 
	a=get(h_half,'value');    
	set(h_hlfval,'string',num2str(a));   
elseif command == 11 
	ho=get(h_maxht,'value');    
	set(h_mtnval,'string',num2str(ho));    
elseif command == 12 
	xdom=get(h_xwidth,'value');    
	set(h_horval,'string',num2str(xdom));    
elseif command == 13 
	zdom=get(h_vert,'value');    
	set(h_verval,'string',num2str(zdom));    
else 
	error('Error: tlwmenu.m called with incorrect command.') 
end

if command ~= 1
	H=1000*get(h_H,'value');
	Llower=.0001*get(h_Llower,'value');  
	Lupper=.0001*get(h_Lupper,'value');  
	scorer=4*H*H*(Llower*Llower-Lupper*Lupper)/(pi*pi);  
	set(h_scorer,'string',num2str(scorer));  

	U=get(h_wndspd,'value');
	a=1000*get(h_half,'value');
	rossby=U/(f*a);
	set(h_rossby,'string',num2str(rossby));
end;
