function OnWarpEnter() 
	SetMarker("cs\\Warp_0020.wp" , 0 , 0) 

	if Music_Change then
		Music_Change = false
		PlayMusic("Sounds/Musiques/M_Day1.ogg")
	end

	-- bougie chevet
	StartAnimation("cia1")
	-- feu cheminée
	StartAnimationPart("cfa1",60,90,-1,false)


	--ETAT_DAY = "D3" --DEBUG	if not O_rag_019  then
-------------------------------------------------------------------------------------------- Pramètres de début de Part01
--	if not BeenIn_019 then
--		PlayMovie("Videos/Intro.ogv", "Videos/Intro.ogg")
--		ETAT_DAY = "D1" 
--	end
-------------------------------------------------------------------------------------------- 
	if  door_018_open and not Part2 then 
		-- porte armoire
		AnimationSetToEnd("cdan")
	else
		AnimationSetToStart("cdan")
	end 


--DAY 1
	if ETAT_DAY == "D1" then 
		
		StartAnimation("cia1")
		if not O_rag_019  then
			-- serviette
			PutObject("cha1") 
			SetMarker("cha1", 2, 0)
		end
		if not O_shoes_019 then 
			-- chaussons
			PutObject("cga1")
			SetMarker("cga1", 2, 0)
		end
		if door_018_open then 
			if not O_Dress_018 then 
				PutObject("cea1")
			end
		end
	end 

--DAY 2
	if ETAT_DAY == "D2" then 
		if not BeenIn_019_D2 then
		BeenIn_019_D2 = true
		DRESS_MONK = false	
		DRESS_MADELEINE = false
		DRESS_CESAR = true
		 SetDiaryPage(6, "Page6_01")
		-- Musique
		PlayMusic("Sounds/Musiques/M_Day1.ogg")
		
		end
		if not SAVE_00 then
			-- SAVE
			SAVE_00 = true
			SaveGame("0.xml")
		end
	end 

--DAY 3
	if ETAT_DAY == "D3" then 
	    if not DAY_3_INIT then
		DESK_COVER_0017_D3 = true
		GUARD_ON_PASSAGE_0072_D3 = true
		DAY_3_INIT = true
	   end
		if not BeenIn_019_D3 then
		-- Peut être le dialogue début jour 3 ?
--		DrawText("Ma1914", "Ma1914.ogg",0)
		BeenIn_019_D3 = true
		-- Musique
		PlayMusic("Sounds/Musiques/M_Day1.ogg")
		end
		if not SAVE_02 then
			-- SAVE
			SAVE_02 = true
			SaveGame("2.xml")
		end
	end 
	
--DAY4
	if ETAT_DAY == "D4" then 
		CONSTANCE_DOOR_ROOM_OPENED = false
		if not SAVE_05 then
			-- SAVE
			SAVE_05 = true
			SaveGame("5.xml")
		end
	end 

--DAY5
	if ETAT_DAY == "D5" then 
		SmithyDone = false
		if not SAVE_02 then
			-- SAVE
			SAVE_02 = true
			SaveGame("2.xml")
		end
		if not W19D5 then
			W19D5 = true
			ShowDocument("Dimanche")
			PlaySound("Sounds/SFX/J_Allumer.ogg",1)
		end
	end 
end

function OnWarpLeave()
end

function OnWarpObjectHit(objectName)

	if objectName == "3D\\cs\\Warp_0020.wp" then 
		ChangeWarp(objectName)
	end

--DAY1
	if ETAT_DAY == "D1" then 
		if objectName == "cea1" then

		-- chausson
		elseif objectName == "cga1" then
			RemoveObject("cga1")
			SetMarker("cga1", -1, 0)
			AddToBag("A_chaussures")
			O_shoes_019 = true
			if O_Dress_018 then
				Madeleine = true
			end

		-- serviette
		elseif objectName == "cha1" then
			RemoveObject("cha1")
			SetMarker("cha1", -1, 0)
			AddToBag("A_chiffon")
			O_rag_019 = true


		-- serviette
		elseif objectName == "chan" then

		-- porte armoire
		elseif objectName == "cdan" then

		-- feu cheminée
		elseif objectName == "cfa1" then

		-- flamme bougie
		elseif objectName == "cia1" then

		-- flamme bougie
		elseif objectName == "cian" then

		end
	end 

--DAY2
	if ETAT_DAY == "D2" then 

	end 

--DAY3
	if ETAT_DAY == "D3" then 

	end 

--DAY4
	if ETAT_DAY == "D4" then

	end 

--DAY5
	if ETAT_DAY == "D5" then
		CanGoTo050 = true
		CanGoTo051 = true
	end 
end

function OnMovieFinished(name)

    if (name == "Videos/Intro.ogv") then

	-- PARAMETRE DE DEBUT DE PARTIE
	ETAT_DAY = "D1" 
	DRESS_CESAR = false
	DRESS_MONK = false	
	DRESS_MADELEINE = true
	BeenIn_019 = true	
	-- Musique
	PlayMusic("Sounds/Musiques/M_Day1.ogg")
	PutObject("cha1") 
	SetMarker("cha1", 2, 0)
	PutObject("cga1")
	SetMarker("cga1", 2, 0)
	AnimationSetToStart("cdan")
	ShowDocument("Mardi")
	PlaySound("Sounds/SFX/J_Allumer.ogg",1)
		if not O_rag_019  then
			-- serviette
			PutObject("cha1") 
			SetMarker("cha1", 2, 0)
		end
		if not O_shoes_019 then 
			-- chaussons
			PutObject("cga1")
			SetMarker("cga1", 2, 0)
		end
		if door_018_open then 
			if not O_Dress_018 then 
				PutObject("cea1")
			end
		end

    end

	if (name == "Videos/Reve1.ogv") and ETAT_DAY == "D3" then 
		ShowDocument("Jeudi")
		PlaySound("Sounds/SFX/J_Allumer.ogg",1)
	end
	if (name == "Videos/Reve2.ogv") and ETAT_DAY == "D4" then 
		ShowDocument("Samedi")
		PlaySound("Sounds/SFX/J_Allumer.ogg",1)
		if WoundW72 and not FootPrintW72 then ------- Diary Cadavre w72
			SetDiaryPage(10, "Page10_03")
		elseif not WoundW72 and FootPrintW72 then
			SetDiaryPage(10, "Page10_02")
		elseif WoundW72 and FootPrintW72 then
			SetDiaryPage(10, "Page10_04")
		else
			SetDiaryPage(10, "Page10_01")
		end
		SetDiaryPage(11, "Page11")
	end
--	if (name == "Videos/Reve3.ogv") and ETAT_DAY == "D5" then 
--		ShowDocument("Dimanche")
--		PlaySound("Sounds/SFX/J_Allumer.ogg",1)
--	end
end

function OnDocumentClosed(documentId)
	if documentId == "Jeudi" then
		DrawText("Ma1914", "Ma1914.ogg",0) -- La nuit n'a pas été de tout repos, et j'ai peur que la journée qui s'annonce ne me réserve d'autres mauvaises surprises.
		SetDiaryPage(9, "Page9")
	end
	if documentId == "Dimanche" then
		if Tisane then
			DrawText("Ma2766", "Ma2766.ogg",0) -- Enfin une nuit sans mauvais rêves. Voilà qui annonce peut-être une journée moins macabre que les précédentes, à moins que ce ne soit juste la potion.
		else
			DrawText("Ma2767", "Ma2767.ogg",0) -- Encore ce rêve. J'aurais dû prendre une infusion, ça m'aurait peut-être évité une nouvelle nuit macabre.
		end
	end
end

