function Timer(ncount, Param1)
	if not StopSheet then
		AlfingSheet();
		StopSheet=false;
	return;end;
return;end;

function SheetSwitched (ncount)
	StopSheet=true;
return;end;

function SelectRandom()
	if not flags.caseopen then
		selectrandomobject(1.5,9);
	return;end;
	if not flags.minicomplete then
		selectrandomobject(1.5,19);
	return;end;
end;

function MessageFromMenu(nCount,Param1)
if Param1==2000029 then
	ScrollLeft();
return;end;
if Param1==2000030 then
	ScrollRight();
return;end;
showoptons(0);
return;end;

function gameinput (sender,obj_id,attachedID)
	if sender == 2 then
		MessageProc(sender,obj_id);
	return;end;
	if sender==16 then
		if obj_id==503 or obj_id==500 then
		   BlockCursor(false);
		return;end;

		if obj_id==501 then
		   if flags.levelcomplete then
				speciale_action(2,500,true,2);
				speciale_action(4,500);
				BlockCursor(true);
			return;end;
			BlockCursor(false);
		return;end;
		if obj_id==21 then
			BlockCursor(false);
			CreateWindow(100,100,"198");
		return;end;		
	return;end;

	if sender==15 then
		if obj_id==501 then
			BlockCursor(false);
			flags.whole_darkness=false;
			if flags.minitext1 then
				flags.minitext1=true;
				CreateWindow(100,100,"201",1);
				savegame(SaveLevel())
			return;end;
		return;end;			
		if obj_id==503 then
			BlockCursor(false);
			ShowMenu(true);
			AddParticleToObject(37,"water",0,0,0,0);
			AddParticleToObject(35,"probirka_b",0,0,0,0);
			AddParticleToObject(36,"probirka_y",0,0,0,0);
			AddParticleToObject(41,"banka",0,0,0,0);	
			StartEmiter("water");
			MoveEmiter("water",126,391);			
			StartEmiter("probirka_b");
			MoveEmiter("probirka_b",202,283);
			StartEmiter("probirka_y");
			MoveEmiter("probirka_y",365,183);
			StartEmiter("banka");
			MoveEmiter("banka",400,189);
			AddParticleToObject(9,"Bag",0,0);
			StartEmiter("Bag");
			MoveEmiter("Bag",213,474);	
			savegame(SaveLevel())
		return;end;
	return;end;	
	
	if sender==26 then
		if obj_id==1 then
			if flags.minicomplete  then
			    flags.levelcomplete=true;
				ShowMenu(false);
				DarkScreen(true);
			return; end;	
		return; end;	
	return;end;
	if pause_state then
		if sender==1 or sender==6 or sender==14 then
			pause_state=false;
			set_visible_object(11111,false);
		end;	
	return;end;	
	if sender == 1 then --кликнули левой кнопкой мыши на активный объект

		if obj_id==19 then
		if not flags.minicomplete then
			if attachedID==101 or flags.minirun then
				RemoveFromMouse(attachedID);
				DeleteElement("gr",attachedID);	
				Set_Cursor(19,2);
				DarkScreen(true);
				playeffect("mini");
				add_free_leaf("Root","mini",13,11);-- Добавляет чистый лист
				dofile("./data/13/11/res.lua");
				set_satelite_leaf("photolab");
				dofile("data\\13\\11\\level.lua");
				mini_create();
				speciale_action(2,1000,true)
				speciale_action(2,1002,true)
				speciale_action(2,1003,true)
			return; end;	
			if (attachedID ~= 101) and (attachedID>-1) then
				CreateWindow(100,100,"205");
			return; end;				
			if attachedID==-1 then
				CreateWindow(100,100,"211");
			return; end;
		return;end;
		return;end;	
	
		if attachedID==-1 then	
			if obj_id==501 then
				if flags.levelcomplete then
					delete_tree_leaf("Root","photolab")
					delete_tree_leaf("Root","mini");
					setnextlavel(26);
					loadlavel();
				return;end;		
				DarkScreen(false);
				speciale_action(2,503,true);
			return;end;

			if obj_id==9 then
				if not flags.caseopen then
				playeffect("caseopen");
					Set_Cursor(9,3);
					speciale_action(2,9,true);
					speciale_action(2,10,true);
					AddElement("gr",101);
					MoveObjectToTree(101);
				--	Set_Cursor(10,2);
					--AddParticleToObject(10,"./particles/particle2.psi");
					flags.caseopen=true;
					AddParticleToObject(19,"MGlass",0,0);				
					StartEmiter("MGlass");				
					MoveEmiter("MGlass",589,446);					
				return;end;
			return;end;

			if obj_id==10 then
				if not flags.inv then
				    -- Set_Cursor(10,3);
					-- AddElement("gr",101);
					
					-- flags.inv=true;
				return;end;
			return;end;		
			

			



			
			if obj_id==100 then
				CreateWindow(100,100,"208");
			return; end;	
			
			if obj_id==1 then
				CreateWindow(100,100,"209");
			return; end;

			if obj_id==30 then

			CreateWindow(100,100,"210");			
			return; end;			

			if obj_id==2 then
			-- if not flags.minicomplete1 then
				-- AddElement("gr",107);
				-- speciale_action(2,2);		
			-- return; end;
				CreateWindow(100,100,"215");
			return; end;	
			
			if obj_id==8 then
				CreateWindow(100,100,"216");
			return; end;
			
			if obj_id==42 then
				CreateWindow(100,100,"214");
			return; end;

			if obj_id==40 then
				CreateWindow(100,100,"217");
			return; end;			

			if obj_id==5 then
				CreateWindow(100,100,"219");
			return; end;

			if obj_id==28 then
				CreateWindow(100,100,"220");
			return; end;
			
			if obj_id==16 then
				CreateWindow(100,100,"221");
			return; end;			

			if obj_id==22 then
				CreateWindow(100,100,"222");
			return; end;
	
			if obj_id==25 then
				CreateWindow(100,100,"223");
			return; end;
			
			if obj_id==39 then
				CreateWindow(100,100,"201");
			return; end;
			
			if obj_id > 0 and obj_id < 57 then --кликаем на активный объект
				playeffect("collaps");
		        collaps_obj(obj_id,0,0,10,1);
	        return 0; end
			
	return; end;		
	return; end;
-----------------------------------------------На сцене отработали все объекты-------------------------
	if sender==14 then
	StopSheet=true;
		if obj_id>0 then
			addObjectToMouse(obj_id);
		return; end;
	return; end;	
	
	if sender==4 then		

	return; end;	
end
