
function load()

end

function SetAlfaSheet(TimeAlfa)
	AlternateTimer("Timer",TimeAlfa*1000);
	StopSheet=false;
end;

function setcurentleaf(leafname,level,sublevel)
	--flags.whole_darkness=false
     set_activ_leaf(leafname,level,sublevel);
     dofile("data\\"..level.."\\"..sublevel.."\\level.lua");
     g_leafname=leafname;
     g_level=level;
	-- if not flags.comics then
	
	 ---end;
    -- flags.g_sublevel=sublevel;
end;

function CreateWindow(posx,posy,textid,windowId,image)
	playeffect("window");	
	
	if  image==nil then
		AddWindow(posx,posy,600,335,windowId);
		AddWindowElementText(1000025,320,100,textid);
		AddWindowElementImage(1000024,"message",0,0);
	else
		AddWindow(posx,posy,480,220,windowId);
	-- addtexttogame(1100,50,50,textid); 
	AddWindowElementText(1000025,50,50,textid);
		AddWindowElementImage(1000024,image,0,0);	
	end;
	SetWindowElementTextColor(textid,1,1,1,1);
end;

function DarkScreen(todark)
  StopSheet=true;
  if todark then
	if not flags.whole_darkness then
		BlockCursor(true);
		speciale_action(2,501,true);
		flags.whole_darkness=true
		--SetAlfa(501,0,0.7,1);			
		speciale_action(4,501,true);

		--emitters(false);

		
	 return;end;		
  return;end;
	if flags.whole_darkness then
		BlockCursor(true);
		speciale_action(2,501,true);

		-- SetAlfa(501,0.7,0,1);
		--emitters(true);

			
	end;	

end;

function DarkScreenAlfa(todark)
  if todark then
	if not flags.whole_darkness then
		BlockCursor(true);
		--speciale_action(2,501,true);
		flags.whole_darkness=true
		SetAlfa(501,0,0.7,1);			
		speciale_action(4,501,true);
		--emitters(false);

		
	 return;end;		
  return;end;
	if flags.whole_darkness then
		BlockCursor(true);
		-- speciale_action(2,501,true);
		SetAlfa(501,0.7,0,1);
		--emitters(true);

			
	end;	

end;

function AddSkipBtn(SkipX,SkipY)
	addstaticobjecttogame(5001,"skip",SkipX+10,SkipY,"",8,33,140,33);
	addactivobjecttogame(5000,"skip",SkipX,SkipY,"","",0,0,0,0,193,33);
	--addactivobjecttogame(6000,"buttons",SkipX+190,SkipY,"","",0,0,783,975,34,34);
	speciale_action(10,5001);
	addtexttogame(5100,SkipX+150,SkipY+3,"5000"); 
	setcolor(5100,1,1,1,1,1);
	speciale_action(4,5100);
	StartProgress(5001,30,true)
end;

function HideSkipBtn()
	speciale_action(2,5000)
	speciale_action(2,5001)
	speciale_action(2,5100)
end;

function HideSkipBtnt()
	speciale_action(2,5000,true)
	speciale_action(2,5001,true)
	--speciale_action(2,5100,true)
end;

function AddHints()
	AddButtonToWnd1("hint1","pb",14,55,20,20);
	AddButtonToWnd1("hint2","pb",14,79,20,20);
	AddButtonToWnd1("hint3","pb",14,103,20,20);
	AddButtonToWnd1("hint4","pb",14,127,20,20);
	AddButtonToWnd1("hint5","pb",14,151,20,20);	
	-- hints={}
	-- hints[1]=true;
	-- hints[2]=true;
	-- hints[3]=true;
	-- hints[4]=true;
	-- hints[5]=true;	
end;

function SaveLavel(tabe)
	SaveLevel()
end;

function RestoreSheet(name)

SetCurrentRM("menu");
	addstaticobjecttogame(777777777,"menubuttons",62,679,"",0,0,61,61);
	AddSheet(1001,"gr","green_b",62,679,61,61,"green",156,619,638,101,15,41,15,10,1,55,777777777,9);
		AddLeftScroller("gr",2000029,"leftbtn",nil,nil,nil,122,105,46,90)
		AddRightScroller("gr",2000030,"rightbtn",nil,nil,nil,782,100,46,90)				
SetCurrentRM("main");
end;

function SaveLevel()
	local count=0;

	for key,value in pairs(flags) do
		count=count+1;
	end
return flags,count; end;
			
function LoadLevel(param)
	local c=1;
	local val="";
	c=1;
	
	for key,value in pairs(flags) do
		val=string.char(string.byte (param,c));
		if(val=="t") then
			flags[key]=true;
		else
			flags[key]=false;		
		end;
		c=c+1;
	end
return; end;