function [url,loaddodsbool,infotext] = gbsjctdurl ...
         (getarchive, getranges, getmode, getvariablelist, getserverlist, passtimes, passdepths, whichurl)
%
%    This function will build gbsjctd file name and return infotext and time/depth/lat/lon/url
%    to the browser
%

% The preceding empty line is important
% $Log: gbsjctdu.m,v $
% Revision 1.3  1999/06/24 19:05:01  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.2  1999/06/01 16:12:38  dbyrne
%
%
% quick bug fixes for AGU -- dbyrne 99/06/01
%
% Revision 1.1  1999/06/01 07:10:33  dbyrne
%
%
% Moved up from kleedata/
%
% Revision 1.3  1999/05/28 22:53:05  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: gbsjctdu.m,v 1.3 1999/06/24 19:05:01 kwoklin Exp $
% klee 04/01/99

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

url = []; infotext = []; text = []; Constraint = []; loaddodsbool = 1;
URLdepth = []; URLlat = []; URLlon = [];

URLdepth = ['&',DepthName,'>=',num2str(passtimes(whichurl,4),6), '&',DepthName,'<=', ...
            num2str(passtimes(whichurl,5),6)];
URLlat = ['&',LatitudeName,'>=',num2str(passtimes(whichurl,6),4), '&',LatitudeName,'<=', ...
          num2str(passtimes(whichurl,7),4)];
% for [-180, 180]  
URLlon = ['&',LongitudeName,'>=',num2str(passtimes(whichurl,8),4), '&',LongitudeName,'<=', ...
          num2str(passtimes(whichurl,9),4)];
Constraint = [Constraint, URLdepth, URLlat, URLlon]; 

StartYear = passtimes(whichurl,1);
StartYrday = passtimes(whichurl,2);
EndYrday = passtimes(whichurl,3);
whichserver = passtimes(whichurl,10);
Constraint = [Constraint, '&',TimeName,'>=',num2str(StartYrday,7),'&',TimeName,'<=',num2str(EndYrday,7)];

returned_var = [];
for i = 1:size(getvariablelist,1)
  if (whichserver == 3) & (strcmp(deblank(getvariablelist(i,:)), 'flvolt'))
    % do nothing, 08sb does not contain flvolt
  else
    returned_var = [returned_var, dods_dbk(getvariablelist(i,:))]; 
    if i < size(getvariablelist,1)
      returned_var = [returned_var, ','];
    end
  end 
end

server = [Server, deblank(Serverexd(whichserver,:))];
url = [server, '?', returned_var, Constraint];

tmpvar = ['?cruiseid,',TimeName];
tmptext = ['loaddods ''', server, tmpvar, '?', Constraint, ''''];
infotext = sprintf('%s\n%s\n%s\n%s\n%s\n%s\n','   ',...
                  ['"Cruiseid" is stored as a character variable. Searches on character variables',...
                  'are not supported by this version of the DODS Matlab GUI.',...
                  '   ',...
                  '** To get Cruise Id information ** ',...
                  'please issue the ''loaddods'' command from the MATLAB prompt line, using a URL like this:',...
                  '   '], ...
                  ['URL = ',server], ...
                  ['Proj = ',tmpvar] ,...
                  ['Sel = ',Constraint], ...
                  ['   '],...
                  ['They will return a set of date, depth and cruiseid vectors corresponding to each other.']);

return

  

  

  
