


skip_id = 700000000;
fade_id = 800000000;
top_plush_id = 900000000;
bottom_plush_id = 900000001;
plushes_were_closed = false;
plushka=66633666666;
messages=-1;
comicsplush=false;

local plush_speed = 1.2;
local speed = 1.5;

function FadeToTrans(speed)
	addfade(fade_id,1);
	speciale_action(4,fade_id);
	SetAlfa(fade_id,1,0,speed);
end;

function FadeToBlack(speed)
	addfade(fade_id,0);
	speciale_action(4,fade_id);
	SetAlfa(fade_id,0,1,speed);
end;



function DrawSkipButton()
	addactivobjecttogame(skip_id,"skip",860,45,"","");
	set_pixel_check(skip_id,false);
	set_visible_object(skip_id,true);
	speciale_action(4,skip_id);	
	messages=0;
end;

function HideSkipButton()
	set_visible_object(skip_id,false);
end;

function OpenComicsPlush()
addstaticobjecttogame(plushka, "plushka", 0, 0, "");
MoveObjectY(plushka, -500, 0, plush_speed/2);
BlockCursor(true);
comicsplush=false;
messages=0;
ShowMenu(true)
SwitchToSheet("re");
canmenu=true


addstaticobjecttogame(top_plush_id, "plush", 0, 0, "");
	addstaticobjecttogame(bottom_plush_id, "plush", 0, 384, "");	
	plushes_were_closed = false;
	set_visible_object(top_plush_id,false)
	set_visible_object(bottom_plush_id,false)
end

function CloseComicsPlush()

MoveObjectY(plushka, 0, -500, plush_speed/2);
comicsplush=true;
HideSkipButton();
BlockCursor(true);
set_visible_object(CurrMesPers,false);	
speciale_action(2,CurrM);
canmenu=false;

end

function DrawClosedPlushes()
-- playeffect("008")
	-- ShowMenu(false);
	addstaticobjecttogame(top_plush_id, "plush", 0, 0, "");
	addstaticobjecttogame(bottom_plush_id, "plush", 0, 384, "");	
	plushes_were_closed = false;
	set_visible_object(top_plush_id,false)
	set_visible_object(bottom_plush_id,false)
	-- loadresource("data\\arrow.png","arrowww");
	-- NewObj("myarrow",  "arrowww", -1000,-1000, "");
	-- speciale_action(4,obj.myarrow.id)
end;

function DrawOpenedPlushes()
-- playeffect("008")
	ShowMenu(false);
	addstaticobjecttogame(top_plush_id, "plush", 0, -384, "");
	addstaticobjecttogame(bottom_plush_id, "plush", 0, 769, "");
	plushes_were_closed = false;
end;

function OpenPlushesForComics()
-- playeffect("008")
	MoveObjectY(top_plush_id, 0, -384, plush_speed/1000);
	MoveObjectY(bottom_plush_id, 384, 769, plush_speed/1000);	
	
	
	--StartTravel(top_plush_id,1,nil,nil,{"InstantiationOfLine",2,0,0,0,-384, plush_speed,false})
	--StartTravel(bottom_plush_id,1,nil,nil,{"InstantiationOfLine",2,0,384,0,769, plush_speed,false})
end;

function OpenPlushes()
-- playeffect("008")	
	addfade(fade_id,1);
	speciale_action(4,fade_id);
	SetAlfa(fade_id,1,0,speed,"openpl");
	plushes_were_closed=false;
	function openpl()
		gameinput(33)		
	end
end;

function ClosePlushes(mininumber)
-- playeffect("008")
addfade(fade_id,0);
speciale_action(4,fade_id);
SetAlfa(fade_id,0,1,speed,"clsplush");
plushes_were_closed=true

function clsplush()
gameinput(777,mininumber)
end





ShowMenu(false)
end;

function SemiOpenPlushes()
-- playeffect("008")
set_visible_object(top_plush_id,true)
	set_visible_object(bottom_plush_id,true)
	FadeToTrans(speed);
	MoveObjectY(top_plush_id, 0, -256, plush_speed);
	MoveObjectY(bottom_plush_id, 384, 640, plush_speed);	
end;

function SemiClosePlushes()
-- playeffect("008")
set_visible_object(top_plush_id,true)
	set_visible_object(bottom_plush_id,true)
	FadeToTrans(speed/2);
	MoveObjectY(top_plush_id, -384, -256, plush_speed/2);
	MoveObjectY(bottom_plush_id, 769, 640, plush_speed/2);
	
end;

function CloseSemiPlushes()
-- playeffect("008")
set_visible_object(top_plush_id,true)
	set_visible_object(bottom_plush_id,true)
	HideSkipButton();
	speciale_action( 4, top_plush_id );
	speciale_action( 4, bottom_plush_id );
	FadeToBlack(speed);
	MoveObjectY(top_plush_id, -256, 0, plush_speed);
	MoveObjectY(bottom_plush_id, 640, 384, plush_speed);
	plushes_were_closed = true;
end;

function OpenSemiPlushes()
-- playeffect("008")
set_visible_object(top_plush_id,true)
	set_visible_object(bottom_plush_id,true)
	HideSkipButton();
	FadeToTrans(speed/2);
	MoveObjectY(top_plush_id, -256, -384, plush_speed/2);
	MoveObjectY(bottom_plush_id, 640, 769, plush_speed/2);
	plushes_were_closed = true;
end;


function  CloseComPlash()
			flags.plawes= true;
			plushes_were_closed=true
			MoveObjectY(top_plush_id, -256, -384, 1.5/2);
			MoveObjectY(bottom_plush_id, 640, 769, 1.5/2);
			HideSkipButton()
			FadeToBlack(speed);
end