function OnWarpEnter()
	SetMarker("Memphis\\Warp_0004.wp",0,0)
	
	StartAnimationPart("bfs1",30,60,-1,true)
	StartAnimationPart("c1s1",0,1,-1,true)
	StartAnimationPart("l1s1",70,90,-1,true)
	StartAnimationPart("l2s1",70,90,-1,true)
	StartAnimationPart("l3s1",70,90,-1,true)
	StartAnimationPart("l4s1",70,90,-1,true)
	AnimationSetToStart("pos1")


	StartAnimation("gas1",-1)

	
	if not O_key_me_007 then
			
		SetMarker("kes1",2,0)
		PutObject("kes1")
	end

	if not CabinetOpen_me_009 then
		AnimationSetToStart("pos1")
	else
		AnimationSetToEnd("pos1")
		if not UsedKnife_me_009 then
			AnimationSetToStart("pis1")
		else
			AnimationSetToEnd("pis1")
			if not O_scorp_me_009 then
				PutObject("scs1")
			end
		end
	end
	
	AnimationSetToStart("cks1")
	
	if Puzzle_me_009 and  PerfumeGiven_me_009 and  O_frag_me_017 then
		StartAnimationPart("KHS1",0,30,-1,true)
		SetMarker("KHS1",4,0)
	elseif not BeenIn_me_009 then
		StartAnimationPart("KHS2",0,30,-1,true)

	else
		StartAnimationPart("KHS2",30,60,-1,true)

	end
	
	
end

function OnWarpLeave()
end

function OnDialogFinished(dialogName)
	if dialogName=="KHAE0927" then
		SetMarker("KHS1",4,0)
		BeenIn_Ptah_me=true
	end
	if dialogName=="KHAE0920" then
		SetMarker("KHS1",4,0)
		FinishCH3_me=true
	end
	if dialogName=="KHAE0571" or dialogName=="KHAE1110" or dialogName=="KHAE1109" or dialogName=="KHAE1139" or dialogName=="KHAE1140" or dialogName=="KHAE1141" or dialogName=="KHAE1108" or dialogName=="KHAE1107" or dialogName=="KHAE1122" or dialogName=="" then
		SetMarker("KHS1",4,0)
	end
	
	if dialogName=="KHAE1116" 
	or dialogName=="KHAE1118" 
	or dialogName=="KHAE1120" 
	or dialogName=="KHAE1122" 
	or dialogName=="KHAE1104" 
	or dialogName=="KHAE1107" 
	or dialogName=="KHAE0927"
	or dialogName=="KHAE0571"  
	or dialogName=="KHAE0916" 
	or dialogName=="KHAE0918" 
	or dialogName=="KHAE0920" 
	then
		StartAnimationPart("KHS1",0,30,-1,true)
	end

	if dialogName=="MAIA0917" 
	or dialogName=="MAIA0919" 
	or dialogName=="MAIA1117"  
	or dialogName=="MAIA1119"  
	or dialogName=="MAIA1121"  
	then
		StartAnimationPart("KHS1",30,60,-1,true)
	end	
	
	if dialogName=="KHAE1110" and FinishCH6_me then
		PlayMovie("Videos/GC_C11_Montage.ogv", "Videos/cine11.ogg")
		CoupeSaleOK = true
		activation_du_save = true
	end
end

function OnMovieFinished(id)
	if not FinishCH6_me then
		ChangeWarp("3D\\Ptah\\Salle\\Warp_0001.wp")
	end
	
	if activation_du_save then
		----------------------------------------------------
		if not SAVE_03 then
			-- SAVE
			SAVE_03 = true
			SaveGame("3.xml")
		end
		-----------------------------------------------------
	end
end

function OnWarpObjectHit(objectName)
	if objectName == "kes1" then

		if not O_key_me_007 then
			AddToBag("Aiguille")
			SetMarker("kes1",-1,0)
			RemoveObject("kes1")
			O_key_me_007=true
		end

------------------------------------------------------------
	elseif objectName == "scs1" then

------------------------------------------------------------
	elseif objectName == "bfs1" then

------------------------------------------------------------
	elseif objectName == "c1s1" then

------------------------------------------------------------
	elseif objectName == "cks1" then

------------------------------------------------------------
	elseif objectName == "l1s1" then

------------------------------------------------------------
	elseif objectName == "l2s1" then

------------------------------------------------------------
	elseif objectName == "l3s1" then

------------------------------------------------------------
	elseif objectName == "l4s1" then

------------------------------------------------------------
	elseif objectName == "KHS1" then
		LookAt(091,006)
		
		if FinishCH6_me and Selected("Coupe_bronze") then
			CupGiven_me_007=true
			RemoveFromBag()
			if SaltGiven_me_007 then
				SetMarker("KHS1",-1,0)
				DrawText("KHAE1110","KHAE1110.ogg")
			else
				SetMarker("KHS1",-1,0)
				DrawText("KHAE1109","KHAE1109.ogg")
			end

		elseif FinishCH6_me and Selected("J_Couteau_etrange") then
			SetMarker("KHS1",-1,0)
			DrawText("KHAE1139","KHAE1139.ogg")
			
		elseif FinishCH6_me and Selected("J_figurine_cuite") then
			SetMarker("KHS1",-1,0)
			DrawText("KHAE1140","KHAE1140.ogg")

		elseif FinishCH6_me and Selected("J_Pot_onguent") then
			SetMarker("KHS1",-1,0)
			DrawText("KHAE1141","KHAE1141.ogg")

		elseif FinishCH6_me and Selected("J_Sel") then
			SaltGiven_me_007=true
			RemoveFromBag()
			if CupGiven_me_007 then
				SetMarker("KHS1",-1,0)
				DrawText("KHAE1110","KHAE1110.ogg")
			else
				SetMarker("KHS1",-1,0)
				DrawText("KHAE1108","KHAE1108.ogg")
			end	

		elseif CupGiven_me_007 and SaltGiven_me_007 and not FinishCH7_me  then
			SetMarker("KHS1",-1,0)
			StartAnimationPart("KHS1",30,60,-1,true)
			DrawText("KHAE1116","KHAE1116.ogg")
			DrawText("MAIA1117","MAIA1117.ogg")
			DrawText("KHAE1118","KHAE1118.ogg")
			DrawText("MAIA1119","MAIA1119.ogg")
			DrawText("KHAE1120","KHAE1120.ogg")
			DrawText("MAIA1121","MAIA1121.ogg")
			DrawText("KHAE1122","KHAE1122.ogg")
			FinishCH7_me=true
		elseif FinishCH7_me then
			SetMarker("KHS1",-1,0)
			StartAnimationPart("KHS1",30,60,-1,true)
			DrawText("KHAE1122","KHAE1122.ogg")

		elseif FinishCH6_me then
			SetMarker("KHS1",-1,0)
			StartAnimationPart("KHS1",30,60,-1,true)
			DrawText("KHAE1104","KHAE1104.ogg")
			DrawText("MAIA1105","MAIA1105.ogg")
			DrawText("KHAE1106","KHAE1106.ogg")
			DrawText("KHAE1107","KHAE1107.ogg")

		elseif Puzzle_me_009 and  PerfumeGiven_me_009 and  O_frag_me_017 and not BeenIn_Ptah_me then
			if Selected("J_jonc") then
				RemoveFromBag()
				SetMarker("KHS1",-1,0)
				StartAnimationPart("KHS1",30,60,-1,true)
				DrawText("KHAE0927","KHAE0927.ogg")
			else
				SetMarker("KHS1",-1,0)
				StartAnimationPart("KHS1",30,60,-1,true)
				DrawText("KHAE0571","KHAE0571.ogg")
			end

		elseif Puzzle_me_009 and  PerfumeGiven_me_009 and  O_frag_me_017 and BeenIn_Ptah_me then
			LookAt(096,008)
			SetMarker("KHS1",-1,0)
			StartAnimationPart("KHS1",30,60,-1,true)
			DrawText("KHAE0916","KHAE0916.ogg")
			DrawText("MAIA0917","MAIA0917.ogg")
			DrawText("KHAE0918","KHAE0918.ogg")
			DrawText("MAIA0919","MAIA0919.ogg")
			DrawText("KHAE0920","KHAE0920.ogg")
		end
	elseif objectName== "3D\\Memphis\\Warp_0004.wp" then
		ChangeWarp(objectName)
	end
end
