local fFirstTime=true;
function mini_create ()
  show_help_wnd=true;
  init_mini(1);
   create_mini(3,224,100,92,118,653,4,2);

  --create_mini(8128);
  -- finish_mini_game(true);
end;
--function mini_msg_proc (id)
function gameinput (sender,id,attachedID)

  if sender==30 then
  BlockCursor(false);
    setcurentleaf("gallery",3,0);
      flags.nohints=false;
    if flags.minicomplete19 then  
      flags.cleanportrait= true;
      Set_Cursor(21,3);
      DeleteElement("gr",1656);
      DeleteElement("gr",53);
      playeffect("29");
      StopEmiter("portret"); 
      CreateWindow(150,250,"210",1,nil,250,30);  
      --playeffect("01");      
      flags.portrait = true;
  savegame(SaveLevel());
    return; end;
  return; end;
  
  if sender==10 then
    speciale_action(2,672);-- ÔÎÒÎ ×ÈÑÒÎÅ
    flags.sobrano= true;
      set_visible_object(5000,false);
  set_visible_object(5001,false);
  set_visible_object(5100,false);
  speciale_action(2,6000,true);
    DeleteElement("gr",108);
  return; end;
  if sender==37 then
     skipping=true;
  return;end;    
  if sender==36 and id==2100 then
    clear_satelite_leaf("gallery");
  return;end;  
  if sender==100 then
    if not help then
      CreateWindow(200,200,"2",100,"messageinfo",30,50)
      --playeffect("01");  
      help=true;
    end;
  return;end;
    if sender==6 then
    if helpbtn then
    if not flags.sobrano then
         CreateWindow(200,200,"2",100,"messageinfo",30,50)
      playeffect("11");  
      helpbtn=false;
    end;
    end;
    return; end;
  if sender==26 then

  if id==100 then
  set_visible_object(5001,true)
  end;

    if id==2 then
      flags.minicomplete19=true;
    StartTimer(2100,1)
    BlockCursor(true);
    return; end;
  return; end;
    if pause_state then
    if sender==1 or sender==6 or sender==14 then
      pause_state=false;
      --set_visible_object(11111,false);
    end;  
  return;end;
  if sender==1 then
    if id==6000 then
         helpbtn=true;
    return;end
    if id==5000 and skipping then
      if not flags.minicomplete then
        finish_mini_game(true);
      return;end;  
    return;end;
  if id==650 then
    finish_mini_game(false);
    clear_satelite_leaf("gallery");
    DeleteResource(  "m19_close"         );
    DeleteResource(  "m19_fon"           );
    DeleteResource(  "m19_lenta"           );
    DeleteResource(  "foto1"       );


  return;end;
    if id==672 then
         if attachedID==53 then
           RemoveFromMouse(attachedID);
           CreateWindow(150,250,"208",nil,nil,250,30);  
                 playeffect("aero");
                 
           flags.cleanportrait=true;
           Set_Cursor(21,3);
           speciale_action(2,670,true);-- ÔÎÒÎ ÐÀÇÌÛÒÎÅ
                     speciale_action(2,672,true);-- ÔÎÒÎ ×ÈÑÒÎÅ ÈÑ×ÅÇÀÅÒ
           flags.gubka=true;
          return; end;
         if (attachedID~=53)  and (attachedID>-1) then
         RemoveFromMouse(attachedID);
          CreateWindow(150,250,"200",nil,nil,250,30);
                --playeffect("01");
             return; end;
        if  attachedID<=-1 then 
          CreateWindow(150,250,"207",nil,nil,250,30);  
                --playeffect("01");
        return; end;  
  return;end;
  if id== 670 then    
         if attachedID==1656 then
          CreateWindow(150,250,"209",nil,nil,250,30);
              playeffect("gubka");
          flags.spray=true;
          RemoveFromMouse(attachedID);
          Set_Cursor(671,2);
          speciale_action(2,671,true);-- ÔÎÒÎ ×ÅÐÍÎ-ÁÅËÎÅ
          speciale_action(2,670,true);-- ÔÎÒÎ ÐÀÇÌÛÒÎÅ ÈÑ×ÅÇÀÅÒ
          return; end;  
          if (attachedID~=1656) and (attachedID>-1) then
        RemoveFromMouse(attachedID);
          CreateWindow(150,250,"200",nil,nil,250,30);
                --playeffect("01");
          return; end;    
        if  attachedID<=-1 then 
          CreateWindow(150,250,"202",nil,nil,250,30);
                --playeffect("01");
        return; end;               
  return; end;
  if id==671 then
    CreateWindow(150,250,"204",2,nil,250,30);
 flags.sobrano=false;
 flags.spray=false;
 flags.gubka=false;  
 flags.comp=true; 
 
  return;end;
  if id >= 653 and id <= 668 --íàæèìàåì íà ìîíåòêó 
  then
    playeffect("33");
          check_mini_game_money_pation(id,fFirstTime);
          fFirstTime=not fFirstTime;
          -- check_mini_game_money_pation(id,fFirstTime);
          -- if fFirstTime==1 then fFirstTime=0 else fFirstTime=1 end;
  end  

  return; end;
  
  
    
    if sender==14 then
    if id>0 then
      addObjectToMouse(id);
    return; end;
  return; end;  
end;
function mini_delete ()

end;