function CallbackForSheetButton(nCount)
  flags.is_hidden_loc = false;
  
  jump("saray","mayor_yard",6,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.pila~=nil and idObject==obj.pila.id then selectrandomobjectus(1.5,obj.pial.id); return;end;
  if obj.fomka~=nil and idObject==obj.fomka.id then selectrandomobjectus(1.5,obj.dergo.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.pial~=nil and obj_id==obj.pial.id then 
        RemoveActivObject(obj.pila.id)
        obj.pila.is_removed=true
      end
      if obj.dergo~=nil and obj_id==obj.dergo.id then
        RemoveActivObject(obj.fomka.id)
        obj.fomka.is_removed=true
      end          
    return; end
  return ;end;
  
  -- if sender == 4 then
    -- Block_Show_Cur(true);
    -- StartTimer(1,1,5);
  -- return; end;
  
  if sender == 12 then
    if  not flags.hidden4 and not flags.hidden_saray_dwa then
        if obj.strem.is_collapsed and obj.grmyn.is_collapsed and obj.kopilo.is_collapsed and
        obj.metelk.is_collapsed and obj.banach.is_collapsed and obj.trosik.is_collapsed and
        obj.samvar.is_collapsed and obj.vedero.is_collapsed and obj.lejka.is_collapsed and
        obj.dergo.is_collapsed and obj.perchi.is_collapsed and obj.korzo.is_collapsed and    
        obj.gmbrgr.is_collapsed and obj.kalesk.is_collapsed and obj.letak.is_collapsed
        then
          Block_Show_Cur(true);
            if not hidden_finished then
                StartTimer(8881,1);
            end;
            hidden_finished=true  
    end;
    return; end;    
    if flags.hidden4 and not  flags.hidden_saray_dwa then
        if obj.zamok.is_collapsed and obj.ushy.is_collapsed and obj.pauk.is_collapsed and
        obj.fonar.is_collapsed and obj.krys.is_collapsed and obj.grib.is_collapsed and
        obj.fball.is_collapsed and obj.key.is_collapsed and obj.head.is_collapsed and
        obj.mask.is_collapsed and obj.mltk.is_collapsed and obj.lion.is_collapsed and    
        obj.stak.is_collapsed and obj.sktch.is_collapsed and obj.pial.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
      Block_Show_Cur(false);
      playeffect("hidenend")
      if flags.hidden4 and not  flags.hidden_saray_dwa then
        if obj.pila~=nil then
            StoreObj(obj.pila.id,nil,"70",335,350,"pila",247,228)
        end
      return; end;
      if not flags.hidden4 then
        if obj.fomka~=nil then
            StoreObj(obj.fomka.id,nil,"118",335,350,"fomka",290,224)
        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.hidden4 and not  flags.hidden_saray_dwa then
      flags.help_pila = true;
      flags.is_hidden_loc = false;
      neighbors.saray.lock=true;
      jump("saray","mayor_yard",6,0);
      SetDrawSheet("re",false);
     -- StopEmiter("saray");
          
flags.hidden_saray_dwa = true;
      dropped_obj = 0;
    return; end;
    if not flags.hidden4 then
      flags.is_hidden_loc = false;
      neighbors.saray.lock=true;

        SetDrawSheet("re",false);      
      jump("saray","mayor_yard",6,0);
flags.hidden4 = true;  
    --  ActivateObject(8,false);
      --StopEmiter("saray");
      
    --  Set_Anim_Cur(8,3);
      dropped_obj = 0;
    return; end;
  return; end;
  return; end;
end
function SheetSwitched(nCount)
end;