function CallbackForSheetButton(nCount) -- клик по выходу
    flags.is_hidden_loc = false;
  jump("stol","kabinet",0,0);
end;

function LevelComplete()
	if not flags.blockrender then
    Block_Show_Cur(true);
    StartTimer(8881,1);
    hidden_finished=true 
	end;
return; end;

function ActionsJump ()
    
end;

function SelectRandom()
  idObject=GetRandomObject();
  c=GetActivCount();
  if idObject==-1 then
      if c~=0 then SelectRandom() return;
      else
      return;end;
  end;
  if obj.sovok~=nil and  idObject==obj.sovok.id then selectrandomobjectus(1.5,obj.kyela.id); return;end;
  if obj.gvozd~=nil and  idObject==obj.gvozd.id then selectrandomobjectus(1.5,obj.gvodz.id); return;end;  
  selectrandomobjectus(1.5,idObject);
return;end;



function gameinput (sender,obj_id,attachedID)
  if sender == 1 then 

    g_attachedID = attachedID;
  
    if obj_id > 0 and obj_id < 1000000104 then --кликаем на активный объект
      playeffect("collaps")
      dropped_obj = dropped_obj + 1;
      CollapseObj(obj_id);
      if obj.kyela~=nil and obj_id==obj.kyela.id then
        obj.sovok.is_removed=true
        RemoveActivObject(obj.sovok.id)
      end
      if obj.gvodz~=nil and obj_id==obj.gvodz.id then
        obj.gvozd.is_removed=true
        RemoveActivObject(obj.gvozd.id)
      end    
    return; end
  return ;end;
  
  -- if sender == 4 then
    -- StartTimer(1,1.5);
    -- Block_Show_Cur(true);
  -- return; end;
  
  if sender == 12 then
       if not flags.hidden then

        if obj.gvodz.is_collapsed and obj.kasset.is_collapsed and obj.trubka.is_collapsed and
        obj.vizit.is_collapsed and obj.zazhi.is_collapsed and obj.lampa.is_collapsed and
        obj.chetki.is_collapsed and obj.ochki.is_collapsed and obj.mashin.is_collapsed and
        obj.roller.is_collapsed and obj.galst1.is_collapsed and obj.klej.is_collapsed and    
        obj.nogn.is_collapsed and obj.kubik.is_collapsed and obj.karta.is_collapsed
        then

               Block_Show_Cur(true);
            if not hidden_finished then
                StartTimer(8881,1);
            end;    
            hidden_finished=true  
        end;
      return; end; 
       if flags.hidden then
        if obj.logst.is_collapsed and obj.nvzmk.is_collapsed and obj.pecha.is_collapsed and
        obj.shlap.is_collapsed and obj.kyela.is_collapsed and obj.choco.is_collapsed and
        obj.chashk.is_collapsed and obj.flower.is_collapsed and obj.fonrk.is_collapsed and
        obj.koshe.is_collapsed and obj.telef.is_collapsed and obj.budil.is_collapsed and    
        obj.milk.is_collapsed and obj.diktf.is_collapsed and obj.veer1.is_collapsed
        then
               Block_Show_Cur(true);
            if not hidden_finished then
                StartTimer(8881,1);
            end;
            hidden_finished=true  
        end;
      return; end;       
  return; end;
  
  if sender == 36 then
    if obj_id == 8881 then
      playeffect("hidenend")
      if not flags.hidden then       
        Block_Show_Cur(false);
        if obj.gvozd~=nil then
        StoreObj(obj.gvozd.id,nil,"60",335,350,"gvozd",280,220)
        end
      return; end;
      if flags.hidden then
           Block_Show_Cur(false);
        if obj.sovok~=nil then
            StoreObj(obj.sovok.id,nil,"180",335,350,"sovok",332,260)
        end;
      return; end;
    return; end;

    if obj_id == 555 then      
      Block_Show_Cur(false);
    return; end
  return; end;
  
  if sender == 50 then   
    
    WaitRender();
  return; end;
  
  if sender == 100 then 
  BlockCursor(false)
  if hidden_finished then
    
    if flags.hidden then
    --  StoreObj(obj.keyla.id);
      flags.hidden7 = true;
      flags.help_stol_kabinet_dva = true;
    end;
    if not flags.hidden then
     -- StoreObj(obj.gvozd.id);
      WriteToConsole("HIDDEN FINISHED \n")
      flags.hidden = true;
    end;    
    flags.is_hidden_loc = false;
    flags.is_hidden_finish=true
    neighbors.stol.lock=true;  
    jump("stol","kabinet",0,0);    
    flags.help_stol_kabinet = true;
    SetDrawSheet("re",false);

    dropped_obj = 0;
  return; end;
  return; end;
end
function SheetSwitched(nCount)
end;