function Buttons_T(sender,obj_id)
ButtonTreatment(obj_id,10001,10002,10003,CloseBtnX,CloseBtnY,34,34,sender,"prichal_turmy",false)  
end;

function gameinput (sender,obj_id,attachedID)    
CursorTreatment(obj_id,sender,attachedID); 
Buttons_T(sender,obj_id)

  if sender == 30 then
      DeleteResource("derevo2_2");
      DeleteResource("derevo2_7");     
      DeleteResource("derevo2_8");    
      DeleteResource("derevo");
      DeleteResource("v004");       
    setcurentleaf("prichal_turmy",12,0);    
    Block_Show_Cur(false);
    if flags.derevo2 then      
      StopEmiter("derevo2");
      speciale_action(2,1);
      speciale_action(2,2);
      speciale_action(2,3);
    end;
  return;end;
  
  if sender == 1 then
    if obj_id==62 and counter==0 then
         CreatePlashechka(900000,"359")
    return;end;
    if obj_id == 6 then
      if obj.tesak ~= nil and attachedID == obj.tesak.id then
        counter=counter+1;        
        Set_Anim_Cur(62,4)
        speciale_action(2,62)
        speciale_action(2,10,true,1.5)
        Block_Show_Cur(true);
      return; end;
      if attachedID~=-1 and ((obj.tesak~=nil and attachedID ~= obj.tesak.id) or (obj.tesak==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;          
      CreatePlashechka(900000,"359")
    return; end;
  return ;end;
  
  if sender == 16 then
    if obj_id == 10 then
      speciale_action(2,10,true,1.3);
      playeffect("topor");
      speciale_action(2,11,true,1.5);
    return; end;

    if obj_id == 11 then
      if counter==1 then
          speciale_action(2,11,true,1.3);
          AddParticleToObject(6,"strujka",502,264);
          MoveEmiter("strujka",502,264);
          StartEmiter("strujka");
          StartTimer(5454545,0.5)
      return;end;
      if counter==2 then
        speciale_action(2,11,true,1.3);
        speciale_action(2,14,true,1.5);    
        speciale_action(2,12,true,1.5);
        RemObjFromMouse()
        Set_Anim_Cur(6,3)
        StartEmiter("strujka");
        StartTimer(5454545,0.5)        
        UnStoreObj(obj.tesak.id);          
      return;end;      
      if counter==3 then
        speciale_action(2,11,true,1.3);
        speciale_action(2,12,true,1.5);
        RemObjFromMouse()
        Set_Anim_Cur(6,3)
        StartEmiter("strujka");
        StartTimer(5454545,0.5)        
        UnStoreObj(obj.tesak.id);          
        StartTimer(8882,1.5);
      return;end;           
    return; end;
  return; end;
  
  
  if sender==50 then
 
    clear_satelite_leaf("prichal_turmy");
  return;end
  
  if sender == 36 then
    if obj_id == 8882 then
        
        Block_Show_Cur(false);
         flags.derevo2 = true;
        StoreObj(obj.shnrk.id,nil,"264",285,350,"provod",323,217)
    return; end;
    if obj_id==5454545 then
        StopEmiter("strujka");
        if counter<3 then
            counter=counter+1;    
            speciale_action(2,10,true,1)    
        return;end;
    return;end;
  return; end;
  

end
function SheetSwitched(nCount)
end;