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

function gameinput (sender,obj_id,attachedID)  
Buttons_T(sender,obj_id) 
CursorTreatment(obj_id,sender,attachedID);
    if sender==10 then
        ActivateObject(15,false);
        Set_Anim_Cur(15,3);
        speciale_action(2,9,true);
        speciale_action(2,8,true);
        StopEmiter("postbox");    
        flags.stul_is_ready = true;
        StartEmiter("dverka_lab");      
    return;end;
    
  if sender == 30 then
      DeleteResource("pult");
      DeleteResource("pult_6");
    setcurentleaf("electro",19,0);    
    Block_Show_Cur(false);    
    if flags.pult then
      ActivateObject(15,false);
      Set_Anim_Cur(15,3);
      speciale_action(2,9,true);
      speciale_action(2,8,true);
      StopEmiter("postbox");    
      flags.stul_is_ready = true;
      ActivateObject(1,true)
      Set_Anim_Cur(1,4); 
        AddParticleToObject(1,"el_chair",255,482);
        MoveEmiter("el_chair",255,482);
        StartEmiter("el_chair");      
        AddParticleToObject(910,"el_chair1",327,422);
        MoveEmiter("el_chair1",327,422);
        StartEmiter("el_chair1");    

    end;
  return;end;
  
  if sender == 1 then

    if obj_id == 13 then
      if (obj.iskeyo ~= nil and attachedID == obj.iskeyo.id) or (obj.keytwo ~= nil and attachedID == obj.keytwo.id) or (obj.keytri ~= nil and attachedID == obj.keytri.id) then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Set_Anim_Cur(13,3) 
        speciale_action(2,13);
        speciale_action(2,10,true);
        flags.first_key_complete = true;
         playeffect("keyins")
      return; end;
      if attachedID~=-1 and (((obj.iskeyo~=nil and attachedID ~= obj.iskeyo.id) or (obj.iskeyo==nil )) or 
      ((obj.keytwo~=nil and attachedID ~= obj.keytwo.id) or (obj.keytwo==nil )) or 
      ((obj.keytri~=nil and attachedID ~= obj.keytri.id) or (obj.keytri==nil )))  
      then
            RemObjFromMouse()
            CreatePlashechka(900000,"1000")
      return;end;          
      CreatePlashechka(900000,"485")
    return; end;
    if obj_id == 14 then
      if (obj.iskeyo ~= nil and attachedID == obj.iskeyo.id) or (obj.keytwo ~= nil and attachedID == obj.keytwo.id) or (obj.keytri ~= nil and attachedID == obj.keytri.id) then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Set_Anim_Cur(14,3) 
        speciale_action(2,14);
        speciale_action(2,11,true);
        flags.second_key_complete = true;
        playeffect("keyins")
      return; end;
      if attachedID~=-1 and (((obj.iskeyo~=nil and attachedID ~= obj.iskeyo.id) or (obj.iskeyo==nil )) or 
      ((obj.keytwo~=nil and attachedID ~= obj.keytwo.id) or (obj.keytwo==nil )) or 
      ((obj.keytri~=nil and attachedID ~= obj.keytri.id) or (obj.keytri==nil )) ) 
      then
            RemObjFromMouse()
            CreatePlashechka(900000,"1000")
      return;end;
        CreatePlashechka(900000,"485")      
    return; end;
    if obj_id == 15 then
      if (obj.iskeyo ~= nil and attachedID == obj.iskeyo.id) or (obj.keytwo ~= nil and attachedID == obj.keytwo.id) or (obj.keytri ~= nil and attachedID == obj.keytri.id) then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Set_Anim_Cur(15,3) 
        speciale_action(2,15);
        speciale_action(2,12,true);
        flags.third_key_complete = true;
        playeffect("keyins")
      return; end;
      if attachedID~=-1 and (((obj.iskeyo~=nil and attachedID ~= obj.iskeyo.id) or (obj.iskeyo==nil )) or 
      ((obj.keytwo~=nil and attachedID ~= obj.keytwo.id) or (obj.keytwo==nil )) or 
      ((obj.keytri~=nil and attachedID ~= obj.keytri.id) or (obj.keytri==nil )))  
      then
            RemObjFromMouse()
            CreatePlashechka(900000,"1000")
      return;end;          
      CreatePlashechka(900000,"485")
    return; end;
  return ;end;
  
  if sender == 16 then
    if obj_id == 10 then
      speciale_action(2,7,true);
      speciale_action(2,10,true);
    return; end;
    if obj_id == 7 then
      speciale_action(2,4,true);
      if flags.second_key_complete and flags.third_key_complete then
        Block_Show_Cur(true);
         flags.pult = true;
        StartTimer(8883,1);
      return; end;
    return; end;
    if obj_id == 11 then
      speciale_action(2,8,true);
      speciale_action(2,11,true);
    return; end;
    if obj_id == 8 then
      speciale_action(2,5,true);
      if flags.first_key_complete and flags.third_key_complete then
        Block_Show_Cur(true);
         flags.pult = true;
        StartTimer(8883,1);
      return; end;
    return; end;
    if obj_id == 12 then
      speciale_action(2,9,true);
      speciale_action(2,12,true);
    return; end;
    if obj_id == 9 then
      speciale_action(2,6,true);
      if flags.first_key_complete and flags.second_key_complete then
        Block_Show_Cur(true);
        flags.pult = true;
        StartTimer(8883,1);
      return; end;
    return; end;
  return; end;
 
  
  if sender == 36 then   
    if obj_id == 8883 then
      
      clear_satelite_leaf("electro");
    return; end;
  return; end;
  

end
function SheetSwitched(nCount)
end;