function orca_box(progs,pos,fmt,vbl,style,tag,tip,val,label,bcol,fcol)
%
%
% 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<9, label=[]; end
if nargin<10, bcol=[0 0 0]; end
if nargin<11, fcol=[1 1 0]; end
%
cback=['orca_act(''',tip,''');'];
if strcmp(style,'checkbox'),
	string=tip;
elseif strcmp(style,'listbox') | strcmp(style,'popupmenu') | strcmp(style,'edit'),
	if strcmp(fmt,'%s'),
		str=['string=char(',vbl,');'];
		if isempty(str), str='None Available'; end
	else
		str=['string=sprintf(''',fmt,''',',vbl,');'];
	end	
	eval(str); 
elseif strcmp(style,'text'),
%	str=['string=sprintf(''',fmt,''',',vbl,');'];
%	eval(str);
	if strcmp(fmt,'%s'),
		str=['string=char(',vbl,');']; eval(str);
	else
		string=vbl;
	end
elseif strcmp(style,'pushbutton'),
	string=tip;
end
%
if strcmp(style,'edit') | strcmp(style,'popupmenu'),
	nrow=size(string,1);
	h1 = uicontrol('Parent',Obox.figno,'Units','inches', ...
		'BackgroundColor',[1 1 1],'Callback',cback,'Position',pos, ...
		'Style',style,'String',string,'Tag',[tag,tip], ...
		'Value',val,'Max',nrow+1);
elseif strcmp(style,'text'),
	h1 = uicontrol('Parent',Obox.figno,'Units','inches', ...
		'BackgroundColor',[.6 .6 .6],'ForegroundColor',[0 0 0], ...
		'Position',pos,'String',string,'Style','text','Tag',[tag,tip]);
elseif strcmp(style,'pushbutton'),
	h1 = uicontrol('Parent',Obox.figno,'Units','inches', ...
		'BackgroundColor',[.8 0 0],'ForegroundColor',[1 1 1], ...
		'Callback',cback,'Position',pos, ...
		'Style',style,'String',string,'Tag',[tag,tip], ...
		'Value',val);
else
	h1 = uicontrol('Parent',Obox.figno,'Units','inches', ...
		'BackgroundColor',[1 1 1],'Callback',cback,'Position',pos, ...
		'Style',style,'String',string,'Tag',[tag,tip], ...
		'Value',val);
end
h2=h1;
if ~isempty(label),
	poslab=[pos(1) pos(2)+pos(4)+.005 pos(3) .205];
	cback2=['orca_help(''',tip,''');'];
	h2 = uicontrol('Parent',Obox.figno,'Units','inches', ...
		'BackgroundColor',bcol,'ForegroundColor',fcol,'Callback',cback2, ...
		'Position',poslab,'String',label,'Style','pushbutton', ...
		'Tag',[tag,tip,'label']);
end
%
Obox.nboxtot=Obox.nboxtot + 1;
nboxtot=Obox.nboxtot;
Obox.handle(:,nboxtot)=[h1;h2];
for j=1:length(progs),
	iiprog=progs(j);
	nbox=Obox.nbox_prog(iiprog) + 1;
	Obox.nbox_prog(iiprog)=nbox;
	Obox.prog(iiprog,nbox)=Obox.nboxtot;
end
