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

function gameinput (sender,obj_id,attachedID)
 Buttons_T(sender,obj_id)    
CursorTreatment(obj_id,sender,attachedID); 
  if sender == 30 then
        DeleteResource("secret_book1");
        DeleteResource("secret_book5");       
        DeleteResource("secret_bookb1"); 
        DeleteResource("secret_bookb2"); 
        DeleteResource("secret_bookb3"); 
        DeleteResource("s_book");             
    setcurentleaf("secret_room",7,0);    
    if flags.pautina_von and not flags.pautina_loc then
      flags.pautina_loc=true; 
      speciale_action(2,6);
    end;
    Block_Show_Cur(false);
    if flags.secret_book  then
      StopEmiter("secret_book");
      flags.help_secret_book = true;
      if not flags.pautina_loc then
          flags.pautina_loc=true;
          speciale_action(2,6);
      end;
    speciale_action(2,9)
    end;
  return;end;
  
  if sender==16 then
    if obj_id==10 then
       counter=counter+1;
       speciale_action(2,10,true,0.7)
       speciale_action(2,11,true,1)
    return;end;
    if obj_id==11 then
       speciale_action(2,11,true,0.7)
       speciale_action(2,12,true,1)
    return;end;    
    if obj_id==12 then     
       speciale_action(2,12,true,0.7)
       if counter==1 then
          speciale_action(2,13,true,1)
          speciale_action(2,10,true,1)
          playeffect("metla") 
       return;end;
       if counter==2 then
          speciale_action(2,14,true,1)
          speciale_action(2,10,true,1)
          playeffect("metla") 
       return;end;
       if counter==3 then
          speciale_action(2,15,true,1)
          flags.pautina_von = true;
          speciale_action(2,6)
          Set_Anim_Cur(6,2);
         Block_Show_Cur(false)
       return;end;       
    return;end;    

    if obj_id>=22 and obj_id<=24 then
        speciale_action(2,obj_id,true,0.7)
        speciale_action(2,obj_id+1,true,1)    
    return;end;
    
    if obj_id==25 then
        Block_Show_Cur(false)
        flags.book_open=true
        ActivateObject(26,true)
        Set_Anim_Cur(26,4);        
    return;end;
    
  return;end;
  
  
  -- if sender==26 then
    -- if obj_id==77777777 then
        -- DeleteResource("vstavka"); 
        -- StartTimer(8882,1)
        -- Block_Show_Cur(true)    
    -- end;
  -- return;end;
 
  if sender == 1 then
 
    if not flags.pautina_von then
        if obj_id == 13 or obj_id == 14 or obj_id == 15 then
          if obj.metla ~= nil and attachedID == obj.metla.id then
            playeffect("metla") 
            neighbors.comicsk.lock=false;
            LoadLocation("comicsk");
            RemObjFromMouse()
            UnStoreObj(obj.metla.id);
            Set_Anim_Cur(13,3);
            speciale_action(2,10,true,1)
            Block_Show_Cur(true)
          return; end;
          if attachedID~=-1 and ((obj.metla~=nil and attachedID ~= obj.metla.id) or (obj.metla==nil ))  then
            RemObjFromMouse()
            CreatePlashechka(900000,"1000")
          return;end;
          CreatePlashechka(900000,"148")      
        return; end;
    return; end;
    
    
    if flags.pautina_von then
        if obj_id==21 then
            RemObjFromMouse()
            Block_Show_Cur(true)
            Set_Anim_Cur(21,3);    
            speciale_action(2,21,true,0.7)
            speciale_action(2,22,true,1)
        return;end;

    
    if flags.book_open then
        if obj_id==26 then
            RemObjFromMouse()
            -- loadresource("data\\window_items\\vstavka.png","vstavka")    
            -- CreateWindow1(100,100,"2013",77777777,"okno",285,350,"vstavka",281,220,"",nil)
            -- speciale_action(2,26)
      StoreObj(obj.klyk.id,obj_id,"82",285,350,"klyk",323,217)          
            flags.secret_book=true

        return;end;
    return;end;
    return;end;    
  return ;end;
  
  if sender == 100 then
    StartTimer(88811,1);
  return; end;
  if sender==50 then
      StartTimer(8882,1);
      Block_Show_Cur(true);  
  return;end;  
  if sender == 36 then
    if obj_id == 88811 then
      
      if not flags.first_blood then
        flags.first_blood = true;
      return; end;
    return; end;
    if obj_id == 8882 then
      Block_Show_Cur(false);
      flags.secret_book = true;  
      clear_satelite_leaf("secret_room");
    return; end;
  return; end;

   
end
function SheetSwitched(nCount)
end;