function CallbackForSheetButton(nCount)
  flags.is_hidden_loc = false;
  jump("reshetka","turma",14,0);
end;

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

function SelectRandom()
  idObject=GetRandomObject();
  c=GetActivCount();
  if idObject==-1 then
      if c~=0 then SelectRandom() return;
      else
      return;end;
  end;  
  if obj.tesak~=nil and idObject==obj.tesak.id then selectrandomobjectus(1.5,obj.teska.id); return;end;
  if obj.rubil~=nil and idObject==obj.rubil.id then selectrandomobjectus(1.5,obj.rubli.id); return;end;     
  selectrandomobjectus(1.5,idObject);
return;end;

function ActionsJump ()
    
end;

function gameinput (sender,obj_id,attachedID)
  if sender == 1 then    
    if obj_id > 0 and obj_id < 1000000104 then --кликаем на активный объект
    playeffect("collaps")
      dropped_obj = dropped_obj + 1;
      CollapseObj(obj_id);
      if obj.teska~=nil and obj_id==obj.teska.id then
        RemoveActivObject(obj.tesak.id)
        obj.tesak.is_removed=true
      end
      if obj.rubli~=nil and obj_id==obj.rubli.id then
        RemoveActivObject(obj.rubil.id)
        obj.rubil.is_removed=true
      end              
    return; end
  return ;end;
 
  if sender == 12 then
       if flags.hidden_reshetka then

        if obj.kofij.is_collapsed and obj.fljaj.is_collapsed and obj.teska.is_collapsed and
        obj.kira.is_collapsed and obj.podkv.is_collapsed and obj.gudok.is_collapsed and
        obj.gorob.is_collapsed and obj.kasko.is_collapsed and obj.lampus.is_collapsed and
        obj.kuznc.is_collapsed and obj.chaj.is_collapsed and obj.gurka.is_collapsed and    
        obj.prtvg.is_collapsed and obj.viskr.is_collapsed and obj.fura.is_collapsed
        then
           Block_Show_Cur(true);
            if not hidden_finished then
                StartTimer(8881,1);
            end;
            hidden_finished=true  
        end;
      return; end; 
       if not flags.hidden_reshetka then
        if obj.bomaga.is_collapsed and obj.jad.is_collapsed and obj.zubak.is_collapsed and
        obj.rezka.is_collapsed and obj.obsos.is_collapsed and obj.spat.is_collapsed and
        obj.drygan.is_collapsed and obj.torba.is_collapsed and obj.pacak.is_collapsed and
        obj.tyrlo.is_collapsed and obj.zamoka.is_collapsed and obj.kudana.is_collapsed and    
        obj.malar.is_collapsed and obj.grind.is_collapsed and obj.rubli.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")
      Block_Show_Cur(false);
      if  flags.hidden_reshetka then
        if obj.tesak~=nil then
            StoreObj(obj.tesak.id,nil,"89",335,350,"topor",290,217)
        end;
      return; end;
      if not flags.hidden_reshetka then
        if  obj.rubil~=nil then
            StoreObj(obj.rubil.id,nil,"209",335,360,"rubil",310,232)
        end;
      return; end;
    return; end;
  return; end;
  if sender == 50 then
    WaitRender();
  return; end;
  if sender == 100 then 
  BlockCursor(false)
  if hidden_finished then
    flags.is_hidden_finish=true
    if  flags.hidden_reshetka then
       flags.hidden_reshetka_dwa = true;       
      flags.is_hidden_loc = false;
      neighbors.reshetka.lock=true;
      neighbors.metall.lock=false;
      jump("reshetka","turma",14,0);
      SetDrawSheet("re",false);
      StopEmiter("reshetka");
      dropped_obj = 0;
    return; end;
    if not flags.hidden_reshetka then
    flags.hidden_reshetka = true; 
     
      flags.is_hidden_loc = false;
      neighbors.reshetka.lock=true;
      jump("reshetka","turma",14,0);
      SetDrawSheet("re",false);
      StopEmiter("reshetka");
      dropped_obj = 0;
    return; end;
  return; end;  
  return; end;
end
function SheetSwitched(nCount)
end;