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

% The preceding empty line is important
% $Log: gbbictdu.m,v $
% Revision 1.1  1999/07/02 16:23:20  kwoklin
% Addtion to globec files.   klee
%

% $Id: gbbictdu.m,v 1.1 1999/07/02 16:23:20 kwoklin Exp $
% klee 06/30/99

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

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

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

StartYear = passtimes(whichurl,1);
StartMonth = passtimes(whichurl,2); 
StartDay = passtimes(whichurl,3); EndDay = passtimes(whichurl,4);
Constraint = [Constraint, '&',yearname,'=',num2str(StartYear),'&',monthname,'=',num2str(StartMonth),...
              '&',dayname,'>=',num2str(StartDay), '&',dayname,'<=', num2str(EndDay)];

returned_var = [];
for i = 1:size(getvariablelist,1)
  returned_var = [returned_var, dods_dbk(getvariablelist(i,:))];  
  if i < size(getvariablelist,1)
    returned_var = [returned_var, ','];
  end
end
returned_var = [returned_var, ',', deblank(OptionalVariables(1,:))];

if StartYear == 1995 
  if StartMonth < 7
    server = [Server, num2str(StartYear-1900), 'a'];
  else
    server = [Server, num2str(StartYear-1900), 'b'];
  end
else
  server = [Server, num2str(StartYear-1900)];
end

url = [server, '?', returned_var, Constraint];

return

  

  

  
