<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">

	<Script file="XPerl_Target.lua"/>

	<Button name="XPerl_TargetTemplate" inherits="SecureUnitButtonTemplate" virtual="true" clampedToScreen="true" frameStrata="LOW" movable="true" parent="UIParent" hidden="true">
		<Size>
			<!-- The size of this frame determines what can be clicked for the menu and moving, hence it is the same size as the name frame. -->
			<AbsDimension x="220" y="60"/>
		</Size>

		<Scripts>
			<OnEnter function="XPerl_Unit_OnEnter"/>
			<OnLeave function="XPerl_Unit_OnLeave"/>
			<OnEvent function="XPerl_Target_OnEvent"/>
			<OnUpdate function="XPerl_Target_OnUpdate"/>
			<OnShow function="XPerl_Unit_UpdatePortrait"/>
			<OnDragStart>
				if (XPerlLocked == 0) then
					self:StartMoving()
				end
			</OnDragStart>
			<OnDragStop>
				self:StopMovingOrSizing()
				XPerl_SavePosition(self)
			</OnDragStop>
			<OnHide>
				if (XPerlDB.target.sound) then
					PlaySound("INTERFACESOUND_LOSTTARGETUNIT")
				end
			</OnHide>
		</Scripts>

		<Frames>
			<!-- Target Name -->

			<Button name="$parentnameFrame" inherits="SecureUnitButtonTemplate">
				<Scripts>
					<OnLoad>
						self:RegisterForClicks("AnyUp")
						self:RegisterForDrag("LeftButton")
						XPerl_RegisterUnitText(getglobal(self:GetName().."text"))
						self:SetScript("OnEnter", function(self) XPerl_Unit_OnEnter(self:GetParent()) end)
						self:SetScript("OnLeave", function(self) XPerl_Unit_OnLeave(self:GetParent()) end)
					</OnLoad>
					<OnDragStart>
						if (XPerlLocked == 0) then
							self:GetParent():StartMoving()
						end
					</OnDragStart>
					<OnDragStop>
						self:GetParent():StopMovingOrSizing()
						XPerl_SavePosition(self:GetParent())
					</OnDragStop>
				</Scripts>
				<Size>
					<AbsDimension x="160" y="24"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT"/>
				</Anchors>
				<Backdrop bgFile="Interface\Addons\XPerl\Images\XPerl_FrameBack" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
					<EdgeSize>
						<AbsValue val="16"/>
					</EdgeSize>
					<TileSize>
						<AbsValue val="32"/>
					</TileSize>
					<BackgroundInsets>
						<AbsInset left="4" right="4" top="4" bottom="4"/>
					</BackgroundInsets>
				</Backdrop>
				<Frames>
					<StatusBar name="$parentcpMeter">
						<Anchors>
							<Anchor point="TOPLEFT">
								<Offset>
									<AbsDimension x="6" y="-6"/>
								</Offset>
							</Anchor>
							<Anchor point="BOTTOMRIGHT">
								<Offset>
									<AbsDimension x="-6" y="6"/>
								</Offset>
							</Anchor>
						</Anchors>
						<BarTexture name="$parentTex" file="Interface\TargetingFrame\UI-StatusBar">
							<TexCoords left=".8" right="1" top=".8" bottom="1"/>
						</BarTexture>
						<BarColor r="0" g="0" b="1" a="0.25"/>
					</StatusBar>
				</Frames>
				<Layers>
					<Layer level="BORDER">
						<!-- Combat Icon -->
						<Texture name="$parentcombatIcon" file="Interface\CharacterFrame\UI-StateIcon" hidden="true">
							<Size>
								<AbsDimension x="32" y="31"/>
							</Size>
							<Anchors>
								<Anchor point="RIGHT"/>
							</Anchors>
							<TexCoords left="0.5" right = "1.0" top="0.0" bottom="0.5"/>
						</Texture>

						<!-- 30 Yard Range Icon, re-incarnated... -->
						<Texture name="$parentrangeIcon" file="Interface\Addons\XPerl\images\XPerl_30Yard" hidden="true">
							<Size>
								<AbsDimension x="48" y="19"/>
							</Size>
							<Anchors>
								<Anchor point="CENTER" relativePoint="TOP">
									<Offset>
										<AbsDimension x="0" y="-2"/>
									</Offset>
								</Anchor>
							</Anchors>
							<TexCoords left="0" right="1" top="0" bottom="0.4" />
						</Texture>
					</Layer>
					<Layer level="OVERLAY">
						<!-- PVP Icon -->
						<Texture name="$parentpvpIcon" file="Interface\TargetingFrame\UI-PVP-FFA" hidden="true">
							<Size>
								<AbsDimension x="40" y="40"/>
							</Size>
							<Anchors>
								<Anchor point="TOPLEFT" relativePoint="TOPLEFT">
									<Offset>
										<AbsDimension x="-5" y="0"/>
									</Offset>
								</Anchor>
							</Anchors>
						</Texture>

						<!-- Warning Icon -->
						<Texture name="$parentwarningIcon" file="Interface\Minimap\Ping\ping6" alphaMode="ADD" hidden="true">
							<Size>
								<AbsDimension x="32" y="31"/>
							</Size>
							<Anchors>
								<Anchor point="TOP" relativePoint="TOP">
									<Offset>
										<AbsDimension x="0" y="2"/>
									</Offset>
								</Anchor>
							</Anchors>
						</Texture>

						<!-- Raid Target Icon -->
						<Texture name="$parentraidIcon" file="Interface\TargetingFrame\UI-RaidTargetingIcons" hidden="true">
							<Size>
								<AbsDimension x="32" y="32"/>
							</Size>
							<Anchors>
								<Anchor point="CENTER"/>
							</Anchors>
							<TexCoords left="0" right="0.25" top="0" bottom="0.25" />
						</Texture>

						<!-- Leader Icon -->
						<Texture name="$parentleaderIcon" file="Interface\GroupFrame\UI-Group-LeaderIcon" hidden="true">
							<Size>
								<AbsDimension x="16" y="16"/>
							</Size>
							<Anchors>
								<Anchor point="TOP">
									<Offset>
										<AbsDimension x="0" y="7"/>
									</Offset>
								</Anchor>
							</Anchors>
						</Texture>

						<!-- Master Loot Icon -->
						<Texture name="$parentmasterIcon" file="Interface\GroupFrame\UI-Group-MasterLooter" hidden="true">
							<Size>
								<AbsDimension x="16" y="16"/>
							</Size>
							<Anchors>
								<Anchor point="TOP">
									<Offset>
										<AbsDimension x="20" y="7"/>
									</Offset>
								</Anchor>
							</Anchors>
						</Texture>

						<FontString name="$parenttext" inherits="GameFontNormal">
							<Anchors>
								<Anchor point="TOPLEFT"/>
								<Anchor point="BOTTOMRIGHT">
									<Offset>
										<AbsDimension x="0" y="1"/>
									</Offset>
								</Anchor>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
			</Button>

			<!-- Target Portrait -->
			<Frame name="$parentportraitFrame" inherits="XPerl_Portrait_Template">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentnameFrame">
						<Offset>
							<AbsDimension x="-2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Frame>

			<!--Level Frame-->
			<Frame name="$parentlevelFrame" inherits="XPerl_BorderStyleTemplate">
				<Size>
					<AbsDimension x="27" y="22"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentportraitFrame">
						<Offset>
							<AbsDimension x="-2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parenttext" inherits="GameFontNormalSmall" text="0" setAllPoints="true"/>
						<Texture name="$parentskull" file="Interface\TargetingFrame\UI-TargetingFrame-Skull" hidden="true">
							<Size>
								<AbsDimension x="16" y="16"/>
							</Size>
							<Anchors>
								<Anchor point="CENTER"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<Scripts>
					<OnLoad>
						XPerl_RegisterUnitText(getglobal(self:GetName().."text"))
					</OnLoad>
				</Scripts>
			</Frame>

			<Frame name="$parentcreatureTypeFrame" inherits="XPerl_BorderStyleTemplate">
				<Size>
					<AbsDimension x="68" y="22"/>
				</Size>
				<Anchors>
					<Anchor point="TOPRIGHT" relativePoint="BOTTOMRIGHT" relativeTo="$parentportraitFrame">
						<Offset>
							<AbsDimension x="0" y="2"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parenttext" inherits="GameFontNormalSmall" text="none" setAllPoints="true"/>
					</Layer>
				</Layers>
			</Frame>

			<Frame name="$parenttypeFramePlayer">
				<Size>
					<AbsDimension x="20" y="20"/>
				</Size>
				<Anchors>
					<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeTo="$parentportraitFrame">
						<Offset>
							<AbsDimension x="2" y="2"/>
						</Offset>
					</Anchor>
				</Anchors>

				<Layers>
					<Layer level="ARTWORK">
						<Texture name="$parentclassTexture" file="Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes" setAllPoints="true"/>
					</Layer>
				</Layers>
			</Frame>
			<Frame name="$parentbossFrame" inherits="XPerl_BorderStyleTemplate">
				<Size>
					<AbsDimension x="38" y="20"/>
				</Size>
				<Anchors>
					<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeTo="$parentportraitFrame">
						<Offset>
							<AbsDimension x="-2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parenttext" inherits="GameFontNormalSmall" text="Elite">
							<Anchors>
								<Anchor point="TOPLEFT"/>
								<Anchor point="BOTTOMRIGHT">
									<Offset>
										<AbsDimension x="0" y="1"/>
									</Offset>
								</Anchor>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
			</Frame>
			<Frame name="$parentcpFrame" inherits="XPerl_BorderStyleTemplate" hidden="true">
				<Size>
					<AbsDimension x="26" y="22"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentlevelFrame">
						<Offset>
							<AbsDimension x="-4" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parenttext" inherits="GameFontNormalSmall" text="0" setAllPoints="true"/>
					</Layer>
				</Layers>
			</Frame>

			<!-- Target Stats -->
			<Frame name="$parentstatsFrame" inherits="XPerl_Stats_Template">
				<Anchors>
					<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parentnameFrame">
						<Offset>
							<AbsDimension x="0" y="2"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<Texture name="$parentfocusTarget" file="Interface\Addons\XPerl\images\XPerl_Highlight" alphaMode="ADD" setAllPoints="true" hidden="true">
							<TexCoords left="0" right="1" top="0.5" bottom="1"/>
						</Texture>
					</Layer>
				</Layers>
			</Frame>

			<Frame name="$parenteliteFrame" hidden="true">
				<Size><AbsDimension x="128" y="128"/></Size>
				<Anchors>
					<Anchor point="RIGHT">
						<Offset>
							<AbsDimension x="40" y="-5"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="BORDER">
						<Texture name="$parenttex" file="Interface\Addons\XPerl\Images\XPerl_Elite" setAllPoints="true"/>
					</Layer>
					<Layer level="OVERLAY">
						<!-- Raid Target Icon -->
						<Texture name="$parentraidIcon" file="Interface\TargetingFrame\UI-RaidTargetingIcons" hidden="true">
							<Size>
								<AbsDimension x="16" y="16"/>
							</Size>
							<Anchors>
								<Anchor point="TOPLEFT">
									<Offset>
										<AbsDimension x="15" y="-25"/>
									</Offset>
								</Anchor>
							</Anchors>
							<TexCoords left="0" right="0.25" top="0" bottom="0.25" />
						</Texture>
					</Layer>
				</Layers>
			</Frame>

			<Frame name="$parenthighlight" inherits="XPerl_HighlightTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentnameFrame"/>
					<Anchor point="BOTTOMRIGHT" relativeTo="$parentportraitFrame">
						<Offset>
							<AbsDimension x="26" y="-1"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Frame>

			<Frame name="$parenthitIndicator" frameStrata="HIGH">
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parenttext" inherits="NumberFontNormalHuge" hidden="true" text="Error!">
							<FontHeight>
								<AbsValue val="30"/>
							</FontHeight>
							<Color r="1.0" g="1.0" b="1.0"/>
						</FontString>
					</Layer>
				</Layers>
			</Frame>

			<!-- Buffs Frame -->
			<Frame name="$parentbuffFrame">
				<Size>
					<AbsDimension x="100" y="50"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentstatsFrame">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Frame>

			<!-- Buffs Frame -->
			<Frame name="$parentdebuffFrame">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentbuffFrame"/>
					<Anchor point="BOTTOMRIGHT" relativeTo="$parentbuffFrame"/>
				</Anchors>
			</Frame>
		</Frames>
	</Button>

	<Button name="XPerl_Target" inherits="XPerl_TargetTemplate">
		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset>
					<AbsDimension x="271" y="-12"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				XPerl_Target_OnLoad(self, "target")
			</OnLoad>
		</Scripts>
	</Button>

	<Button name="XPerl_Focus" inherits="XPerl_TargetTemplate">
		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset>
					<AbsDimension x="271" y="-200"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				XPerl_Target_OnLoad(self, "focus")
			</OnLoad>
		</Scripts>
		<Frames>
			<Frame>
				<Size>
					<AbsDimension x="28" y="14"/>
				</Size>
				<Anchors>
					<Anchor point="LEFT" relativeTo="XPerl_FocusnameFrame"/>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<Texture name="$parent_FocusIcon" file="Interface\Addons\XPerl\Images\XPerl_EyeBall"/>
					</Layer>
				</Layers>
			</Frame>
		</Frames>
	</Button>
</Ui>
