function choice=di_choic(txt1,txt2,label1,label2)

% function choice=di_choic(txt1,txt2,label1,label2)
%
% This function is used in conjunction with FD3.  'Txt1' and 'txt2' each
% contain one line of a message.  'Label1' and 'label2' are the labels for
% the left and right button respectively.  If the left button is selected,
% choice=1, and, if the right button is selected, choice=2.
%
% ACP

% Last update:  July 7, 1993
% Author:       Adrian C. Penisson

global FD3DITEMP FD3PXPERCM

FD3DITEMP=0;

%%%%%%%%%%%%%%%%%%%
% make dialog box %
%%%%%%%%%%%%%%%%%%%

c=[2.75 2.125];
cv=2.54*[FD3PXPERCM FD3PXPERCM];

fh=uicontrol('Sty','frame','Pos',[c(1)-1.5 c(2)-1 3 2].*cv);
th1=uicontrol('Sty','text','Pos',[c(1)-1.4 c(2)+.5 2.8 .3].*cv,'Str',txt1);
th2=uicontrol('Sty','text','Pos',[c(1)-1.4 c(2)+.1 2.8 .3].*cv,'Str',txt2);
bh1=uicontrol('Sty','push','Pos',[c(1)-1.1 c(2)-.7 .8 .4].*cv,'Str',label1,...
   'Call','FD3DITEMP=1;');
bh2=uicontrol('Sty','push','Pos',[c(1)+.3 c(2)-.7 .8 .4].*cv,'Str',label2,...
   'Call','FD3DITEMP=2;');

h=[fh th1 th2 bh1 bh2];

set(h,'Units','pixels')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fix for B&W if necessary %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%if get(0,'ScreenDepth')==1
%   for i=1:5
%      set(h(i),'ForegroundColor',[1 1 1],'BackgroundColor',[0 0 0])
%   end
%end

%%%%%%%%%%%%%%%%%%%%%
% wait for response %
%%%%%%%%%%%%%%%%%%%%%

while FD3DITEMP==0
   pause(0.1)
end

choice=FD3DITEMP;
FD3DITEMP=[];
close(h)

