<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="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>
				WorldMapPOIFrame.allowBlobTooltip = false;
				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>
				WorldMapPOIFrame.allowBlobTooltip = true;
				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>
	<Frame name="WorldMapQuestFrameTemplate" enableMouse="true" virtual="true">
		<Size>
			<AbsDimension x="281" y="100"/>
		</Size>
		<Layers>
			<Layer level="BACKGROUND">
				<FontString name="$parentTitle" inherits="GameFontNormal" justifyH="LEFT"  justifyV="TOP" spacing="2" parentKey="title">
					<Size>
						<AbsDimension x="240" y="0"/>
					</Size>					
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="34" y="-8"/>
							</Offset>						
						</Anchor>
					</Anchors>
					<Color r="1" g="0.82" b="0" />
				</FontString>
				<Texture name="$parentCheck" file="Interface\Buttons\UI-CheckBox-Check" hidden="true" parentKey="check">
					<Size>
						<AbsDimension x="16" y="16"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="TOPRIGHT" />
					</Anchors> 
				</Texture>
				<FontString name="$parentDashes" inherits="GameFontNormal" justifyH="LEFT"  justifyV="BOTTOM" spacing="2" parentKey="dashes">
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
							<Offset>
								<AbsDimension x="0" y="-4"/>
							</Offset>						
						</Anchor>
					</Anchors>
					<Color r="0.8" g="0.8" b="0.8" />				
				</FontString>
				<FontString name="$parentObjectives" inherits="GameFontNormal" justifyH="LEFT"  justifyV="BOTTOM" spacing="2" parentKey="objectives">
					<Size>
						<AbsDimension x="232" y="0"/>
					</Size>					
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
							<Offset>
								<AbsDimension x="8" y="-4"/>
							</Offset>						
						</Anchor>
					</Anchors>
					<Color r="0.8" g="0.8" b="0.8" />
				</FontString>				
			</Layer>
		</Layers>		
		<Scripts>
			<OnEnter function="WorldMapQuestFrame_OnEnter" />
			<OnLeave function="WorldMapQuestFrame_OnLeave" />
			<OnMouseDown function="WorldMapQuestFrame_OnMouseDown" />
			<OnMouseUp function="WorldMapQuestFrame_OnMouseUp" />
		</Scripts>
	</Frame>
	<Button name="WorldMapMaelstromButtonTemplate" 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>
			<OnClick>
				if ( button == "LeftButton" ) then
					SetMapByID(self.zoneID);
				else
					WorldMapZoomOutButton_OnClick();
				end
			</OnClick>
			<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, 1);
					WorldMapTooltip:Show();
					WorldMapTooltip.EJ_using = true;
				end
			</OnEnter>
			<OnLeave>
				WorldMapTooltip:Hide();
				WorldMapTooltip.EJ_using = false;
			</OnLeave>
			<OnShow>
				self:SetFrameLevel(self:GetParent():GetFrameLevel() + 10);
			</OnShow>
			<OnClick>
				if WORLDMAP_SETTINGS.size ~= WORLDMAP_WINDOWED_SIZE then
					ToggleFrame(WorldMapFrame);
				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>