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

function gameinput (sender,obj_id,attachedID)   
  Buttons_T(sender,obj_id) 
CursorTreatment(obj_id,sender,attachedID);
  if sender==30 then
      DeleteResource("postbox3");
      DeleteResource("postbox");
      DeleteResource("postbox7");
      DeleteResource("pincet");
    setcurentleaf("mayor_portal",5,0);
    if flags.postbox then
      Set_Anim_Cur(3,3);
      ActivateObject(3,false);
      flags.help_pincet = true;
      StopEmiter("postbox");
      if not flags.open_on_loc5 then
      flags.open_on_loc5=true;
      speciale_action(2,15);
      end;
    end;
    if flags.bulavka_in and not flags.open_on_loc5 then
        flags.open_on_loc5=true;
        speciale_action(2,15);
        speciale_action(10,15);
    end;
    Block_Show_Cur(false);
  return;end;
  
    if sender==50 then
      Block_Show_Cur(true);
      StartTimer(8882,1);    
    return;end;
  
    if sender==1 then
    
    if obj_id == 8 then
      if obj.blvkin ~= nil and attachedID == obj.blvkin.id then
        RemObjFromMouse()        
        UnStoreObj(attachedID);    
        speciale_action(2,6,true,1);
        Block_Show_Cur(true)
        Set_Anim_Cur(8,3);
      return; end;
      if attachedID~=-1 and ((obj.blvkin~=nil and attachedID ~= obj.blvkin.id) or (obj.blvkin==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;    
        CreatePlashechka(900000,"62")
    return; end;
    
    
    if obj_id == obj.pintc.id then
        RemObjFromMouse()
        flags.postbox = true;
        StoreObj(obj.pinct.id,obj_id,"61",335,350,"pincet",291,239)
    return; end;
  return; end;
  
  if sender == 16 then
     if obj_id == 6 then
     -- SetWindowText(counter)
      if counter<3 then
          speciale_action(2,6,true,0.7);
          speciale_action(2,16,true,1);
          counter=counter+1;
      return;end
        playeffect("rbox")
        speciale_action(2,6,true,0.7);
          speciale_action(2,26,true,1);
    return; end; 
  
     if obj_id == 16 then
          speciale_action(2,6,true,1);
          speciale_action(2,16,true,0.7);
          counter=counter+1;
    return; end;     
  
    if obj_id == 26 then
      Block_Show_Cur(false)
      speciale_action(2,26);
      speciale_action(2,8);
      speciale_action(2,5,true);
      speciale_action(2,obj.pintc.id,true);
      Set_Anim_Cur(obj.pintc.id,4);
      flags.bulavka_in=true;
    return; end;
  return; end;
  
  
  if sender == 36 then
    if obj_id == 8882 then
      Block_Show_Cur(false);
      
      clear_satelite_leaf("mayor_portal");
    return; end;
  return; end;   
end
function SheetSwitched(nCount)
end;