
n = 1;
x,y = 0;

xx = {};
yy = {};

xx[1] = 346;
xx[2] = 364;
xx[3] = 397;
xx[4] = 361;

yy[1] = 202;
yy[2] = 220;
yy[3] = 247;
yy[4] = 223;

xxx,yyy = 0;

r = 0;

currID = 0;

flag = true;

OpenPlushes();

function mini_create ()
	init_mini(true);
	create_mini(8128);
end;

function gameinput (sender,id,attachedID)
MiniInterfaceHandler( sender, id );

	if sender == 33 then
		CreateWindow(CWX,CWY,666,23232,nil,100,230);	
	return; end;

	if sender == 30 then	
		if mini_start then
			StopAllEffects()
			setstatemenu()
			StopMusic()
			mini_start=false;
		return;end
		flags.mini = false;	
		flags.comics2 = false;			
		LevelComplete()	
	return; end;
	if sender==26 then
	RemoveWindow(8,2.8,"DestroyMyWindow")
	end
	if sender==777 and flags.mini1 then
	clear_satelite_leaf("forge");	
	end	
	
	if sender==10 then	
		flags.mini1 = true;
			mini_start=false;
		speciale_action(4,top_plush_id);
		speciale_action(4,bottom_plush_id);
		ClosePlushes();	
		plushes_were_closed = true;
	return; end;
	
	if sender == 1 then
		-- MiniInterfaceHandler( sender, id );
		if attachedID == -1 then
			if id >= n and id < 5 then
				add_to_mouse(id);
				set_visible_object(id+4,false);
				x,y = GetObjectPosition(id);
				currID = id;
			else
				currID = 0;
			end;
		return;end;
	return; end;
	
	if sender == 6 then
		if currID > 0 and currID < 5 then
			xxx,yyy = GetCursorPos();
			r = math.sqrt((xxx - 495)*(xxx - 495) + (yyy - 352)*(yyy - 352));
			if r < 150 and currID == n then
				RemoveFromMouse(currID);
				SetObjectPosition(currID,xx[n],yy[n]);
				StopOnMouseOver(currID);
				n = n +1;
				currID = 0;
				playeffect("142")
				if n == 5 then
					speciale_action(2,9,true,2);
					AlternateTimer("endgame",2000);
				return;end;
			else			
				RemoveFromMouse(currID);
				SetObjectPosition(currID,x,y);
				set_visible_object(currID+4,true);
				
			end;
		end;
	end;
	
	if sender == 35 and navedenie ==-1  then
		c(navedenie)

		setcolor(id,0.75,0.75,0.75,0.75);
	end;
	
	if sender == 39 then
		setcolor(id,1,1,1,1);
	end;
end;


function endgame()
	finish_mini_game(true);
return;end;