function [url,loaddodsbool,infotext] = gbsjssu ...
         (getarchive, getranges, getmode, getvariablelist, getserverlist, passtimes, passdepths, whichurl)
%
%    This function will build gbsjss file name and return infotext and url to the browser
%

% The preceding empty line is important
% $Log: gbsjssu.m,v $
% Revision 1.2  1999/06/24 19:05:02  kwoklin
% Change file name of nbnerr.m. Fix some display bugs, define precision level
% of lat/lon/depth/time, and fix some more bugs in globec files.        klee
%
% Revision 1.1  1999/06/01 07:10:33  dbyrne
%
%
% Moved up from kleedata/
%
% Revision 1.3  1999/05/28 22:53:06  kwoklin
% Point to new server for all jgofs datasets. Update getjgsta on loaddods.
% Fix infotext for all gb geturl files. Fix transmissivity for some gb
% files. Modify some variable names on gb files.       klee
%

% $Id: gbsjssu.m,v 1.2 1999/06/24 19:05:02 kwoklin Exp $
% klee 04/01/99

if exist(getarchive) == 2   
  eval(getarchive)
else
  dodsmsg('Metadata not found!')
  return
end

url = []; infotext = []; text = []; loaddodsbool = 1; 
URLlat = []; URLlon = [];
Constraint = [];
yearname = deblank(DodsName1(1,:));
dayname = deblank(DodsName1(2,:));
id = deblank(DodsName1(3,:));

URLlat = ['&',LatitudeName,'>=',num2str(passtimes(whichurl,6),4), '&',LatitudeName,'<=', ...
          num2str(passtimes(whichurl,7),4)];

StartYear = passtimes(whichurl,1);
StartYrday = passtimes(whichurl,2);
EndYrday = passtimes(whichurl,3);
if StartYrday > dayend(1)                                   %for sj07
  URLlon = sprintf('%s','&',LongitudeName,'<=',num2str(-passtimes(whichurl,8),4),...
                        '&',LongitudeName,'>=',num2str(-passtimes(whichurl,9),4));
  URLdate = ['&', yearname, '=', num2str(StartYear), '&', dayname, '>=', num2str(StartYrday,7),...
             '&', dayname, '<=', num2str(EndYrday,7)]; 
  URLdepth = '';
  URLid = ['&',id,'=07'];    
elseif StartYrday <= dayend(1) & EndYrday <= dayend(1)     %for sj05
  URLlon = sprintf('%s','&',LongitudeName,'>=',num2str(passtimes(whichurl,8),4),...
                        '&',LongitudeName,'<=',num2str(passtimes(whichurl,9),4));
  URLdate = ['&', yearname, '=', num2str(StartYear), '&', dayname, '>=', num2str(StartYrday,7),...
             '&', dayname, '<=', num2str(EndYrday,7)]; 
  URLdepth = ['&',DepthName,'>=',num2str(passtimes(whichurl,4),6), '&',DepthName,'<=',...
              num2str(passtimes(whichurl,5),6)];
  URLid = ['&',id,'=05']; 
end
Constraint = [Constraint, URLlat, URLlon, URLdepth, URLdate, URLid]; 

returned_var = [];
for i = 1:size(getvariablelist,1)
  returned_var = [returned_var, dods_dbk(getvariablelist(i,:))];  
  if strcmp(deblank(getvariablelist(i,:)), 'wspd')
    returned_var = [returned_var, sprintf('%s',',',deblank(OptionalVariables(2,:)),',',deblank(OptionalVariables(3,:)))];
  end
  if i < size(getvariablelist,1)
    returned_var = [returned_var, ','];
  end
end

returned_var = [returned_var, ',', deblank(OptionalVariables(1,:))];
url = [Server, '?', returned_var, Constraint];

return

  

  

  
