zahod = false;
function SelectRandom()
  if (flags.taburka_razbit and not flags.hidden2) or 
  (not flags.hidden5 
  and obj.photo~=nil and obj.photo.is_collapsed
  and obj.vint~=nil and obj.vint.is_collapsed 
  and obj.zakl~=nil and obj.zakl.is_collapsed )
  then
    selectrandomobject1(1.5,19,false);
  return; end;
  if not flags.mini_code then
    if flags.cod then
        selectrandomobject1(1.5,27,false);
    return;end;
  return;end;
  if flags.taburka_razbit and not flags.taburet  then
    if (obj.gvozd~=nil) and  (obj.gvozd.is_collapsed) and (obj.molot~=nil) and (obj.molot.is_collapsed) then
        if not flags.gvozdi then
        selectrandomobject1(1.5,6); 
        else
        selectrandomobject1(1.5,7); 
        end;
    return;end; 
  return;end;
  if not flags.help_shkaf_holl_open and  flags.mini_pismo  then
    selectrandomobject1(1.5,22);
  return;end;
  if not flags.mini_gourn and flags.help_shkaf_holl_open then
    selectrandomobject1(1.5,36);
  return;end;
   not_hint=true	 
  CreatePlashechka(900000,"10005")
return;end;

function ActionsJump ()

end;

function SetCursors()
    WriteToConsole("Add Cursors \n")
    ItemsCur={}
    PointingItems={}
    if not flags.mini_code then
    Set_Anim_Cur(27,2);
    end;
    Set_Anim_Cur(29,18);
    if flags.comics3 then
        Set_Anim_Cur(28,14)
    end;
    -- if not flags.holl_potolok and flags.taburka_razbit then
          -- Set_Anim_Cur(31,2);
    -- end;
    if not flags.taburet and flags.taburka_razbit  then
      if not flags.gvozdi then
        Set_Anim_Cur(6,2);
      else
        Set_Anim_Cur(7,2);
      end;
    end;    
    if not flags.shkaf_holl and flags.mini_pismo  then
        Set_Anim_Cur(22,4);
    end;    
    if not flags.mini_gourn and flags.shkaf_holl then
        Set_Anim_Cur(36,2);
    end;        
    if (flags.taburka_razbit and not flags.hidden2) or (not flags.hidden5 
  and obj.photo~=nil and obj.photo.is_collapsed
  and obj.vint~=nil and obj.vint.is_collapsed 
  and obj.zakl~=nil and obj.zakl.is_collapsed ) then
      Set_Anim_Cur(19,2);
        if not v_particles then
        if (flags.taburka_razbit and not flags.hidden2) or   (not flags.hidden5 
  and obj.photo~=nil and obj.photo.is_collapsed
  and obj.vint~=nil and obj.vint.is_collapsed 
  and obj.zakl~=nil and obj.zakl.is_collapsed ) then
         v_particles=true
         AddParticleToObject(19,"veshalka",546,470);
         MoveEmiter("veshalka",546,470);
         StartEmiter("veshalka");
        end;         
        end;      
    end;    
    if flags.mini_code then    
      Set_Anim_Cur(26,17);
    end;    
    if not flags.mini_gourn and flags.shkaf_holl then
      Set_Anim_Cur(36,2);
    end;    
end;

function SetParticles()
    AddParticleToObject(32,"SvetMig",869,214);
    MoveEmiter("SvetMig",869,211);
    StartEmiter("SvetMig");
    AddParticleToObject(800,"SvetMig1",455,214);
    MoveEmiter("SvetMig1",455,211);
    StartEmiter("SvetMig1");
    -- if flags.taburka_razbit and not flags.holl_potolok then
      -- ActivateObject(31,true);
      -- AddParticleToObject(31,"luk_john",485,39);
      -- MoveEmiter("luk_john",485,39);
      -- StartEmiter("luk_john");
    -- end;
    if not flags.taburet then
      if not flags.gvozdi then
          AddParticleToObject(6,"taburet",420,585);
          MoveEmiter("taburet",420,585);
          StartEmiter("taburet");
     end;
       if flags.gvozdi then
       ActivateObject(7,true)
       AddParticleToObject(7,"taburet",420,585);
       MoveEmiter("taburet",420,585);
       StartEmiter("taburet"); 
    end;   
    end;
    if not flags.shkaf_holl and flags.mini_pismo then
      ActivateObject(22,true);
      AddParticleToObject(22,"shkaf",220,304);
      MoveEmiter("shkaf",220,304);
      StartEmiter("shkaf");
    end;    
    if not flags.mini_code then
        AddParticleToObject(27,"laborator",976,328);
        MoveEmiter("laborator",976,328);
        StartEmiter("laborator");    
    end;
    if not flags.mini_gourn and flags.shkaf_holl then
      AddParticleToObject(36,"polka",200,200);
      MoveEmiter("polka",200,200);
      StartEmiter("polka");
    end;    
end;

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

  if sender==26 then
    if obj_id==920000 then
    if flags.ShowTutorial then
        nexttutorial=true
      WaitRender()
      end;
    end;
  return;end;

  -- if sender==154 then
    -- if flags.ShowTutorial then
    -- nexttutorial=true
    -- WaitRender()
    -- end;
  -- end;
  
  if sender == 100 then
 -- messagebox(flags.mes_tutorial)
        BlockCursor(false)
         playeffect("fon_room",true);
         SetCursors()
         SetParticles()
    if nexttutorial and flags.ShowTutorial then
      is_tutorial=false
	  vilezmessage=false
      if flags.mes_tutorial<=7 and flags.taburka_razbit then
      --   CreateTutorial("3062",660,470,3)
			flags.mes_tutorial=8;       	  
          CreateTutorial("3062",620,0,1) 
         nexttutorial=false
         
      return;end;  
    end;     
        if fromcomics3 then
            fromcomics3=false
            Set_Anim_Cur(28,14);
            ShowMenu(true);    
            StartTimer(8083,0.2)                
        end;
        if fromcomics4 then
            fromcomics4=false
             Block_Show_Cur(true);
             ShowMenu(true);        
            flags.comics4_text=false
            Block_Show_Cur(false)
            CreatePlashechka(900000,"188")            
        end;        
        if flags.is_hidden_finish then
            flags.is_hidden_finish=false
            Set_Anim_Cur(19,3);
        end;

      if flags.lab and flags.medalyon then
        speciale_action(2,9,true);
        speciale_action(2,31);
        speciale_action(2,101)    
        MoveObjectY(101,0,600,0.2)        
        flags.lab = false;
        flags.taburka_razbit = true;
        AddParticleToObject(4,"pil1",449,600);
        MoveEmiter("pil1",449,600);
        StartEmiter("pil1");     
        AddParticleToObject(6,"taburet",420,585);
        MoveEmiter("taburet",420,585);
        StartEmiter("taburet");
        StartTimer(88810,0.2);
        
        Block_Show_Cur(true)
      return; end;     
    if flags.comics4_text then

    end;
    Block_Show_Cur(false);
    if zahod and not flags.comics3 and not flags.comics4 then
      DarkScreen1(true);
      Block_Show_Cur(false);
      ShowMenu(false);
    return; end;
    if frommini_gourn then
        frommini_gourn=false
        StopEmiter("polka");
        Set_Anim_Cur(36,3);
        speciale_action(2,36);
        speciale_action(2,100);
        Set_Anim_Cur(100,4);
        -- neighbors.comics4.lock=false;
        -- LoadLocation("comics4");           
        ztm = true;
        -- ShowMenu(false);
        -- fromcomics3=true
        -- flags.comics3 = true;    
        -- flags.is_comics=true            
     --   jump("holl","comics3",1,50)
   WriteToConsole("1111111111111")
    Set_Sat1("journal",1,3,"holl")
    end
  return; end;
  
      if sender==33 then     
      WaitRender() 
      Block_Show_Cur(false);
      if zahod then
        zahod = false;
      return; end;
    return;end; 


  if sender == 1 and not vilezmessage then
  
    g_attachedID = attachedID;
  
    -- if obj_id == 31 then
      -- if not flags.lesenka then
        -- if obj.lestn ~= nil and attachedID == obj.lestn.id then
          -- RemObjFromMouse()
          -- UnStoreObj(attachedID);
          -- flags.lesenka = true;
          
          -- playeffect("ladder")
          -- speciale_action(2,50,true);
          -- speciale_action(10,50);
        -- return; end;
        -- CreatePlashechka(900000,"210")
      -- return; end;
      -- if flags.lesenka then
        -- s_obj=attachedID            
        -- RemObjFromMouse()
         -- Set_Sat("holl_potolok",1,3,"holl")
      -- return; end;
    -- return; end;
  
    if obj_id == 19  then 
      --((flags.ShowTutorial and  flags.mes_tutorial==8) or (not flags.ShowTutorial)) and
	if (flags.taburka_razbit and not flags.hidden2) or   (not flags.hidden5 
  and obj.photo~=nil and obj.photo.is_collapsed
  and obj.vint~=nil and obj.vint.is_collapsed 
  and obj.zakl~=nil and obj.zakl.is_collapsed )then
          flags.is_hidden_loc = true;
          RemObjFromMouse()  
          jump("holl","veshalka",1,1);
      return; end;
    return; end;
     
    if obj_id == 28  then
---------------------------------------ÂÐÅÌÅÍÍÎ êîãäà âûêëþ÷åíî!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      -- if not flags.comics4 and flags.tatoo then
        -- RemObjFromMouse()
        -- ShowMenu(false)
        -- flags.is_comics=true    
        -- jump("holl","comics4",4,50)        
        -- flags.comics4 = true;
      -- return; end;    
--------------------------------------------------------------------------------------------
        flags.is_jumping = false;
        
        RemObjFromMouse()    
        jump("holl","street",3,0);
        playeffect("step_street")
    return; end;

    if obj_id == 29 then
       playeffect("step_room")
       RemObjFromMouse() 
       jump("holl","kabinet",0,0);
    return; end;

    if obj_id == 22 then
        Set_Anim_Cur(22,3);
        speciale_action(2,22,true);
        set_visible_object(36,true)
        Set_Anim_Cur(36,2);        
        playeffect("mini_doors")
        flags.help_shkaf_holl_open = true;
        speciale_action(2,21,true);
        Set_Anim_Cur(21,3);
        StopEmiter("shkaf");
        AddParticleToObject(36,"polka",200,200);
        MoveEmiter("polka",200,200);
        StartEmiter("polka");
        flags.shkaf_holl = true;
    return; end;
    if obj_id == 26 then
        RemObjFromMouse()      
        jump("holl","laborator",2,0);
        playeffect("step_room")
    return; end;

    if obj_id == 27 and not flags.mini_code then
        RemObjFromMouse()
        IsMiniGame=true
        Set_Sat("mini_code",1,11,"holl")      
    return; end;
    if obj_id == 36 and not flags.mini_gourn then
      if flags.taburet then
          s_obj=attachedID            
        RemObjFromMouse()
        IsMiniGame=true
        Set_Sat("mini_gourn",1,12,"holl")
      return end;
      if not flags.taburet then
        CreatePlashechka(900000,"210")
      return; end;
    return; end;
    if (obj_id == 6 or (obj_id == 7 and flags.gvozdi)) 
--	and
-- ((flags.ShowTutorial and  flags.mes_tutorial==8) or (not flags.ShowTutorial)) 
	then
        s_obj=attachedID            
        RemObjFromMouse()
        Set_Sat("taburet",1,2,"holl")
    return; end;
  return; end;
  
  if sender == 36 then
    if obj_id==8080 then

    return;end
    if obj_id==8081 then
        CreatePlashechka(900000,"384")
    return;end    
    if obj_id==8083 then
        CreatePlashechka(900000,"402")
    return;end;
    if obj_id == 88810 then
		if flags.ShowTutorial then
			vilezmessage=true
		end;
      -- ActivateObject(31,true);
      -- Set_Anim_Cur(31,2);
      playeffect("ceiling");
      -- AddParticleToObject(31,"luk_john",485,39);
      -- MoveEmiter("luk_john",485,39);
      -- StartEmiter("luk_john");
      speciale_action(2,6,true,3);
      Set_Anim_Cur(6,2);  
      speciale_action(2,7,true);    
      StopEmiter("upalo1");
      AddParticleToObject(50,"pil1",449,600);
      MoveEmiter("pil1",449,600);
      StartEmiter("pil1");  
      padaet=true;
      StartTimer(88811,0.5);
    return; end;
    if obj_id == 88811 then
      AddParticleToObject(19,"veshalka",546,470);
      MoveEmiter("veshalka",546,470);
      StartEmiter("veshalka");     
      Set_Anim_Cur(19,2);      
      StopEmiter("pil1");
      if padaet then
      padaet=false
      Block_Show_Cur(false)
      CreatePlashechka(920000,"1005")
      end;
    return; end;
  return; end;
  

 
  if sender==28 then
    if obj_id==101 then
        speciale_action(2,101)
    return;end;
  return;end;

  
end
function SheetSwitched(nCount)
end;