
objectid = 0;
skip = false;
function mini_create ()
    show_help_wnd=true;
    init_mini(true);
    
    create_mini(19,5,30,0,0,0,0,1006,1,10,0,-1);
    StartTimer(88821,0.5)
end;

function SkipActions()
    SetObjectPosition(1006,360-50,257)
    SetObjectPosition(1007,291-52,339)
    SetObjectPosition(1008,389-51,371)
    SetObjectPosition(1009,480-50,311)
    SetObjectPosition(1010,527-50,237)
    finish_mini_game(true);
end;
function Buttons_T(sender,id)
   ButtonTreatment(id,10001,10002,10003,CloseBtnX,CloseBtnY,CloseWidth,CloseHeight,sender,"john_house",true)
   ButtonTreatment(id,10021,10022,10023,HelpBtnX,HelpBtnY,HelpWidth,HelpHeight,sender,"john_house",true,1010,200,200)
   if skip then
    ButtonTreatment(id,10011,10012,10013,SkipBtnX,SkipBtnY,111,31,sender,"john_house",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 == 16 then
    if id == 1023 then
      speciale_action(2,1023,true);
      speciale_action(2,1020,true);
    return; end;
    if id == 1020 then
      AddGlobalFade(7777778,0)
      SetAlfa(7777778,0,1,0.5)        
      StartTimer(88850,0.6);
    return; end;
  return; end;
  
  if sender == 36 then  
    if id == 88821 then
      
    return; end;    
    if id == 8882 then
      for i = 1006,1013,1 do
        Set_Anim_Cur(i,3)
        speciale_action(2,i);
      end;
      speciale_action(2,1019);
      Block_Show_Cur(true);
      speciale_action(2,1023,true);
    return; end;    
    if id == 88811 then
      Block_Show_Cur(false);
      if flags.complect then
        CreatePlashechka(900000,"1010")
      end;
    return; end;
    if id == 88850 then    
        flags.shesternja = true;
        Block_Show_Cur(false);
        clear_satelite_leaf("john_house");       
    return; end;

  return; end;
  
  if sender == 30 then 
      objectid=0
	  s_obj=0
      DeleteResource("john_shester05");
      DeleteResource("john_shester");     
      DeleteResource("john_shester25");      
      DeleteResource("john_shester26");   
--mini_puzzle=false	  
    Block_Show_Cur(false);    
    if flags.shesternja then
        setcurentleaf1("john_house",11,0);
        from4asiki=true;
        WaitRender()
    return;end;
    setcurentleaf("john_house",11,0);     
    DarkScreen(false);     
  return; end;
  
  if sender==37 then
    skip = true;
  return;end;
  
  if sender == 10 then    
    playeffect("gearmech");
	Block_Show_Cur(true)
    HideSkip()
    HideHelp()
    speciale_action(2,2005)
    RotateObject(1012,0,360,1+2,true);
    RotateObject(1006,0,-360,3+2,true);
    RotateObject(1007,0,360,3+2,true);
    RotateObject(1008,0,-360,2+2,true);
    RotateObject(1009,0,360,3+2,true);
    RotateObject(1010,0,-360,2+2,true);
    RotateObject(1013,0,360,4+2,true);
    StartTimer(8882,2);
  return; end;
 
  if sender == 6 then        
    if mousepresed==true then
      RemoveFromMouse(objectid);
	--  EndMoving(objectid)
      if check_mini_game_puzzle(objectid) then
        Set_Anim_Cur(objectid,3)
      end;
      playeffect("gear");
      mousepresed=false;
      objectid=0;
    end
  return; end;    
 
 
  if sender == 1 then
    if id == 1011 then

      if obj.shstr1 ~= nil and attachedID == obj.shstr1.id then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        speciale_action(2,1006,true);
        ActivateObject(1011,false);    
        Set_Anim_Cur(1011,3)

        AddSkipBtn(448,10);
        speciale_action(2,10011)
        flags.complect = true;
        playeffect("gear");
        CreatePlashechka(900000,"287")
      return; end;
      if attachedID~=-1 and ((obj.shstr1~=nil and attachedID ~= obj.shstr1.id) or (obj.shstr1==nil ))  then
        RemObjFromMouse()  
        CreatePlashechka(900000,"1000")
      return;end;          
      CreatePlashechka(900000,"285")
    return; end;
    
    if id >= 1006 and id <= 1010 and objectid==0 then
       if attachedID ~= -1 then
	--   EndMoving(objectid)
        RemObjFromMouse()
      end;      
      if flags.complect then
        add_to_mouse(id);
        mousepresed = true;
        objectid=id;
	--	BeginMoving()
      return; end;
      CreatePlashechka(900000,"285")
    return; end        
  return; end;

end;

function mini_delete ()

end;
function SheetSwitched(nCount)
end;