<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
	<Frame name="WorldMapUnitTemplate" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="16" y="16"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentIcon" file="Interface\Minimap\PartyRaidBlips" setAllPoints="true" parentKey="icon"/>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				WorldMapUnit_OnLoad(self);
			</OnLoad>
			<OnEnter>
				WorldMapUnit_OnEnter(self, motion);
			</OnEnter>
			<OnLeave>
				WorldMapUnit_OnLeave(self, motion);
			</OnLeave>
			<OnEvent>
				WorldMapUnit_OnEvent(self, event, ...);
			</OnEvent>
			<OnMouseUp>
				WorldMapUnit_OnMouseUp(self, button, "WorldMapRaid", "WorldMapParty");
			</OnMouseUp>
			<OnShow>
				WorldMapUnit_OnShow(self);
			</OnShow>
			<OnHide>
				WorldMapUnit_OnHide(self);
			</OnHide>
		</Scripts>
	</Frame>
	<Frame name="WorldMapPartyUnitTemplate" inherits="WorldMapUnitTemplate" virtual="true">
		<Scripts>
			<OnLoad>
				WorldMapUnit_OnLoad(self);
				self.unit = "party"..self:GetID();
			</OnLoad>
		</Scripts>
	</Frame>
	<Frame name="WorldMapRaidUnitTemplate" inherits="WorldMapUnitTemplate" virtual="true">
		<Scripts>
			<OnLoad>
				WorldMapUnit_OnLoad(self);
				self.unit = "raid"..self:GetID();
			</OnLoad>
		</Scripts>
	</Frame>
	<Frame name="WorldMapFlagTemplate" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="24" y="24"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentTexture" setAllPoints="true"/>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				RaiseFrameLevelByTwo(self);
			</OnLoad>
		</Scripts>
	</Frame>
	<Frame name="WorldMapVehicleTemplate" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="45" y="45"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<HitRectInsets>
			<AbsInset left="10" right="10" top="10" bottom="10"/>
		</HitRectInsets>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentTexture" setAllPoints="true"/>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				RaiseFrameLevelByTwo(self);
			</OnLoad>
			<OnEnter>
				WorldMapUnit_OnEnter(self, motion);
			</OnEnter>
			<OnLeave>
				WorldMapUnit_OnLeave(self, motion);
			</OnLeave>
		</Scripts>
	</Frame>
	<Frame name="WorldMapStoryLineTemplate" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="32" y="32"/>
		</Size>
		<HitRectInsets>
			<AbsInset left="4" right="4" top="0" bottom="0"/>
		</HitRectInsets>
		<Layers>
			<Layer level="ARTWORK">
				<Texture parentKey="Texture" file="Interface\Minimap\ObjectIcons" setAllPoints="true">
					<TexCoords left="0.25" right="0.375" top="0.75" bottom="0.875"/>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnEnter>
				local questLineName, questName, continentID, x, y = C_Questline.GetQuestlineInfoByIndex(self.index);
				if ( questName ) then
					WorldMapTooltip:SetOwner(self, "ANCHOR_LEFT");
					WorldMapTooltip:SetText(questName);
					WorldMapTooltip:AddLine(AVAILABLE_QUEST, 1, 1, 1, true);
					WorldMapTooltip:Show();
				end
			</OnEnter>
			<OnLeave>
				WorldMapTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Frame>
	<Frame name="WorldMapCorpseTemplate" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="16" y="16"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<Layers>
			<Layer level="ARTWORK">
				<Texture file="Interface\Minimap\POIIcons" setAllPoints="true">
					<TexCoords left="0.56640625" right="0.6328125" top="0.001953125" bottom="0.03515625"/>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				RaiseFrameLevel(self);
			</OnLoad>
			<OnEnter>
				local x, y = self:GetCenter();
				local parentX, parentY = self:GetParent():GetCenter();
				if ( x > parentX ) then
					WorldMapTooltip:SetOwner(self, "ANCHOR_LEFT");
				else
					WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT");
				end
				WorldMapTooltip:SetText(CORPSE_RED);
				WorldMapTooltip:Show();
			</OnEnter>
			<OnLeave>
				WorldMapTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Frame>
	<Frame name="WorldMapDebugObjectTemplate" hidden="true" virtual="true">
		<Layers>
			<Layer level="ARTWORK">
				<Texture file="Interface\RaidFrame\UI-RaidFrame-Threat" setAllPoints="true"/>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				self.texture = self:GetRegions();
			</OnLoad>
			<OnEnter>
				WorldMapUnit_OnEnter(self, motion);
			</OnEnter>
			<OnLeave>
				WorldMapUnit_OnLeave(self, motion);
			</OnLeave>
			<OnMouseUp>
				if ( IsModifierKeyDown("CTRL") ) then
					TeleportToDebugObject(self.index);
				else
					WorldMapButton_OnClick(WorldMapButton, button);
				end
			</OnMouseUp>
		</Scripts>
	</Frame>
	<Button name="WorldMapFakeButtonTemplate" virtual="true">
		<Scripts>
			<OnMouseDown function="WorldMapButton_OnMouseDown"/>
			<OnMouseUp function="WorldMapButton_OnMouseUp"/>
			<OnClick function="WorldMapFakeButton_OnClick"/>
		</Scripts>
	</Button>
	<Button name="WorldMapMaelstromButtonTemplate" inherits="WorldMapFakeButtonTemplate" hidden="true" virtual="true">
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
				local zoneName = self:GetText();
				self.zoneID = MAELSTROM_ZONES_ID[zoneName];
				self.minLevel = MAELSTROM_ZONES_LEVELS[zoneName].minLevel;
				self.maxLevel = MAELSTROM_ZONES_LEVELS[zoneName].maxLevel;
				self.petMinLevel = MAELSTROM_ZONES_LEVELS[zoneName].petMinLevel;
				self.petMaxLevel = MAELSTROM_ZONES_LEVELS[zoneName].petMaxLevel;
			</OnLoad>
			<OnEnter>
				WorldMapFrame.maelstromZoneText = GetMapNameByID(self.zoneID);
				WorldMapFrame.minLevel = self.minLevel;
				WorldMapFrame.maxLevel = self.maxLevel;
				WorldMapFrame.petMinLevel = self.petMinLevel;
				WorldMapFrame.petMaxLevel = self.petMaxLevel;
			</OnEnter>
			<OnLeave>
				WorldMapFrame.maelstromZoneText = nil;
				WorldMapFrame.minLevel = nil;
				WorldMapFrame.maxLevel = nil;
				WorldMapFrame.petMinLevel = nil;
				WorldMapFrame.petMaxLevel = nil;
			</OnLeave>
		</Scripts>
	</Button>

	<Button name="EncounterMapButtonTemplate" virtual="true">
		<Size x="50" y="49"/>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="$parentbgImage" parentKey="bgImage">
					<Size x="36" y="36"/>
					<Anchors>
						<Anchor point="CENTER" x="0" y="0"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<NormalTexture file="Interface\EncounterJournal\UI-EncounterJournalTextures">
			<TexCoords left="0.84960938" right="0.97070313" top="0.42871094" bottom="0.48828125"/>
		</NormalTexture>
		<PushedTexture file="Interface\EncounterJournal\UI-EncounterJournalTextures">
			<TexCoords left="0.77734375" right="0.89843750" top="0.26953125" bottom="0.32910156"/>
		</PushedTexture>
		<HighlightTexture file="Interface\EncounterJournal\UI-EncounterJournalTextures">
			<TexCoords left="0.68945313" right="0.81054688" top="0.33300781" bottom="0.39257813"/>
		</HighlightTexture>
		<Scripts>
			<OnEnter>
				if self.tooltipTitle then
					WorldMapTooltip:SetOwner(self, "ANCHOR_LEFT");
					WorldMapTooltip:SetText(self.tooltipTitle,1,1,1);
					WorldMapTooltip:AddLine(self.tooltipText, nil, nil, nil, true);
					WorldMapTooltip:Show();
				end
			</OnEnter>
			<OnLeave>
				WorldMapTooltip:Hide();
			</OnLeave>
			<OnShow>
				self:SetFrameLevel(self:GetParent():GetFrameLevel() + 10);
			</OnShow>
			<OnClick>
				if WORLDMAP_SETTINGS.size ~= WORLDMAP_WINDOWED_SIZE then
					ToggleWorldMap();
				end
			
				if not EncounterJournal or not EncounterJournal:IsShown() then
					ToggleEncounterJournal();
				end
				EncounterJournal_ListInstances();
				EncounterJournal_DisplayInstance(self.instanceID);
				EncounterJournal_DisplayEncounter(self.encounterID);
			</OnClick>
		</Scripts>
	</Button>
</Ui>