function orca_help(action,cback_fig)
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
orca_global
%
if nargin<2, cback_fig=gcbf; end
%
hval=findobj(cback_fig,'Tag',action);
hlab=findobj(cback_fig,'Tag',[action,'lab']);
val=get(hval,'Value');
str=get(hval,'String');
%
iispec=0; iitrack=0;
disp(' ');
disp(['HELP for box labeled "',action,'": ']);
disp(' ');
switch action
case 'Program',
	h1=findobj(cback_fig,'Tag','Program'); prog_val=get(h1,'Value'); iiprog=Obox.prog_order(prog_val);
	prog=Obox.progs{iiprog};
	disp(['Select program you want to run from this pop-up menu. ']); disp(' ');
	disp(['Current program is "',prog,'"']); disp(' ');
	switch iiprog
	case 1,
		disp('   This program runs ORCA for the SVP File chosen at the individual CW frequency(ies) '); 
		disp('listed in "CW Frequencies".  General mode finding parameters are given in the '); 
		disp('"Parms:iirx,rmin,dBcut" box, where iirx=0 for complex k-plane mode eigenvalue search '); 
		disp('(includes leaky modes) or iirx=1 for faster real-axis search (no shear, no leaky '); 
		disp('modes); rmin=minimum range of interest in km (pos) or maximum phase speed (neg); and '); 
		disp('dBcut= mode cutoff dynamic range in dB.  The "Compute TL" checkbox makes ORCA compute TL '); 
		disp('for the "Source Depths", "Receiver Depths", and "Ranges (km)" given.  The "Mode Function" '); 
		disp('checkbox makes ORCA compute the mode functions at the depths given in "MF Depths".  The '); 
		disp('"Mode Traj" checkbox make ORCA output the k-plane trajectory along which it searched for '); 
		disp('and found the modes (|R1*R2|=1 along the trajectory); The "Disp Curves" checkbox makes '); 
		disp('ORCA compute dispersion curves: group and phase velocity versus frequency.'); 
	case 2,
		disp('   This program runs ORCA for the SVP File chosen in the band of frequencies specified  '); 
		disp('by [fmin,fmax] in the "fs,+NF/-Tw,fmin,fmax" box.  The frequency spacing is determined '); 
		disp('by the FFT sample rate fs and the power-of-2 FFT size NF.  If NF is negative, it is '); 
		disp('assumed to be the time window Tw, and the smallest NF resulting in a time window at least '); 
		disp('as large as Tw is used.  The "Compute TL" checkbox makes ORCA compute transfer functions '); 
		disp('for the "Source Depths", "Receiver Depths", and "Ranges (km)" given.  An FFT file for each'); 
		disp('source depth is generated.   The "Mode Function" checkbox makes ORCA compute the mode '); 
		disp('functions versus frequency at the depths given in "MF Depths".  The "Mode Traj" checkbox '); 
		disp('make ORCA output the k-plane trajectory along which it searched for and found the modes '); 
		disp('(|R1*R2|=1 along the trajectory); The "Disp Curves" checkbox makes ORCA compute dispersion '); 
		disp('curves: group and phase velocity versus frequency.'); 
	case 3,
		disp('   This program makes ORCA compute the magnitude and phase of R1*R2, the product of '); 
		disp('the reflection coefficients looking down and up, respectively, from the reference depth.  '); 
		disp('R1*R2 is computed versus the real and imaginary parts of the horizontal wavenumber k.  '); 
		disp('The region of the complex k plane over which the calculations are down is specified in'); 
		disp('"Re(k)/K Limits" (for the real part, normalized by the referenc depth wavenumber K=2*pi*f/c) '); 
		disp('and "Im(k) - dB/km" (for the imaginary part of k in units of dB/km, the modal attenuation). ');
	case 4,
		disp('   This program makes ORCA find modes as one or more parameters in the SVP file are varied.  '); 
		disp('General mode finding parameters are given in the "Parms:iirx,rmin,dBcut" box (see help for '); 
		disp('the program "ORCA CW").  The number of mode runs is given in "Number of Runs", and the number '); 
		disp('of parameters to vary, nparm, is given in "# Parms to Vary".  For each parameter, a row of '); 
		disp('parameter codes is given in the the large "Parm Codes: ..." box.  Each row consists of '); 
		disp('[obt,nlay,ktb,pc,val1,val2], where obt=0/1 for ocean/bottom layer; nlay=layer number '); 
		disp('(used for bottom only); ktb=1/2 for top/bottom of layer, negative to maintain gradient '); 
		disp('layer; pc=0/1/2/3/4/5 to vary the parameters: thickness/cp/cs/rho/ap/as; and [val1,val2]= '); 
		disp('the first and last values to assign to the parameter specified.  The number of 6-element '); 
		disp('rows must be nparm.');
	case 5,
		disp('   This program makes ORCA compute the bottom loss (the reflection coefficient at the ocean '); 
		disp('bottom in dB) for the frequencies specified in the "Frequency Limits" box and the angles '); 
		disp('specified in the "Grazing Angle Lims" (in degrees).  '); 
	case 6,
		disp('   This program allows the user to create SVP files,which contain both the SSP in water '); 
		disp('column and the geoacoustic profile of bottom) for use in ORCA normal mode model runs.  '); 
		disp('SVP Files may also be imported so that new SVP files may be based on existing ones.  Click '); 
		disp('on "Parms" box for a description of the geoacoustic profile input parameters.');
	case 7,
		disp('   This program allows the user to view the data sets contained in HDF files created by ORCA.');
    case 8,
        disp('   This program allows the user to run the RAM PE model (written by Michael D. Collins) for '); 
		disp('the sampe input parameters as ORCA.');
	end
case 're-init',
	disp('Re-initialize lists of available files. ');
	disp('Do this after changing directories or creating new files.')
case 'Load _gui root',
	disp('To load input parameters from a previous run, type in the root of the _gui.mat file.')
	disp('Enter a space to choose from all _gui.mat in current directory.');
%
case {'Parms','Layer 1 Parms','Layer 2+ Parms','H-space Parms'},
	disp('   The geoacoustic parameters of the bottom layers are specified in the same manner as for an ORCA')
	disp('input SVP file.  (Halfspace parameters include only cp1,ap1,rho1,as1,fexpp,fexps.)  Details may '); 
	disp('also be found in the ORCA User''s Guide.  A summary of the parameters is given below. ')
	disp(' ')
	disp('ii		= TYPE of p-wave sound speed profile (1=1/c^2 linear; 2,3,4=BLUG). ')
	disp('h		= Layer thickness in m.  Negative value (for layer 1 only) means two-way travel time in s.')
	disp('cp1		= P-wave sound speed at top of layer in m/s.  Negative value (for layer 1 only)')
	disp('		  means ratio cp1/cw, where cw = water sound speed at ocean bottom.')
	disp('cp2		= P-wave sound speed at bottom of layer (ii=1,3,4), OR cp gradient at top of layer ')
	disp('		  in 1/s (|ii=2|).')
	disp('ap1		= P-wave attenuation at top of layer [pos=in dB/m/kHz, neg in dB/lambda).')
	disp('ap2		= P-wave attenuation at bottom of layer (pos=in dB/m/kHz, neg in dB/lambda).')
	disp('rho1	= Density at top of layer (g/cm^3).')
	disp('rho2	= Density at bottom of layer (g/cm^3).')
	disp('cs1		= S-wave sound speed at top of layer in m/s.')
	disp('cs2		= S-wave sound speed at bottom of layer in m/s.  (S-wave profile are always linear.)')
	disp('as1		= S-wave attenuation at top of layer (pos=in dB/m/kHz, neg in dB/lambda).')
	disp('as2		= S-wave attenuation at bottom of layer (pos=in dB/m/kHz, neg in dB/lambda).')
	disp('beta	= BLUG curvature parameter (ii=2,3), OR cp gradient at top of layer in 1/s (ii=4).')
	disp('ctol	= Sound speed error tolerance in fitting BLUG profile (ii=2,3,4). (0 ==> ctol=5)')
	disp('fexpp	= Frequency exponent for p-wave profile.  Atten values ap are in dB/m at 1 kHz.')
	disp('		  Attenuation in dB/m at f (in kHz) is:				alpha(dB/m)		= ap * f^(fexpp).')
	disp('		  Equivalent atten in dB/m/kHz at f (in kHz) is:	alpha(dB/m/kHz)	= ap * f^(fexpp-1).')
	disp('		  fexpp = 1 results in the standard assumption of linear frequency dependence.')
    disp('        Given alpha(dB/m/kHz) valid at f0 and a desired fexpp, compute ');
    disp('          ap(dB/m @ 1kHz) = alpha(dB/m/kHz) / f0^(fexpp-1).')
    disp('        Note that alpha(dB/m/kHz)=alpha(dB/lambda) / (c/1000).');
	disp('fexps	= Frequency exponent for s-wave profile, with same assumptions as for fexpp.')
%	disp(' ');
case 'Halfspace Parms',
	disp('Halfspace parameters are: cp1,cs1,rho1,ap1,as1,fexpp,fexps. '); 
    disp('Click on "Parms" box for HELP on these parameters.');	
case {'Parm Codes: [obt,nlay,ktb,pc,val1,val2] (nparm rows)','# Parms to Vary','Number of Runs'},
    disp('The "Vary Parms" checkbox allows the user to vary one or more geoacoustic parameters ');
    disp('in the SVP file and run ORCA multiple times.  The results for all the runs ');
    disp('are output in the same HDF file.  Specify the number of ORCA runs in the ');
    disp('"Number of Runs" box and the number of parameters to vary in the "# Parms to Vary" box.  ');
    disp('For each parameter to be varied, the parameter and its values are specified in the ');
    disp('"Parm Codes: ..." box.  For each parameter, six values must be specified: ');
    disp('   obt        = 0 for a layer in ocean, 1 for a layer in bottom;');
    disp('   nlay       = layer number in ocean or bottom;');
    disp('   ktb        = vary parameter at top (1) or bottom (2) of layer (-1 or -2 to keep ');
    disp('                gradient of parameter constant, if applicable);');
    disp('   pc         = parameter to vary: 0=thickness, 1=cp, 2=cs, 3=rho, 4=ap, 5=as, ');
    disp('                6=fexp, 7=fexps;');
    disp('   val1,val2  = first and last values of parameter;');
%
%%%
otherwise,
	disp(['HELP not available in rda_help for the action "',action,'".']); 
%
end
if iispec,
	disp('NOTE: Values of ranges, depths, frequencies, etc. may be specified in the following ways:')
	disp('      [r1;r2; ...rn] (col vector); [rmin,rmax,nr] (row vector); OR [rmin,rmax,-dr] (row vector).')
end
%
disp(' ');
disp(['END OF HELP for box labeled "',action,'": ']);
disp(' ');
%

