function OnWarpEnter() 

	SetMarker("cs\\Warp_0014.wp" , 0 , 0) 
	SetMarker("zoomMachine", 4, 0)


	if not OpenMachineW21 then
		AnimationSetToStart("zma1",false)
	elseif OpenMachineW21 then
		AnimationSetToEnd("zma1",false)
	end


	if not CoffreW221 then
		AnimationSetToStart("zya1")
	else
		AnimationSetToEnd("zya1")
	end

	-- manivelle du calculateur
	AnimationSetToStart("zoa1",false)

	balcony_open = true
	AnimationSetToEnd("cxan")
	AnimationSetToEnd("cyan")
	SetMarker("cs\\Warp_0022.wp" , 0 , 0)

--------------------------------------------------------------------------- Puzzle du thème astral
	AnimationSetToStart("zaa1",false)
	AnimationSetToStart("zca1",false)
	AnimationSetToStart("zea1",false)
	AnimationSetToStart("zga1",false)
	AnimationSetToStart("zia1",false)
	AnimationSetToStart("zka1",false)

--DAY3
	if ETAT_DAY == "D3" then 
		AnimationSetToStart("zoan",false)
		SetMarker("zoan",4,0)
		SetMarker("HENRY_CHART",4,0)
	end 

--DAY4
	if ETAT_DAY == "D4" then 
		AnimationSetToStart("zoan",false)
		SetMarker("zoan",4,0)
		SetMarker("HENRY_CHART",4,0)
	end
end


function OnWarpLeave()
end


function OnAnimationFinished(objectName)
	if objectName == "zoan" then
		AnimationSetToStart("zoan",true)
		SetMarker("zoan",4,0)
	end

	if objectName == "cxan" then
		balcony_open = true
		SetMarker("cs\\Warp_0022.wp", 0 , 0) 
	end

end


function OnDialogFinished(dialogName) 
	if dialogName == "Ma2354" then
		ETAT_DAY = "D3" 
		--PlayMovie("Videos/cine03.ogv", "Videos/Cine03.wav")
		ChangeWarp("3D\\cs\\Warp_0019.wp")
	end
end



function OnWarpObjectHit(objectName)

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

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

	if objectName == "3D\\zoomMachine" then 
		ShowDocument("MachineRevolution")
	end


	if objectName=="3D\\HENRY_CHART" then
		if not HENRYCHART_ON_MACHINE_D3 then
			if Selected("A_theme_Henri_Navarre") then
				AnimationSetToStart("zoan",false)
				SetMarker("HENRY_CHART",-1,false)
				HENRYCHART_ON_MACHINE_D3 = true
			elseif not OpenMachineW21 then
				AnimationSetToEnd("zman",false)
				PlaySound("Sounds/SFX/N_FermeturePoele.ogg",1)
				OpenMachineW21 = true
			elseif OpenMachineW21 then
				AnimationSetToStart("zman",false)
				PlaySound("Sounds/SFX/N_FermeturePoele.ogg",1)
				OpenMachineW21 = false
			end
		end
	end

	if objectName == "zoan" then
		PlaySound("Sounds/SFX/N_BruitDeSerrure.ogg",1)
		StartAnimation("zoan",1)
		SetMarker("zoan",-1,0)
	end
end
