function myeval(evalop)

global HndlList01 HndlList02 HndlList2 HndlList3 HndlList4 ;
global GeomParam MatlParam MiscParam AnisParam AnisFlag;
global LayerNm MatNm LoadFileName MatlFileName; 
global SaveFileName PrintName mlayVec;
global VECTOR eigvalue modenum StartText;
global HsVect HsVectStr OmegaInp hsom;
global ShowOption MtOption SurfOption;
global printnameHndl loadnameHndl matlfileHndl; 
global savenameHndl mlayHndl anisHndl;
global LayerLabelFlag MessageTextFlag UIprintFlag 
global NodePointFlag SpacingFactor MeshLineFlag SurfContourFlag;

switch evalop,
case 0.1, LayerLabelFlag=1;show_main;
case 0.2, LayerLabelFlag=0;show_main;
case 0.3, MessageTextFlag=1;show_main;
case 0.4, MessageTextFlag=0;show_main;
case 0.5, UIprintFlag=1;myeval(115);
case 0.6, UIprintFlag=0;myeval(115);
case 0.7, SpacingFactor=SpacingFactor*2;show_main;
case 0.8, SpacingFactor=SpacingFactor/2.0;show_main;
case 0.9, zoom on;
case 0.91,zoom off;
case 0.92,MeshLineFlag=1;show_main;
case 0.93,MeshLineFlag=0;show_main;
case 0.94,NodePointFlag=1;show_main;
case 0.95,NodePointFlag=0;show_main;
case 0.96,SurfContourFlag=1;show_main;
case 0.97,SurfContourFlag=0;show_main;

case 1,  GeomParam{LayerNm}{1}=num2str(get(gco,'Value'));
case 2,  GeomParam{LayerNm}{2}=num2str(get(gco,'Value'));
case 2.1,GeomParam{LayerNm}{3}=num2str(get(gco,'Value'));
case 3,  GeomParam{LayerNm}{4}=get(gco,'string');
case 4,  GeomParam{LayerNm}{5}=get(gco,'string');
case 5,  GeomParam{LayerNm}{6}=get(gco,'string');
case 6,  LayerNm=1;myeval(1000);
case 7,  if LayerNm>1;LayerNm=LayerNm-1;myeval(1000);end;
case 8,  if LayerNm<length(GeomParam);LayerNm=LayerNm+1;myeval(1000);end;
case 9,  LayerNm=length(GeomParam);myeval(1000);
case 10, len=length(GeomParam);
      for i=1:LayerNm;TmpParam{i}=GeomParam{i};end; 
      for i=LayerNm+1:len+1;TmpParam{i}=GeomParam{i-1};end; 
      GeomParam=TmpParam;LayerNm=LayerNm+1; 
      GeomParam{LayerNm}{6}='1.0e-3'; 
      clear TmpParam;myeval(1000);
case 10.1, 
     mlayVec=str2num(get(mlayHndl,'string'));
     for j=1:length(mlayVec), 
         mlayParam{j}=GeomParam{mlayVec(j)};
     end;
     for j=1:length(mlayVec),
         len=length(GeomParam);
         for i=1:LayerNm;TmpParam{i}=GeomParam{i};end; 
         for i=LayerNm+1:len+1;TmpParam{i}=GeomParam{i-1};end; 
         GeomParam=TmpParam;LayerNm=LayerNm+1;  
         clear TmpParam;
         GeomParam{LayerNm}=mlayParam{j};
         myeval(1000);
     end;
     close(gcf);
case 11,  len=length(GeomParam);clear TmpParam; 
      for i=1:LayerNm-1;TmpParam{i}=GeomParam{i};end;
      for i=LayerNm:len-1;TmpParam{i}=GeomParam{i+1};end; 
      if LayerNm==len, LayerNm=LayerNm-1;end;
      if len>1;GeomParam=TmpParam;clear TmpParam;myeval(1000);
      end;
case 11.1, 
       mlayVec=str2num(get(mlayHndl,'string'));
       mlayVec=sort(mlayVec);
       for j=length(mlayVec):-1:1,
           LayerNm=mlayVec(j);
           myeval(11);
       end;
       close(gcf);
case 12,  MatlParam{MatNm}{1}=get(HndlList3(1),'String'); 
         MatlPopup=MatlParam{1}{1};for i=2:length(MatlParam); 
         MatlPopup=strcat(MatlPopup,'|',MatlParam{i}{1});end; 
         set(HndlList2(2),'String',MatlPopup,'Value',str2num(GeomParam{LayerNm}{1}));
case 22, MatlParam{MatNm}{2}=get(gco,'string');
case 23, MatlParam{MatNm}{3}=get(gco,'string');
case 24, MatlParam{MatNm}{4}=get(gco,'String');   
case 25, MatlParam{MatNm}{5}=get(gco,'string');
case 26, MatlParam{MatNm}{6}=get(gco,'string');
case 27, MatlParam{MatNm}{7}=get(gco,'String'); 
case 29,  if MatNm>1;MatNm=MatNm-1;end;myeval(2000);
case 30,  if MatNm<length(MatlParam);MatNm=MatNm+1;end; 
      myeval(2000);
case 31,   len=length(MatlParam);clear TmpParam; 
      for i=len:-1:MatNm+1;
      if AnisFlag(i)==1;AnisParam{i+1}=AnisParam{i};end; 
      end;  
      AnisParam{MatNm+1}=[];  
      AnisFlag=[AnisFlag(1:MatNm) 0 AnisFlag(MatNm+1:len)];
      for i=1:MatNm;TmpParam{i}=MatlParam{i};end; 
      for i=MatNm+1:len+1;TmpParam{i}=MatlParam{i-1};end;
      MatlParam=TmpParam;MatNm=MatNm+1;
      MatlParam{MatNm}{1}='New material';
      clear TmpParam;myeval(2000);

case 32,  len=length(MatlParam);clear TmpParam;    
      for i=1:MatNm-1;TmpParam{i}=MatlParam{i};end;
      for i=MatNm:len-1;TmpParam{i}=MatlParam{i+1};end;       
      for i=1:len;
        if AnisFlag(i)==1;  
          if i==MatNm,AnisParam{i}=[]; 
          elseif i>MatNm,AnisParam{i-1}=AnisParam{i};end;
        end; 
      end;   
      AnisFlag(MatNm)=[]; 
      AnisParam{len}=[]; 
      if MatNm>1;MatNm=len-1;end; 
      if len>1;MatlParam=TmpParam;clear TmpParam;myeval(2000); 
      end;   
case 41, MiscParam{1}=num2str(get(gco,'Value'));
case 42, MiscParam{2}=num2str(get(gco,'Value'));
case 43, MiscParam{3}=num2str(get(gco,'Value'));
case 44, MiscParam{4}=get(gco,'string');
case 45, MiscParam{5}=get(gco,'string');  
case 46, MiscParam{6}=get(gco,'string');  
case 47, MiscParam{7}=get(gco,'String');
case 51, xfig(1,1);
case 51.5, xfig(1,0);
case 52, xfig(2,1);
case 53, xfig(2.2,1);
case 101, MtOption=1;ShowOption=9;show_main;
case 102, MtOption=0;ShowOption=1;show_main;
case 103, MtOption=1;ShowOption=1;show_main;
case 104, ShowOption=2;show_main;
case 105, ShowOption=3;show_main;
case 106, SurfOption=SurfOption+1;ShowOption=3;show_main;
case 107, SurfOption=SurfOption-1;ShowOption=3;show_main;
case 107.1, SurfOption=1;ShowOption=3;show_main;
case 108, ShowOption=4;show_main;
case 109, ShowOption=5;show_main;
case 110, ShowOption=6;show_main;
case 111, ShowOption=7;show_main;
case 112, modenum=modenum-1;show_main;
case 113, modenum=1;show_main;
case 114, modenum=modenum+1;show_main;
case 114.1, modenum=modenum+5;show_main;
case 114.2, modenum=modenum-5;show_main;
case 115, MiniFig=3;xfig(MiniFig,0);
case 116,  %back to main menu
   axis off;
   cla;
   set(gcf,'uicontextmenu',[]);
   legend off;
   set(HndlList02,'Visible','off');
   set(HndlList01,'Visible','on');
   text(-0.1,0.25,StartText{1}, ...
      'HorizontalAlignment','center','FontSize',16,'FontWeight','bold');
   text(-0.1,0.1,StartText{2}, ...
      'HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
   text(-0.1,-0.2,StartText{3},...
      'HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
   text(-0.1,-0.35,StartText{4}, ...
      'HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
   text(-0.1,-0.5,StartText{5}, ...
      'HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
   axis([-1 1 -1 1]);
case 116.1,  %back to main menu
   axis off;
   cla;
   set(gcf,'uicontextmenu',[]);
   legend off;
   set(HndlList02,'Visible','off');
   set(HndlList01,'Visible','on');
   %text(-0.1,0.25,'This is the end of DEMO', ...
   %   'HorizontalAlignment','center','FontSize',16,'FontWeight','bold');
   text(-0.1,0.1,'This is the end of DEMO', ...
      'HorizontalAlignment','center','FontSize',16,'FontWeight','bold');
   axis([-1 1 -1 1]);

case 117,
      ShowOption=7.1;show_main;     
case 200,
      % load files and update MyModel window
      [GeomParam,MatlParam,MiscParam,AnisParam,AnisFlag]=Read_Param(LoadFileName,MatlFileName); 
      MatlPopup=MatlParam{1}{1};for i=2:length(MatlParam); 
      MatlPopup=strcat(MatlPopup,'|',MatlParam{i}{1});end;  
      myeval(3000); 
      MatNm=1;myeval(2000); 
      LayerNm=1;myeval(1000); 
      MtOption=1;ShowOption=9;close(gcf); 
      figure(1);
      %show_main;

case 200.5,
      % load files but not update MyModel window
      [GeomParam,MatlParam,MiscParam,AnisParam,AnisFlag]=Read_Param(LoadFileName,MatlFileName); 
      MtOption=1;ShowOption=9;close(gcf); 
      figure(1);
      %show_main;
      for i=1:5; set(HndlList01(i),'enable','on');end;

case 201,
    fileStr=dir('*.d');
    LoadFileName=fileStr(get(loadnameHndl,'Value')).name;
case 201.1,
    matlfileStr=dir('*.ml');
    MatlFileName=matlfileStr(get(matlfileHndl,'Value')).name;

case 202,
    Write_Param(GeomParam,MiscParam,SaveFileName);
    close(gcf);
case 202.1,
    Write_Matl(MatlParam,AnisParam,AnisFlag,MatlFileName);
    close(gcf);
case 203,
    SaveFileName=strcat(get(savenameHndl,'String'),'.d');
case 203.1,
    MatlFileName=strcat(get(savenameHndl,'String'),'.ml');
case 204,
    if UIprintFlag==0;
      if ~isempty(findstr(PrintName,'.eps')),
      print(1,'-depsc','-noui',PrintName);
      elseif ~isempty(findstr(PrintName,'.jpg')),
      print(1,'-djpeg','-noui',PrintName);
      elseif ~isempty(findstr(PrintName,'.ps')), 
      print(1,'-dpsc','-noui',PrintName);
      else;
      end;
    else %UIprintFlag==1
      if ~isempty(findstr(PrintName,'.eps')),
      print(1,'-depsc',PrintName);
      elseif ~isempty(findstr(PrintName,'.jpg')),
      print(1,'-djpeg',PrintName);
      elseif ~isempty(findstr(PrintName,'.ps')), 
      print(1,'-dpsc',PrintName);
      else;
      end;
    end; %UIprintFlag
    close(gcf);
case 205,
    PrintName=get(printnameHndl,'String');
case 300,
    AnisParam{MatNm}{num2str(i),num2str(j)}=...
    get(anisHndl(num2str(i),num2str(j)),'string');
case 301,
    AnisParam{MatNm}{num2str(i),7} ...
    =get(anisHndl(num2str(i),7),'string');
case 302,
    MatlParam{MatNm}{1}=get(HndlList3(1),'String');
    MatlPopup=MatlParam{1}{1};for i=2:length(MatlParam);
    MatlPopup=strcat(MatlPopup,'|',MatlParam{i}{1});end;
set(HndlList2(2),'String',MatlPopup,'Value',str2num(GeomParam{LayerNm}{1}));
case 303,
    AnisFlag(MatNm)=1;close(gcf);myeval(2000);
case 304,
    AnisFlag(MatNm)=0;close(gcf);
    myeval(2000);AnisParam{MatNm}=[];
case 1000,  % layer eval
    MatlPopup=MatlParam{1}{1};for i=2:length(MatlParam);
    MatlPopup=strcat(MatlPopup,'|',MatlParam{i}{1});end;
    set(HndlList2(1),'String',num2str(LayerNm));
    set(HndlList2(2),'String',MatlPopup);
    set(HndlList2(2),'Value',str2num(GeomParam{LayerNm}{1}));
    set(HndlList2(3),'Value',str2num(GeomParam{LayerNm}{2}));
    set(HndlList2(4),'Value',str2num(GeomParam{LayerNm}{3}));
    set(HndlList2(5),'String',GeomParam{LayerNm}{4});
    set(HndlList2(6),'String',GeomParam{LayerNm}{5});
    set(HndlList2(7),'String',GeomParam{LayerNm}{6});

case 2000,   %%% Matl eval
    for i=1:7;set(HndlList3(i),'String',MatlParam{MatNm}{i},'Enable','on');end; 
    set(HndlList3(8),'String',num2str(MatNm)); 
    set(HndlList3(9),'String','isotropic'); 
    if AnisFlag(MatNm)==1; 
    set(HndlList3([2,4,7]),'String','**anisotropic**','Enable','off'); 
    set(HndlList3(9),'String','aniso');
    end; 

case 3000    % evalop==3,  Misc Eval
   for i=1:3;set(HndlList4(i),'Value',str2num(MiscParam{i}));end; 
   for i=4:7;set(HndlList4(i),'String',MiscParam{i});end;

case 4000 %showrslt
   set(HndlList01,'Visible','off');
   set(HndlList02,'Visible','on');
   HndlList09=HndlList02([6,7]);
   HndlList00=HndlList02(1:8);
   if isempty(VECTOR)==1
     set(HndlList00,'Enable','off');
   else
     set(HndlList00,'Enable','on');
   end;
   if isempty(OmegaInp)==0
     set(HndlList09,'Enable','off');
   else
     set(HndlList02(5),'enable','off');
   end;
   cla;
   modenum=1;  % set default k= show mode with largest growrate
   MtOption=1;
   %ShowOption=1;show_main;
   %ShowOption=2;
   %colormap('default');
case 5000,
   a=pwd;
   web(fullfile(a,'help.html'));  
end
