ztm = false;

function SelectRandom()
  if  (obj.med ~= nil  and obj.med.is_stored ) or
      --(obj.pulja ~= nil  and obj.pulja.is_stored ) or
      (obj.vint ~= nil   and obj.vint.is_stored  ) or
      (obj.zakl ~= nil   and obj.zakl.is_stored  ) or
      (obj.photo ~= nil  and obj.photo.is_stored ) or
      (obj.prbira ~= nil and obj.prbira.is_stored) or
      (obj.scrtng ~= nil and obj.scrtng.is_stored) or
      (obj.merdn ~= nil  and obj.merdn.is_stored ) or
      (obj.jhndk ~= nil  and obj.jhndk.is_stored ) 
  then
    selectrandomobject1(1.5,11,false);
  return;end;  
   not_hint=true	 
CreatePlashechka(900000,"10005")
return;end;

function SetCursors()
    ItemsCur={}
    PointingItems={}
    if 
    (not flags.mini_pismo or not flags.lab_rugje or not flags.tatoo or not flags.help_zakluch or not flags.mini_dnk or not flags.john_day_book or not flags.mini_notebook)
    then
        Set_Anim_Cur(11,2);    
    end;
    -- if not flags.tumbal_openM and not flags.tumba_lab then
        -- Set_Anim_Cur(34,2);
    -- end;
    Set_Anim_Cur(30,15);
    -- if flags.tumbal_openM and not flags.tumba_lab then
        -- Set_Anim_Cur(26,2)    
    -- end;    
    if flags.mini_dnk then
        Set_Anim_Cur(14,2);
    end;
    if flags.john_day_book then
      Set_Anim_Cur(16,2);
    end;    
    if flags.lab_rugje then
      Set_Anim_Cur(15,2);
    end;
    if flags.mini_notebook then
      Set_Anim_Cur(17,2);
    end;
    if flags.tatoo then
      Set_Anim_Cur(20,2);
    end;    
    if flags.expert then
        Set_Anim_Cur(19,2);
    end;    
end;

function ActionsJump ()
    -- RenderEmiter(11)
    -- RenderEmiter(34)
    -- StopEmiter("stol_lab")
    -- StopEmiter("SvetMig1")
end;

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

  if sender == 33 then
    Block_Show_Cur(false);
     
    if ztm  then
      ztm = false;
      WaitRender();
    return; end;
  return; end;
  
  if sender == 36 then
    if obj_id == 8885 then      
      WaitRender();
    return; end        
  return; end;
  
  if sender==50 then
  return;end
  
  if sender==16 then
    if obj_id==1211 or obj_id==1212 or obj_id==1213 then
        speciale_action(2,obj_id,true,2.7)  
        speciale_action(2,obj_id+1,true,3)    
    return;end;
    if obj_id==1214 then
        speciale_action(2,1214,true,2.7)  
        speciale_action(2,1211,true,3)    
    return;end;    
  return;end;
  
  if sender == 100 then
    playeffect("fon_room",true);
    SetCursors()
    BlockCursor(false)
    if fromcomics5 then
        fromcomics5=false
        ShowMenu(true)
        CreatePlashechka(900000,"2016") 
        SetCurrentRM("menu");
        ReplaceObjectToWnd1("s","starost4",102,43,93,170,false)
        flags.starost_1 = true;
        SetCurrentRM("main");          
    end;
    if tocomics2 then
        tocomics2=false
        flags.is_comics=true;
        jump("laborator","comics5",2,50)

        IfTableClose()            
    end;
    zahod = true;
    if to_mir_comics then
        to_mir_comics=false
        RemObjFromMouse()
       CreatePlashechka(900000,"249")
     return; end;
    speciale_action(2,1211,true,2.7)  
    speciale_action(2,1212,true,3)
  return; end;
  
  if sender == 1 then

    g_attachedID = attachedID;
  
    if obj_id == 30 then
        playeffect("step_room")
        RemObjFromMouse()         
        jump("laborator","holl",1,0);    
      --  WaitRender()        
      if not flags.hidden5 and flags.help_dulo and flags.help_tatoo and flags.help_zakluch then
         neighbors.veshalka.lock=false;
      end;
      if flags.mini_dnk and flags.mini_opyt_blood and flags.mini_notebook then
         neighbors.garderob.lock=false;
      end;
      if flags.load_comics5 then
        neighbors.comics5.lock=true;
      end;
     
    return; end;
    
    if obj_id == 14 then
      CreatePlashechka(900000,"53")
    return; end;
    
    if obj_id == 15 then
        CreatePlashechka(900000,"40")
    return; end;
    
    if obj_id == 16 then
        CreatePlashechka(900000,"292")
    return; end;
    
    if obj_id == 20 then
    CreatePlashechka(900000,"128")
    return; end;
    
    
    if obj_id == 17 then
    CreatePlashechka(900000,"249")
    return; end;
    
    if obj_id == 19 then
    CreatePlashechka(900000,"3024")
    return; end;
    
    if obj_id == 11 then
      if obj.med ~= nil and attachedID == obj.med.id and not flags.mini_pismo then        
        RemObjFromMouse()
        -- set_visible_object(400000,false)
        -- set_visible_object(obj.med.id,false)
        IsMiniGame=true        
        Set_Sat("mini_pismo",2,11,"laborator")
      return; end;
      if obj.pulja ~= nil and attachedID == obj.pulja.id then
      if flags.lab_rugje then
        RemObjFromMouse()
        Set_Sat("lab_zatvor",2,1,"laborator")
      return; end;    
        RemObjFromMouse()
        CreatePlashechka(900000,"605")    
      return; end;
      if obj.vint ~= nil and attachedID == obj.vint.id then
        RemObjFromMouse()
        Set_Sat("lab_rugje",2,2,"laborator")
      return; end;
      if obj.zakl ~= nil and attachedID == obj.zakl.id then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("mini_expert",2,12,"laborator")
      return; end;
      if obj.photo ~= nil and attachedID == obj.photo.id then
        RemObjFromMouse()
        Set_Sat("tatoo",2,3,"laborator")
      return; end;
       if obj.scrtng ~= nil and attachedID == obj.scrtng.id then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("dnk",2,13,"laborator")
      return; end;
      if obj.merdn ~= nil and attachedID == obj.merdn.id then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("notebook",2,16,"laborator")
      return; end;
      if obj.jhndk ~= nil and attachedID == obj.jhndk.id then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("john_day_book",2,14,"laborator")
      return; end;
      if attachedID~=-1 and(      
      (obj.pismo ~= nil and attachedID ~= obj.pismo.id ) or
      (obj.pulja ~= nil and attachedID ~= obj.pulja.id ) or
      (obj.vint ~= nil  and attachedID ~= obj.vint.id ) or
      (obj.zakl ~= nil and attachedID ~= obj.zakl.id) or
      (obj.photo ~= nil  and attachedID ~= obj.photo.id) or
      (obj.prbira ~= nil and attachedID ~= obj.prbira.id  ) or
      (obj.scrtng ~= nil and attachedID ~= obj.scrtng.id ) or
      (obj.merdn ~= nil  and  attachedID ~= obj.merdn.id) or
      (obj.jhndk ~= nil   and attachedID ~= obj.jhndk.id)
      )
      then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;     
      CreatePlashechka(900000,"205")
    return; end;
    
    -- if obj_id == 34 or obj_id == 26  then
    -- if not flags.tumba_lab then
      -- s_obj=attachedID             
      -- RemObjFromMouse()
      -- Set_Sat("tumba_lab",2,4,"laborator")
    -- return; end;  
    -- return; end;

  return; end;
  
end
function SheetSwitched(nCount)
end;