function tour(action)
%

%   Yama Habibzai
%   Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
%   $Revision: 1.34 $ $Date: 1998/10/16 23:12:44 $

if nargin<1,
  action='showmain';
  % Get the users warning state and return it to this later
  [warn, f] = warning;
end;

global helpflag;

% Note that the warning is set back to its original state
% in tourbye.m
warning off;

%====================================
% Handle the SHOW events
if strncmp(action, 'show', 4),
  figNumber = findall(0, 'Name', 'MATLAB Tour');
  if isempty(figNumber),
    helpflag = 0;
    tour('initialize');
    clc;
    figs = allchild(0);
    figNumber = findobj(figs, 'Name', 'MATLAB Tour');
    param = get(figNumber, 'Userdata');
    param.warning = warn;
    param.DemoWin = [];
    set(figNumber, 'Userdata', param);
    set(figNumber,'Visible','on')
  end;
  watchon;    
  mapIndex=2;
  %---------------------------------------------

  switch action
  % if strcmp(action,'showmain'),
    
  case 'showmain',
    localSetCategory('showmain', helpflag, 1);
    % Set the callback for the product image
    figs = allchild(0);
    figNumber = findobj(figs, 'Name', 'MATLAB Tour');
    %clsdemo([]);
    set(figNumber, 'windowbuttonmotionfcn', 'windfit(''movement'')',...
        'windowbuttondownfcn', 'windfit(''click'')');
    load tourmap;
    mapIndex=1;
    pageIndex=1;
    set(figNumber, 'HandleVisibility', 'off');
    %---------------------------------------------
  case 'showmatlab',
    localSetCategory('showmatlab', helpflag, 1);
    localturnoff(figNumber)
    load matlwin;
    pageIndex=1;
    CatagoryName='MATLAB';
    btncall = 'MATLAB';
    
    %---------------------------------------------
  case 'showtoolbox',
    localSetCategory('showtoolbox', helpflag, 1);
    localturnoff(figNumber)
    load tlbxwin;
    pageIndex=2;
    CatagoryName='Toolboxes';
    btncall = 'Toolboxes';
    %---------------------------------------------
  case 'showsimulink',
    localSetCategory('showsimulink', helpflag, 1);
    %clsdemo([]);    
    load slwin;
    pageIndex=3;
    CatagoryName='Simulink';
    btncall = 'SIMULINK';
    

    %---------------------------------------------
  case 'showsig',
    localSetCategory('showsig', helpflag, 1);
    localturnoff(figNumber)
    load sigwin;
    pageIndex=4;
    CatagoryName = 'Signal Processing';
    btncall = 'Signal';
    
    %---------------------------------------------
  case 'showcont',
    localSetCategory('showcont', helpflag, 1);
    localturnoff(figNumber)
    load contwin;
    pageIndex =5;
    CatagoryName = 'Control Systems';
    btncall = 'Control';
    
    %---------------------------------------------
  case 'showcontac',
    localSetCategory('showcontac', helpflag, 1);
    localturnoff(figNumber)
    load infowin;
    pageIndex = 6;
    comp = computer;
    CatagoryName = 'Resources &...';
    btncall = 'Resources';
    
    %---------------------------------------------
  case 'showprog',
    localSetCategory('showprog', helpflag, 1);
    %clsdemo([]);    
    load progwin;
    pageIndex = 7;
    CatagoryName = 'Programming';
    btncall = 'Programming';
    
    %---------------------------------------------
  case 'showdat',
    localSetCategory('showdat', helpflag, 1);
    localturnoff(figNumber)
    load analwin;
    pageIndex = 8;
    CatagoryName = 'Data Analysis ... ';
    btncall = 'Data';
    
    %---------------------------------------------
  case 'showmath',
    localSetCategory('showmath', helpflag, 1);
    localturnoff(figNumber)
    load mathwin;
    pageIndex = 9;
    CatagoryName = 'Mathematics';
    btncall = 'Math';

    %---------------------------------------------
  case 'showdss',
    localSetCategory('showdss', helpflag, 1);
    %clsdemo([]);
    load syswin;
    pageIndex = 10;
    CatagoryName = 'Dynamic...';
    btncall = 'dss';
    
    % -----------------------------------
  case 'showindustry',
    localSetCategory('showindustry', helpflag, 1);
    %clsdemo([]);
    load induswin;
    pageIndex = 11;
    CatagoryName = 'Industry';
    btncall = 'industry';

    %---------------------------------------------
  case 'showblkset',
    localSetCategory('showblkset', helpflag, 1);
    %clsdemo([]);
    load blockwin;
    pageIndex=12;
    CatagoryName = 'Blocksets';
    btncall = 'blockset';
 
    %---------------------------------------------
  case 'showsf',
    localSetCategory('showsf', helpflag, 1);
%    localturnoff(figNumber)
    %clsdemo([]);
    load sfwin;
    pageIndex=13;
    CatagoryName = 'Stateflow';
    btncall = 'stateflow';

  end;  % switch ...

  param=get(figNumber,'UserData');
  Mainwin = figNumber; 
  allBtnHndl=findobj(Mainwin, 'type', 'uicontrol');
  firstPgBtnHndl=findobj(Mainwin,'Tag', 'firstPage'); 
  
  if mapIndex==1
    % The first page
    % Turn off old uicontrols, turn on new uicontrols     
    set(allBtnHndl, 'Visible', 'off');
    set(firstPgBtnHndl, 'Visible', 'on');
  else
    
    for i=1:length(param.pageList{pageIndex})
      CatagoryList{i}=param.pageList{pageIndex}(i).Name;
    end
    
    % set up DemoList, FcnList and catagory name
    CatagoryHndl=findobj(Mainwin, 'Tag', 'ToolListTag');
    set(CatagoryHndl, 'String', char(CatagoryList), 'Value', 1);
    demoList=char(param.pageList{pageIndex}(1).DemoList);
    demoHndl=findobj(Mainwin, 'tag', 'tooldemos');
    set(demoHndl, 'String', demoList, 'Value', 1);
    catagoryLabel=findobj(Mainwin, 'Tag', 'label2');
    set(catagoryLabel, 'String', CatagoryName);
    runBtn=findobj(Mainwin, 'Tag', 'RunDemo');
    set(runBtn, 'String', 'Run');
    aboutBtn=findobj(Mainwin, 'Tag', 'about');
    aboutLabel=lower(['about' btncall]);
    callbackStr=['tour ' aboutLabel];
    set(aboutBtn, 'String', ['More on ' CatagoryName], 'Callback', callbackStr);
    set(allBtnHndl, 'Visible', 'on');
    set(firstPgBtnHndl, 'Visible', 'off');
    if helpflag == 0
      str ={' '
      ' '
      '    Select a Category from the left'
      '    and the demo selections will'
      '    appear ''here'' on the right.'
      ' '
      '    To run a demo, either click on'
      '    the RUN button, or double click'
      '    on the demo selection.'};
      
      
      demolistbx = findobj(Mainwin, 'tag', 'tooldemos');
      set(demolistbx, 'string', str, 'value', [], 'callback', ' ',...
         'foregroundcolor', [0 0 1]);
      runHndl=findobj(figNumber, 'Type', 'uicontrol', 'Tag', 'RunDemo');
      set(runHndl, 'Enable', 'off', 'string', 'Run');
      toollist = findobj(Mainwin, 'tag', 'ToolListTag');
      set(toollist, 'value', []);
      helpflag = 1;
    end % if ...
  end % if ...
  % show big image
  imHndl=param.bigImg;
  set(imHndl, 'Cdata', a);
  param.pageIndex=pageIndex;
  set(figNumber, 'UserData', param,...
      'HandleVisibility', 'off',...
      'ColorMap', cm);
  watchoff(figNumber);

end % if show ... 

%====================================
% Handle the ABOUT events
 
switch action  
case 'aboutmain',
  ttlStr='MATLAB Tour ...';
  Help= ...                                               
      {'                                                 '
  ' Welcome to the MATLAB Tour, an   '
  ' invitation to explore the world of scientific   '
  ' and engineering software produced by The        '
  ' MathWorks, Inc.                                 '
  '                                                 '
  ' MATLAB, Simulink, and the MATLAB                '
  ' Application Toolboxes represent the best        '
  ' software your money can buy for state-of-the-   '
  ' art computation, visualization, and simulation  '
  '                                                 '
  ' The MATLAB Tour, built using MATLAB,    '
  ' is a collection of demos that shows MATLAB and  '
  ' its related product capabilities. To start,      '
  ' click on any of the DEMO buttons.               '
  '                                                 '
  ' If this is your first experience with MATLAB,   '
  ' we recommend that you take a look at the        '
  ' Product Overview section of the software. It    '
  ' provides an overview of MATLAB and where each   '
  ' product fits in the MATLAB family.              '
  
  ' Just point and click your way to different areas'
  ' that interest you. Enjoy!                       '};
  helpwin(Help, ttlStr);
  
case 'abouttoolboxes',
  ttlStr='More on Toolboxes...';
  Help= {'                                               '
  ' Toolboxes are specialized collections of M-files (MATLAB language'
  ' programs) built specifically for solving particular classes of'
  ' problems.'
  ' '
  ' Our Toolboxes are more than just collections of useful functions,'
  ' though. They represent the efforts of some of the world''s top'
  ' researchers in fields such as controls, signal processing, system'
  ' identification, and others.'
  ' '
  ' Browse through the Toolbox screens in the MATLAB Tour to see which'
  ' toolboxes might be appropriate for the work you do.'};
  helpwin(Help, ttlStr);
  
case 'aboutblockset',
   ttlStr = 'More on Blocksets ...';
   Help = ...
       {' '
  ' Similar to MATLAB and its application toolboxes, The MathWorks'
  ' offers Blocksets for use with Simulink. Blocksets are collections'
  ' of Simulink blocks, that are grouped in a separate library from'
  ' the main Simulink library.'
  ' '
  ' Blocksets are available in the areas of digital signal processing'
  ' (DSP Blockset), fixed point Math (Fixed Point Blockset), and'
  ' Nonlinear Control Design (Nonlinear Control Design Blockset).'};  
  helpwin(Help, ttlStr);
  
case 'aboutmatlab',
  ttlStr = 'More on MATLAB ...';
  Help =  ...
      {'                                                         '
  'MATLAB is a technical computing environment for          '
  'high-performance numeric computation and visualization.  '
  'MATLAB integrates numerical analysis, matrix computation,'
  'signal processing, and graphics in an easy-to-use        '
  'environment where problems and solutions are expressed   '
  'just as they are written mathematically - without        '
  'traditional programming.                                 '
  '                                                         '
  'The name MATLAB stands for matrix laboratory. MATLAB was '
  'originally written to provide easy access to matrix      '
  'software developed by the LINPACK and EISPACK projects,  '
  'which together represent the state of the art in software'
  'for matrix computation.                                  '
  '                                                         '
  'MATLAB is an interactive system whose basic data element '
  'is a matrix that does not require dimensioning. It       '
  'enables you to solve many numerical problems in a        '
  'fraction of the time that it would take to write a       '
  'program in a language such as Fortran or C.      '
  'MATLAB has evolved over a period of years with input from'
  'many users. In university environments, it has become the'
  'standard instructional tool for introductory courses in  '
  'applied linear algebra, as well as advanced courses in   '
  'other areas such as signal processing and control system design'
  'In industrial settings, MATLAB is used for  '
  'research and to solve practical engineering and          '
  'mathematical problems. Typical uses include general      '
  'purpose numeric computation, algorithm prototyping, and  '
  'special purpose problem solving with matrix formulations '
  'that arise in disciplines such as automatic control      '
  'theory, statistics, and digital signal processing        '
  '(time-series analysis).                                  '
  '                                                         '
  'MATLAB also features a family of application-specific    '
  'solutions that we call toolboxes. Very important to most '
  'users of MATLAB, toolboxes are comprehensive collections '
  'of MATLAB functions (M-files) that extend the MATLAB     '
  'environment in order to solve particular classes of      '
  'problems. Areas in which toolboxes are available include '
  'signal processing, control systems design, dynamic       '
  'systems simulation, systems identification, neural       '
  'networks, and others.                                    '
  '                                                         '
  'Probably the most important feature of MATLAB, and one   '
  'that we took care to perfect, is its easy extensibility. '
  'This allows you to become a contributing author, too,     '
  'creating your own applications. In the years that MATLAB '
  'has been available, we have enjoyed watching many engineers,'
  'scientists, and mathematicians develop new and'
  'interesting applications, all without writing a single   '
  'line of C, Fortran, or other low-level code.             '};
  
  helpwin(Help, ttlStr);
  
case 'aboutsimulink',
  ttlStr = 'More on Simulink...';
  Help = about('simulink');
  helpwin(Help, ttlStr);
  
case 'aboutsignal',
  
  ttlStr = 'More on Signal Processing...';
  Help = {'                                                          '
  'By combining MATLAB with the Signal Processing Toolbox,   '
  'Wavelet Toolbox, and a host of complementary tools -      '
  'such as Image Processing, Neural Network, Fuzzy Logic,    '
  'Statistics,  and others - you can create a customized      '
  'signal analysis and DSP algorithm development             '
  'environment.                                              '
  '                                                          '
  'The Signal Processing Toolbox builds on the numeric and   '
  'visualization capabilities of MATLAB to provide a         '
  'comprehensive and open signal processing environment. The '
  'Toolbox contains powerful tools for algorithm development,'
  'signal and linear system analysis, and time series data   '
  'modeling.                                                 ' 
  '                                                          '
  'Built on a solid foundation of filter design and          '
  'spectral analysis techniques, the Toolbox includes        '
  'functions for:                                            '
  '                                                          '
  '         Signal and linear system models                  '
  '         Digital and analog filter design                 '
  '         Filter analysis and implementation               '
  '         Transforms                                       '
  '         Statistical signal processing                    '
  '         Parametric time series modeling                  '
  '         Waveform generation                              '
  '         Windowing                                        '
  '         Specialized operations                           '};
  
  helpwin(Help, ttlStr);
  
case 'aboutstateflow',

  ttlStr = 'More on Stateflow';
  Help =   {' Stateflow is a graphical tool for designing complex control and'
  ' supervisory logic systems. Stateflow gives you the ability to'
  ' model and simulate the behavior of complex reactive, event-based'
  ' systems based on finite state machine theory. This capability'
  ' adds to Simulink the ability to combine both continuous and'
  ' event-driven elements of a system in a single closed-loop'
  ' simulation,'
  '                                                '
  ' In addition, Stateflow can produce efficient production-quality'
  ' code so that you can turn your thoughts and ideas into real'
  ' systems.    '
  ' '};

  helpwin(Help, ttlStr);
case 'aboutcontrol',
  
  ttlStr = 'More on Control Systems ...';
  Help ={'                                                          ' 
  'With its broad range of tools for control system modeling '
  'analysis, simulation, and prototyping, MATLAB is the ideal'
  'system for developing advanced control systems. You can   '
  'model your control system using MATLAB''s advanced control '
  'design toolboxes - Control System, Robust Control,        '
  'Mu-Analysis and Synthesis, Model Predictive Control, QFT  '
  'Control Design, and LMI Control. Further analysis and     '
  'refinements can be performed by setting up an interactive '
  'simulation in Simulink, then automatically tuning         '
  'parameters using the Nonlinear Control Design Blockset.   '
  'Finally, you can generate C code to run on embedded       '
  'controllers with Real-Time Workshop.                      '
  '                                                          '
  'The MATLAB Control System Toolbox''s central features are  '
  'functions that implement the most useful "classical"      '
  'transfer function and "modern" state-space control        '
  'techniques. The algorithms in the Control System Toolbox  '
  'have been carefully implemented for efficiency and        '
  'reliable numeric results.  Automatic plotting and range   '
  'selection are provided for ease of use.                   '};  
  
  helpwin(Help, ttlStr);
  
case 'aboutservice',
  
  ttlStr = 'More on Resources & Contact Information ...';
  
  Help = {'                                                     '
  'The MathWorks'' dedication in providing you with      '
  'extensive information and superior service is        '
  'uncomparable. Our superb service representatives and '
  'technical support engineers are always there to help '
  'and guide you with our products.                     '
  '                                                     '
  'If you have any questions about The MathWorks products'
  'or services, please contact us via, phone, email or the World'
  'Wide Web.                                            '
  ' '
  'Phone: (508) 467-7000'
  'Email: info@mathworks.com'
  'WWW  : http://www.mathworks.com'
  '                                                     '
  '    We are looking forward to serving you ...        '};
  helpwin(Help, ttlStr);
  
case 'aboutnew',
  
  ttlStr = 'What''s New ...';
  Help = {'                                                         '
  'The MathWorks is dedicated to bring you the ultimate     '
  'technical computing environment for numeric computation, '
  'visualization, and simulation. We use this environment,  '
  'and the mathematics embodied within it, to provide       '
  'innovative solutions in selected application areas. Our  '
  'goal is to increase the scope and productivity of science'
  'and engineering, to accelerate the pace of discovery and '
  'development, to facilitate learning, and to amplify the  '
  'creativity of research.                                  '
  '                                                         '
  'This window lists some of our latest tools and their     '
  'demos for different industries.                          '};
  
  helpwin(Help, ttlStr);   
  
case 'aboutmath',
  
  ttlStr = 'Mathematics';
  Help = {' '
  'All of MATLAB''s number crunching is done on the'
  'matrix. As a result of the matrix operations,'
  'faster and more efficient mathematical computations'
  'are performed.'
  ' '
  'This category lists demos and MATLAB Tools that'
  'are aimed at mathematics.'}; 
  helpwin(Help, ttlStr);
  
case 'aboutdata',
  
  ttlStr ='Data Analysis & Visualization';
  
  Help ={' '
  'MATLAB not only has an array of functions to analyze and'
  'display your data, but also a collection of Toolboxes with'
  'their own functions as an add-on to MATLAB. One use of'
  'MATLAB is analyzing data and visually displaying the results.'
  'In this Category, there is a lists of Toolboxes that are used'
  'mostly for the tasks of Data Analysis and Visualization.'
  ' '};  
  
  helpwin(Help, ttlStr);
  
case 'aboutresources',
  ttlStr = 'Resources & Contact Info';
  Help ={'This window shows the resources available to our customers'
         'and how to contact us.'};
 helpwin(Help, ttlStr); 
case 'aboutprogramming',
  ttlStr = 'Programming';
  
  Help ={' '
' MATLAB integrates computation, visualization, and programming'
' in a flexible, open environment. Designed to handle large-scale'
' technical projects in research and industry, MATLAB offers'
' engineers and scientists an intuitive language for expressing'
' problems and their solutions mathematically and graphically.'
' '
' The MATLAB Product Family includes tools for:'
'-Data analysis, exploration, and visualization'
'-Numeric and symbolic computation'
'-Engineering and scientific graphics'
'-Modeling, simulation, and prototyping'
'-Programming, application development, and GUI design'
'-Converting MATLAB programs to C and C++ code automatically'
' '
' MATLAB products are used in a variety of application areas'
' including signal and image processing, control system design,'
' remote sensing, and medical research. The open architecture'
' makes it easy to use MATLAB and companion products to explore'
' data and create custom tools that can provide early insights'
' and competitive advantages.'};

  helpwin(Help, ttlStr);
  
case 'family',
   figs = allchild(0);
   figNumber = findobj(figs, 'Name', 'MATLAB Tour');
   set(figNumber, 'Pointer', 'watch');
   matlfam;
   set(figNumber, 'Pointer', 'arrow');

case 'aboutindustry',
  ttl = 'MATLAB in the Industry';
  
  str = {'MATLAB is fast becoming the standard calculation and development tool'
'in almost every high tech industry.  This category covers a brief'
'list of the industries MATLAB is used in. For more information make sure'
'you visit The MathWorks Web site.'
' '
'http://www.mathworks.com'};

  helpwin(str, ttl);
  
case 'aboutdss',
  
  ttlStr ='Dynamic System Simulation';
  Help={' '
  'This window lists some of the many tools The MathWorks provides for'
  'dynamic system simulation.'
  ' '
  'These tools are becoming the ideal design environment for'
  'engineers in the industry. For example, engineers can use Simulink'
  'and its easy-to-use block library to model and simulate their system,'
  'then use Toolboxes such as the Nonlinear Control Design and Fuzzy Logic'
  'Toolboxes to tweak their system to perfection, and then finally download'
  'the standalone code generated by Real-Time Workshop onto a'
  'different processor.'
  ' '};
  
  helpwin(Help, ttlStr);
  
case 'initialize',
  
  clc;

  % Make sure the window is big enough
  figurePos = getfgpos(560, 420);
  load finger;  

  % Units of figure are set to pixels due to graphics display.
  figNumber=figure( ...
      'closerequestfcn', 'tourbye',...
      'Name','MATLAB Tour', ...
      'NumberTitle','off', ...
      'Visible','off', ...
      'Units', 'pixels',...
      'Resize','off', ...
      'IntegerHandle', 'off',...
      'menu', 'none',...
      'Colormap',[], ...
      'Position', figurePos,...
      'Tag', 'Tour',...
      'PointerShapeCData', x,...
      'windowbuttonmotionfcn', 'windfit(''movement'')',...
      'windowbuttondownfcn', 'windfit(''click'')',...
      'Pointer','watch');
  defFigColor = get(figNumber, 'color');
  set(figNumber, 'color', [1 1 1]); 
  set(gca, 'position', [0 0 1 1]); 
  % load mainmap big image and save big image handle, set default page to first page 
  
  
  figs = allchild(0);
  figNumber = findobj(figs, 'Name', 'MATLAB Tour');
  % put up a wait message temporarily
  waitStr = 'Please wait... loading the MATLAB Tour';
  set(gca, 'Units', 'Normalized',...
      'Position', [0 0 1 1]);
  axis off;
  set(figNumber, 'Visible', 'on'); 
  waitH = uicontrol(figNumber,... 
      'Style', 'Text',...
      'Units', 'Normalized',...
      'Position', [.15 .5 .7 .1],...
      'String', waitStr);
  set(waitH, ...
      'HorizontalAlignment', 'center', ...
      'ForeGroundColor', [0 0 0], ...
      'BackGroundColor', [1 1 1],...
      'FontSize', 14, ...
      'Tag', 'waittext');
  
  set(figNumber, 'Visible', 'on');
  drawnow; 
  set(figNumber, 'Pointer', 'watch')
  % load all the toolboxes and save them 
  [tbList, bsList]  = finddemo;
  if isempty(tbList); tbList = []; end;
  if isempty(bsList); bsList = []; end;

  param.toolboxes = tbList;
  param.blocksets = bsList;
 
  param.prevdemo = ' '; % Used for windowing order (see evalcb.m)
  set(figNumber, 'Userdata', param);
  
  load tourmap;
  bigImgHndl=image(a);
  param.bigImg=bigImgHndl;
  param.pageIndex=1;
  axis off; 
  pageList{1}=ematinfo;
  
  pageList{2}=etbinfo;
  
  pageList{3}=esiminfo;
  pageList{4} = esiginfo; 
  
  pageList{5} = ecntinfo;
  pageList{6} = contact; 
  
  pageList{7} = eprginfo;
  
  pageList{8} = edatinfo;
  pageList{9} = emthinfo;
  
  pageList{10} = edssinfo;  
  pageList{11} = eindinfo;
  pageList{12} = eblkinfo;
  pageList{13} = esfinfo;
  
  set(figNumber,'UserData',param);    
  % Initialize map buttons and listboxes
  figs = allchild(0);
  figNumber = findobj(figs, 'Name', 'MATLAB Tour');
  buttons(figNumber);
  
  param.pageList=pageList;
  
  param.curIndex=1;
  
  set(figNumber,'UserData',param);
  
  % Initialize menu
  localmenu(figNumber);
  % Initialization is now complete.
  %set(waitH, 'Visible', 'off');
  delete(waitH);
  set(figNumber, 'color', defFigColor);
  
case 'info',
  ttl = 'MATLAB Tour Help';
  str ={'From the Main Tour Window, select the category that interests you.'
  'Then, in the next window, select a category or product from the list'
  'on the left and the demos and examples will appear on the right. To'
  'run a demo, either click on the RUN button, or double click on the demo'
  'selection.'
  ' '
  'Simulating a Simulink Model:'
  ' '
  'To run one of the Simulink model examples, under the SIMULATION'
  'Menu of the model select start.'
  ' '
  'Before you can close a model, you must stop the simulation first.'
  'To stop a Simulink simulation, under the SIMULATION Menu select'
  'Stop.'};
  helpwin(str, ttl);

  watchoff(figNumber);

end;  % 



%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Local Functions %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
 
function localmenu(figNumber)
%  MENU Initializes Tour menubar.

% The Menu Labels 
labels = str2mat( ...
    '&File', ...
    '>New', ...
    '>Open', ...
    '>Close', ...
    '&Help', ...
    '>MATLAB Tour Help',...
    '>----------------',...
    '>MATLAB Help Window',...
    '>Help Tips',...
    '>----------------',...
    '>Help Desk (HTML)',...
    '>Subscribe (HTML)',...
    '&Window',...
    '>Main Window',...
    '>----------------',...
    '>Products',...
    '>>Matlab',...
    '>>Toolboxes',...
    '>>Simulink',...
    '>>Blocksets',...
    '>>Stateflow',...
    '>Applications',...
    '>>Analysis && Visualization',...
    '>>Mathematics',...
    '>>Programming',...
    '>>Dynamic System Simulation',...
    '>>Control Design',...
    '>>Signal Processing',...
    '>MATLAB in Industry',...
    '>Resources && Contact Info'...
    );

%  The CallBacks .....
calls = str2mat( ...
    '', ...
    '', ...
    '',...
    'tourbye', ...
    '', ...
    'tour info', ...
    '',...
    'helpwin', ...
    'helpwin helpinfo',...
    '', ...
    'helpdesk', ...
    'doc subscribe',...
    '',...
    'tour showmain', ...
    '',...
    '', ...
    'tour showmatlab', ...
    'tour showtoolbox', ...
    'tour showsimulink',...
    'tour showblkset', ...
    'tour showsf',...
    '',...
    'tour showdat', ...
    'tour showmath',...
    'tour showprog',...
    'tour showdss', ...
    'tour showcont',...
    'tour showsig', ...
    'tour showindustry', ...
    'tour showcontac'...
    );

% Tags for Uimenu

tags = str2mat( ...
    '',...
    '',...
    '',...
    'uimtag',...
    '',...
    'uimtag',...
    '',...
    'uimtag',...
    'uimtag',...
    '',...
    'uimtag',...
    'uimtag',...
    '',...
    'uimtag',...
    '',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    '',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag',...
    'uimtag'...
    );

handles = makemenu(gcf, labels, calls, tags) ;

% Turn Enables off for some of the menus
NewHndl = findobj(handles, 'Label', 'New');
set(NewHndl, 'Enable', 'off');
OpenHndl = findobj(handles, 'Label', 'Open');
set(OpenHndl, 'Enable', 'off');
contHndl = findobj(handles, 'Label', 'MATLAB in Industry');
set(contHndl, 'Separator', 'on');


%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% LOCALSETCATEGORY %%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%
function localSetCategory(categoryFcn, helpflag, flag)

% Close any of the front image window still open
fig = findall(0, 'Tag', 'FrontImage');
if ~isempty(fig)
 close(fig)
end

% Turn check on for uimenu of this category
call = ['tour ' categoryFcn];

figs = allchild(0);
fig = findobj(figs, 'Name', 'MATLAB Tour');
set(fig, 'Pointer', 'watch'); 
uimenall = findobj(fig, 'type', 'uimenu');
if exist('uimenall');
  set(uimenall, 'checked', 'off');
end

for i=1:size(uimenall)
  callbackstr = get(uimenall(i), 'callback');
  callbackstr = deblank(callbackstr);
  if strcmp(callbackstr, call)
    set(uimenall(i), 'checked', 'on');
  end
end

if helpflag == flag;
  demolistbx = findobj(fig, 'tag', 'tooldemos');
  set(demolistbx,'foregroundcolor', [0 0 0]);
end
set(fig, 'windowbuttonmotionfcn', ' ',...
    'windowbuttondownfcn', ' ');

% turn on the run button and listbox
listb = findobj(fig, 'tag', 'tooldemos');
runButton = findobj(fig, 'tag', 'RunDemo');
set(listb, 'callback', 'evalcb(''showdemo'')');
set(runButton, 'Enable', 'on');


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% LOCALTURNOFF %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function localturnoff(figNumber)
set(figNumber, 'Pointer', 'watch');
demolistbx = findobj(figNumber, 'Tag', 'tooldemos');
set(demolistbx, 'callback', ' ');
runHndl=findobj(figNumber, 'Type', 'uicontrol', 'Tag', 'RunDemo');
set(runHndl, 'Enable', 'off', 'string', 'Run');
%clsdemo([]);


