function BT=nav_overlay(abx_root,jday,NAVr,NAVs,tlims,tsize,clim,cols);
%
% Call BT=nav_overlay(abx_root,jday,NAVr,NAVs,tlims,tsize,clim,cols);
%
% abx_image('ev70_50_200',[3,5.5]);
% NAVs={'RV2_EV70_60s','RV5_EV70_60s','RV7_EV70_60s','RV6_EV70_60s'}
% nav_overlay(42,REC.NAV,NAVs,'cybg')
%
% BT=nav_overlay('ev74_xc_a0',42,'SWAMI',{'XF4_60s','DAL_60s'})
%
adi_global
%
if nargin<1, abx_root=[]; end
if nargin<5, tlims=[]; end
if nargin<6, tsize=[4,4]; end
if nargin<7, clim=[-.1,.2]; end
if nargin<8, cols='rbgcmy'; end
if ~isempty(abx_root),
	disp(['abx_image(',abx_root,',',num2str(tlims),',',num2str(tsize),');']);
	abx_image(abx_root,tlims,tsize,clim);
end
if isempty(NAVr), return; end
ncols=length(cols);
%
hold on; method='linear';
ptsize=4;
ax=axis; pos=get(gca,'Position'); fpos=get(gcf,'Position');
ylab=get(get(gca,'Ylabel'),'String');
T1=ax(3); T2=ax(4);
Tax_nav=linspace(T1,T2,50)';
%
method='linear';
if isstr(NAVr);
	NAVr=adi_nav_find(NAVr,SVG);
end
%
hour_r=(NAVr.jday-jday)*24 + NAVr.hour;
[xkm,ykm]=bathy_ll2xy(NAVr.lat,NAVr.long);
xr=interp1(hour_r,xkm,Tax_nav,method);
yr=interp1(hour_r,ykm,Tax_nav,method);
BT.nav_rec=NAVr.log_file(1:length(NAVr.log_file)-4);
BT.nav_root=[];
BT.Tax=Tax_nav;
%
if isempty(NAVs), NAVs{1}=[]; end
jplat=0;
ax=axis;
iisin=ax(1)>=-4 & ax(2)<=4,
if iisin,
	LOB=mean(NAVr.phi);
	rot_mat=[cos(LOB) -sin(LOB);sin(LOB) cos(LOB)];
end

while 1==1,
	jplat=jplat + 1;

	if length(NAVs)<jplat, break; end
	nav_root=NAVs{jplat};
	NAV=adi_nav_find(nav_root,SVG);
	BT.nav_root{jplat}=nav_root(1:3);
%
	hour_s=(NAV.jday-jday)*24 + NAV.hour;
	[xkm,ykm]=bathy_ll2xy(NAV.lat,NAV.long);
	xs=interp1(hour_s,xkm,Tax_nav,method);
	ys=interp1(hour_s,ykm,Tax_nav,method);
%
	if iisin,
		dx=xs-xr; dy=ys-yr;
		xyrot=rot_mat*[dx(:)';dy(:)'];
		brg_lob=atan2(xyrot(1,:),xyrot(2,:));
		BT.brg_rs(:,jplat)=cos(brg_lob);
		ii=find(brg_lob>0); 
		BT.brg_rs(ii,jplat)=2-BT.brg_rs(ii,jplat);
%		fig=gcf; figure(101);
%		plot(xr,yr,'o',xs,ys,'x',xr+xyrot(1,:)',yr+xyrot(2,:)'); axis equal
%		figure(fig);
	else
		BT.brg_rs(:,jplat)=atan2(xs-xr,ys-yr)*180/pi;
	end
	BT.rng_rs(:,jplat)=sqrt((xs-xr).^2 + (ys-yr).^2);
	jcol=rem(jplat-1,ncols) + 1;
	plot_cfill(BT.brg_rs(:,jplat),Tax_nav,'o',cols(jcol),ptsize);
end
nplat=jplat-1; leg=[];
for jplat=1:nplat,
	leg=strvcat(leg,strrep(char(BT.nav_root{jplat}),'_','\_'));
end
%
% Plot range vs. time on separate figure:
figure;
set(gcf,'Units','inches','Position',fpos+[4 0 0 0])
for jplat=1:nplat,
	jcol=rem(jplat-1,ncols) + 1;
	plot_cfill(BT.rng_rs(:,jplat),Tax_nav,'o',cols(jcol),ptsize); hold on;
end
xlabel('Range - km'); ylabel(ylab);
rmax=max(max(BT.rng_rs));
set(gca,'Units','inches','Position',pos);
axis([0,rmax,ax(3:4)]); axis('ij')
plot_set3(gca,1.5,'Times',14,1);
set(gca,'Color',[.5,.5,.5]);

mylegend(leg)
%
% 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.
