function stopFlag=ssinit(figNumber)
%SSINIT Initialize the Slide Show figure
%
%	stopFlag=SSINIT(figNumber) interacts with the function 
%	SSHOW to initialize the Slide Show figure with the appropriate
%	information. Its sole purpose is to exit the demo script after the
%	initial plot and text are displayed, thereby allowing the user
%	to decide if they want to see the demo.

%	Ned Gulley, 6-21-93
%	Copyright (c) 1984-94 by The MathWorks, Inc.

% If figNumber is zero, the demo will run without the GUI shell.
if figNumber==0,
    % The stopFlag must be set to one even though in this case the demo
    % will NOT stop. This allows the first screen to plot properly when
    % running the demo from the command line.
    stopFlag=1;

else
    figure(figNumber);
    axHndl=gca;
    hndlList=get(figNumber,'UserData');

    startHndl=hndlList(2);
    % The UserData for the Start button is the Init Flag.
    % If it is high, then we SHOULD set stopFlag to high (and thus
    % exit the demo script early).

    if get(startHndl,'UserData'),
        % Set the UserData of the start button.
        set(startHndl, ...
	    'UserData',0, ...
	    'String','Start', ...
	    'Interruptible','yes');
        stopFlag=1;
    else
        % If the initialization screen has already been placed,
        % then keep executing the script.
        stopFlag=0;
	% Once we start the slide show, the Start button should
	% change to a "Reset" button. Also, set its "interruptible"
	% property to off so we don't cause problems later on with
	% user double-clicks.
 	set(startHndl, ...
	    'String','Reset', ...
	    'Interruptible','no');
    end;

end    % if figNumber==0 ...
