local fFirstTime=true;
function mini_create ()
  show_help_wnd=true;
  init_mini(1);
    -- create_mini(8128);
       create_mini(3,120,28+19,163,134,651,4,1);

end;
--function mini_msg_proc (id)
function gameinput (sender,id,attachedID)

  if sender==30 then
    setcurentleaf("gallery",3,0);
      flags.nohints=false;
    if flags.minicomplete27 then  
      collaps_obj(53,0,0,10,0);
      playeffect("20");
      
      DeleteElement("gr",111);
        savegame(SaveLevel());
    return; end;
  return; end;
  
  if sender==10 then
    flags.minicomplete27=true;
    CreateWindow(200,250,"40",1,"m&i",63,107,"aerozol",246,13);
      -- StartTimer(2100,1)
  return; end;

  if sender==37 then
     skipping=true;
  return;end;  
  if sender==26 then

    if id==100 then
  set_visible_object(5001,true)
  end;
    if id==1 then
      clear_satelite_leaf("gallery");
    return; end;
  return; end;
  if sender==100 then
    if not help then
      CreateWindow(200,200,"1",100,"messageinfo",30,35)
      help=true;
    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==6 then
    if helpbtn then
       CreateWindow(200,200,"1",100,"messageinfo",30,35)
          playeffect("11");  
      helpbtn=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 >= 651 and id <= 666 --нажимаем на монетку 
  then

     check_mini_game_money_pation(id,fFirstTime);
    fFirstTime=not fFirstTime;
   playeffect("gorwok"); 
        -- if fFirstTime==1
        -- then
          -- check_mini_game_money_pation(id,1);
          -- fFirstTime=0;
        -- else
          -- check_mini_game_money_pation(id,0);
          -- fFirstTime=1;
        -- end

  end  

    if id==645 then
        playeffect("17");  
      finish_mini_game(false);
      clear_satelite_leaf("gallery");
      DeleteResource("m27_close"       );
      DeleteResource("m27_fon"         );
      DeleteResource("m27_lenta"         );
      DeleteResource("m27_btn"         );
      DeleteResource("m27_0001"       );
      DeleteResource("m27_0005"         );
      DeleteResource("m27_0008"         );
      DeleteResource("m27_0013"         );
      DeleteResource("aerozol"         );
    return;end;

    return;end
end;