function DeleteRes()
DeleteResource("puzzle");
end;

function mini_create ()	
	init_mini(1);
	create_mini(19,6,30,0,0,0,0,1001,1,10,0,-1);
end;



function gameinput (sender,id,attachedID)

MiniInterfaceHandler( sender, id );
if sender==10 then
	mini_start=false;
    RotateObject(1001,0,-360,2,true);----вправо
    RotateObject(1002,0,-360,4,true);----+
	RotateObject(1003,0,360,3,true);
	RotateObject(1004,0,360,2,true);
	RotateObject(1005,0,-360,4,true);----+
	RotateObject(1006,0,-360,5,true);
	RotateObject(1007,0,360,5.2,true);-----------+
	RotateObject(1008,0,360,5,true);
	RotateObject(1009,0,360,5.4,true);
	playeffect("061")
	 StartTimer(8882,2);
	 BlockCursor(true)
return; end;
	
	if sender==26 then
	RemoveWindow(8,2.8,"DestroyMyWindow")	
	end
	if sender == 30 then
	       if mini_start then
			StopAllEffects()
			setstatemenu()
			StopMusic()
			mini_start=false;
			return;end
	return; end;
	
	if sender==777 then
			BlockCursor(false)
			DeleteRenderTarget(2235) 
			-- add_free_leaf("mini1",6,11);
			-- set_satelite_leaf("angar");
			-- UpdateStack()
			-- dofile("./data/6/11/res.lua");
			
			-- dofile("data\\6\\11\\level.lua");
			-- mini_create();		

			leafobj={2234}
			GetRenderTarget(2234,"rendertar");	
			mininame="mini1";
			mininum1=6;
			mininum2=11;
			mininame2="angar";		

			
			flags.start_draw = true;
			flags.start_mini2= true

	end
	
	
  if sender == 36 then  
    if id == 8882 then
	StopRotate(1001);----вправо
    StopRotate(1002);----+
	StopRotate(1003);
	StopRotate(1004);
	StopRotate(1005);----+
	StopRotate(1006);
	StopRotate(1007);-----------+
	StopRotate(1008);
	StopRotate(1009);
		flags.mini1_complete = true;
			leafobj={2235}
		GetRenderTarget(2235,"rendertar1");	
		function rendertar1(tex_name,tex_id)
			FlipVertical(2235);
			SetAlfa(2235,0,1,0,"vasea3353523")
			SetObjectPosition(2235,0,-256);
			LeaveObjectsOnReder("leafobj");
			ClosePlushes();			
		return end
		plushes_were_closed = true;
    return; end;	
   return; end;	
   if sender == 35 then  
   
    if id >= 1001 and  id<= 1006 then		
		setcolor(id,1,0.9,0.25,1)		
    return; end;	
	
   return; end;	 
   if sender == 39 then  
    if id >= 1001 and  id<= 1006 then	
		setcolor(id,1,1,1,1)
    return; end;	
   return; end;	

	if sender == 33 then
			
				CreateWindow(CWX,CWY,"666",3442,nil,100,230);			
		
	end;
		
	if sender == 1 then
	
	-- messagebox(id)
		  MiniInterfaceHandler( sender, id );

	if id >= 1001 and id <= 1006 then
	    add_to_mouse(id);
	    -- add_to_mouse(id+1000);  
	    mousepresed = true;
	    objectid=id;
		-- speciale_action(2,objectid+1000)
		-- StopOnMouseOver(id)
		-- setcolor(id,0.5,0.5,0.5,0.5)
	return; end	
	return; end; 
	
  if sender == 6 then	

	if mousepresed==true then
	playeffect("060")
		speciale_action(4,obj.mini_border.id)
		speciale_action(4,obj.mini_help2.id)
		speciale_action(4,obj.mini_help1.id)
		speciale_action(4,obj.mini_help.id)
	 	speciale_action(4,obj.mini_skip2.id)
		speciale_action(4,obj.mini_skip1.id)
		speciale_action(4,obj.mini_skip.id)
		speciale_action(4,obj.mini_skip_loading.id)
		speciale_action(4,obj.mini_menu2.id)
		speciale_action(4,obj.mini_menu1.id)
		speciale_action(4,obj.mini_menu.id)		
		
		
	  RemoveFromMouse(objectid);
	  x,y= GetObjectPosition(objectid)
	  -- RemoveFromMouse(objectid+1000);
	  check_mini_game_puzzle(objectid);
	  if x >540 and x < 640 and y > 370 and y< 430 and objectid==1001 then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	
	  end;
	  if x >90 and x < 170 and y > 300 and y< 400 and objectid==1002  then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	  end;
	  if x >670 and x < 780 and y > 0 and y< 100  and objectid==1003  then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	  end;
	  if x >260 and x < 330 and y > 340 and y< 410  and objectid==1004  then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	  end;
	  if x >535 and x < 610 and y > 70 and y< 150  and objectid==1005  then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	  end;
	  if x >280 and x < 400 and y > 0 and y< 110 and objectid==1006  then
	  StopOnMouseOver(objectid);
	  setcolor(objectid,1,1,1,1)
	  Set_Cursor(objectid,3);
	  end;
	
	  mousepresed=false;

	 
	end
	
	
	
	
	
  return; end;	
	
end;