mousepressed = false;
objectid = 0;

skip = false;
function mini_create ()
    show_help_wnd=true;
    init_mini(true);
    
    create_mini(23,200,24,789,614,200,222,798,316,11,3006);
    if fromkoleso then
    fromkoleso=false
    StartTimer(88821,0.5)
    end;
end;

function SkipActions()
    finish_mini_game(true);
end;

function Buttons_T(sender,id)
   ButtonTreatment(id,10001,10002,10003,CloseBtnX,CloseBtnY,CloseWidth,CloseHeight,sender,"parom_main",true)
   ButtonTreatment(id,10021,10022,10023,HelpBtnX,HelpBtnY,HelpWidth,HelpHeight,sender,"parom_main",true,286,200,200)
   if skip then
    ButtonTreatment(id,10011,10012,10013,SkipBtnX,SkipBtnY,111,31,sender,"parom_main",true)
   end;  
end; 

function gameinput (sender,id,attachedID)
 CursorTreatment(id,sender,attachedID); 
Buttons_T(sender,id)
 
  if sender == 100 then
    StartTimer(88811,0.3);    
  return; end;
  

  if sender == 36 then 

    if id == 88811 then
      Block_Show_Cur(false);
      CreatePlashechka(900000,"286")
    return; end;
    if id == 88850 then        
      Block_Show_Cur(false);
      clear_satelite_leaf("parom_main");
      Set_Anim_Cur(3006,3)
      finish_mini_game(true);      
    return; end;
  return; end;
  
  if sender == 30 then 
  mini_puzzle=false
      objectid = 0;
      DeleteResource("ugon_05");
      DeleteResource("ugon1");   
      DeleteResource("ugon_17");      
    setcurentleaf("parom_main",10,0);     
    DarkScreen(false); 
    Block_Show_Cur(false);    
    if flags.ugon_auto then
    CreatePlashechka(900000,"3045")
      speciale_action(2,8);
      speciale_action(2,19);
      speciale_action(2,10);
      Set_Anim_Cur(10,2)
      StopEmiter("ugon_auto");      
      AddParticleToObject(10,"jama",616,258);
      MoveEmiter("jama",616,258);
      StartEmiter("jama");
      AddParticleToObject(obj.napinl.id,"pism",725,325);
      MoveEmiter("pism",725,325);
      StartEmiter("pism");      
     WaitRender()
    end;
  return; end;
  
  if sender==37 then
    skip = true;
  return;end;
  
  if sender == 10 then    
    HideSkip()
    HideHelp()
    flags.ugon_auto = true;
    Block_Show_Cur(true);
    playeffect("miniok")
    StartTimer(88850,0.5);
  return; end;
 
  if sender == 28 then
    if id == 1016 then
      StartTimer(88850,0.5);
    return; end;
  return; end;
  
  if sender == 1 then
       if attachedID ~= -1 then
        RemObjFromMouse()
      end;     
    
    if id >= 3006 and id <= 3016 and objectid == 0 then
      check_mini_game_NO_SKB(0);      
      add_to_mouse(id);
      mousepressed = true;
      objectid = id;
    return; end    
    
  return; end;

  if sender == 6 then        
    if mousepressed then
      RemoveFromMouse(objectid);
      check_mini_game_NO_SKB(2);
      mousepressed=false
      playeffect("yachik")
      x,y = GetObjectPosition(3006);
      if x >= 551 and x <= 5000 then
        Set_Anim_Cur(3006,3)
        finish_mini_game(true);
      end;
      objectid=0
    return;end;  
  return; end;    
 
end;

function mini_delete ()

end;
function SheetSwitched(nCount)
end;