function fsi_slicexy(Action)

switch nargin
case 0
   fig3d = findobj('Tag', 'fsi_vis3d');
   if isempty(fig3d)
      LocalInitFig;
   else
      figure(fig3d);
   end
   
   
case 1
   figH = findobj('Tag','Main');
   fig3d = findobj('Tag', 'fsi_vis3d');
   UserData = get(figH,'UserData');
   switch Action
      
   case 'apply'
      bh = findobj('Tag', '3dType');
      val = get(bh, 'Value');
      if val == 1
         fsi_vis3d('slicexy');
      elseif val == 2
         fsi_vis3d('slicez');
      elseif val == 3
         fsi_vis3d('isocontour');
      end
      
      
      
   case 'select'
     
      
   case 'slicexy'
      fsi_slicexy     
            
   case 'slicez'
      fsi_slicez
      
   case 'reset'           % Reset for a different plot
      
      
   case 'isocontour'
      fsi_isosurf
      
   case 'load'  %%%%%%%%%%%%%%%% Load a data file
      
   case 'exit'
      delete(fig3d);
   end
end



%%%%%%%%%%%%%%%%%%%%%
function LocalInitFig
% Creates the main figure

h0 = figure('Color',[0.501960784313725 0 0.250980392156863], ...
	'FileName','fsi_vis3d.m', ...
	'PaperPosition',[18 180 576 432], ...
	'PaperUnits','points', ...
	'Position',[163 295 226 278], ...
	'Tag','fsi_vis3d', ...
   'ToolBar','none');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0 1 1], ...
	'ListboxTop',0, ...
	'Position',[6.75 111 159 54], ...
	'Style','frame', ...
   'Tag','Frame1');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0 1 1], ...
	'ListboxTop',0, ...
	'Position',[22.5 9.75 117.75 34.5], ...
	'Style','frame', ...
   'Tag','goFrame');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0 1 1], ...
	'FontSize',14, ...
	'ListboxTop',0, ...
	'Position',[10.5 174.75 141.75 18], ...
	'String','FSI 3D Visualization', ...
	'Style','text', ...
   'Tag','titleText');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','fsi_vis3d select', ...
	'ListboxTop',0, ...
	'Position',[9.75 117 153 20.25], ...
	'String',['X-Y Slice ';'Z Slice   ';'isocontour'], ...
	'Style','popupmenu', ...
	'Tag','3dType', ...
	'TooltipString','Select Graph Type', ...
   'Value',1);

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.701960784313725 0.6039215686274511], ...
	'Callback','fsi_vis3d apply', ...
	'ListboxTop',0, ...
	'Position',[27.75 15.75 47.25 21.75], ...
	'String','Apply', ...
   'Tag','applyButton');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'Callback','fsi_vis3d exit', ...
	'ListboxTop',0, ...
	'Position',[87 16.5 47.25 21.75], ...
	'String','Close', ...
   'Tag','cancelButton');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 0.501960784313725 0], ...
	'FontSize',12, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ListboxTop',0, ...
	'Position',[9 141.75 152.25 18], ...
	'String','Select graph type', ...
	'Style','text', ...
   'Tag','StaticText1');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0 1 1], ...
	'ListboxTop',0, ...
	'Position',[6 51 159 54], ...
	'Style','frame', ...
   'Tag','Frame1');

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 0.501960784313725 0], ...
	'FontSize',12, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ListboxTop',0, ...
	'Position',[8.25 81.75 152.25 18], ...
	'String','Select Variable', ...
	'Style','text', ...
   'Tag','StaticText1');

figH = findobj('Tag','Main');
UserData = get(figH,'UserData');
String = strvcat(UserData.columns);

h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','fsi_vis3d select', ...
	'ListboxTop',0, ...
	'Position',[8.25 57.75 153 20.25], ...
	'String',String, ...
	'Style','popupmenu', ...
	'Tag','variableName', ...
	'TooltipString','Select variable name to graph', ...
	'Value',1);

%figure('Color',[0.501960784313725 0 0.250980392156863], ...
%   'FileName','fsi_vis3d.m', ...
%   'PaperPosition',[18 180 576 432], ...
%   'PaperUnits','points', ...
%   'Position',[324 432 226 134], ...
%   'Tag','fsi_vis3d', ...
%   'ToolBar','none');

