function pos=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,jcol,jrow)
%
off_h=cumsum([hoff0 box_h + lab_h + box_sp(1)]);
off_v=cumsum([voff0 box_v + lab_v + box_sp(2)]);
%

%pos=[off_h(jcol); off_v(jrow); box_h(jcol); box_v(jrow)];
%
ncol=length(jcol); nrow=length(jrow);
height=sum(box_v(jrow)) + (nrow-1)*(lab_v+box_sp(1));
width=sum(box_h(jcol)) + (ncol-1)*(lab_h+box_sp(2));
ver_pos=off_v(min(jrow));
hor_pos=off_h(min(jcol));
pos=[hor_pos; ver_pos; width; height];
%if nrow>1, off_h,off_v,height,width,ver_pos,hor_pos, keyboard; end
%
% 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.
