<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="Blizzard_ArenaUI.lua"/>
	<StatusBar name="ArenaCastingBarFrameTemplate" drawLayer="BORDER" virtual="true" hidden="true">
		<Size x="80" y="14"/>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture setAllPoints="true">
					<Color r="0" g="0" b="0" a="0.5"/>
				</Texture>		
			</Layer>
			<Layer level="ARTWORK">
				<Texture name="$parentBorderShield" file="Interface\CastingBar\UI-CastingBar-Arena-Shield" hidden="true">
					<Size x="42" y="42"/>
					<Anchors>
						<Anchor point="LEFT" x="-25" y="0"/>
					</Anchors>
				</Texture>
				<FontString name="$parentText" inherits="GameFontHighlightSmall">
					<Size x="80" y="16"/>
					<Anchors>
						<Anchor point="TOP" x="0" y="2"/>
					</Anchors>
				</FontString>
				<Texture name="$parentIcon" hidden="true">
					<Size x="16" y="16"/>
					<Anchors>
						<Anchor point="RIGHT" relativeTo="$parent" relativePoint="LEFT" x="-5" y="0"/>
					</Anchors>
				</Texture>
			</Layer>
			<Layer level="OVERLAY">
				<Texture name="$parentSpark" file="Interface\CastingBar\UI-CastingBar-Spark" alphaMode="ADD">
					<Size x="32" y="32"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
				<Texture name="$parentFlash" alphaMode="ADD"> 
				<!-- this needs to be here so the generic unit frame code will work right --> 
					<Size x="256" y="64"/>
					<Anchors>
						<Anchor point="TOP" x="0" y="28"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				CastingBarFrame_OnLoad(self, "arena"..self:GetParent():GetID(), false, true);
				_G[self:GetName().."Icon"]:Show();
			</OnLoad>
			<OnEvent>
				CastingBarFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnUpdate>
				CastingBarFrame_OnUpdate(self, elapsed);
			</OnUpdate>
			<OnShow>
				CastingBarFrame_OnShow(self);
			</OnShow>
		</Scripts>
		<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
		<BarColor r="1.0" g="0.7" b="0.0"/>
	</StatusBar>
	<Button name="ArenaEnemyPetFrameTemplate" frameStrata="LOW" toplevel="true" inherits="SecureUnitButtonTemplate" virtual="true" hidden="true">
		<Size x="77" y="31"/>
		<Anchors>
			<Anchor point="TOPLEFT" x="15" y="-25"/>
		</Anchors>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentFlash" file="Interface\TargetingFrame\UI-PartyFrame-Flash" hidden="true">
					<Size x="64" y="32"/>
					<Anchors>
						<Anchor point="TOPRIGHT" x="1" y="1"/>
					</Anchors>
				</Texture>
				<Texture name="$parentPortrait">
					<Size x="22" y="22"/>
					<Anchors>
						<Anchor point="TOPRIGHT" x="-3" y="-3"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Frame setAllPoints="true">
				<Frames>
					<Frame setAllPoints="true">
						<Layers>
							<Layer level="ARTWORK">
								<Texture name="$parentTexture" file="Interface\TargetingFrame\UI-PartyFrame">
									<Size x="77" y="39"/>
									<Anchors>
										<Anchor point="TOPLEFT" x="0" y="9"/>
									</Anchors>
									<TexCoords left="1.0" right="0" top="1.0" bottom="0.0"/>
								</Texture>
								<FontString name="$parentName" inherits="GameFontNormalSmall" parentKey="name">
									<Anchors>
										<Anchor point="BOTTOMRIGHT" x="-25" y="21"/>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
					</Frame>
				</Frames>
			</Frame>
			<StatusBar name="$parentHealthBar" inherits="TextStatusBar">
				<Size x="42" y="4"/>
				<Anchors>
					<Anchor point="TOPRIGHT" x="-28" y="-14"/>
				</Anchors>
				<Scripts>
					<OnValueChanged>
						UnitFrameHealthBar_OnValueChanged(self, value);
					</OnValueChanged>
					<OnMouseUp>
						self:GetParent():Click(button);
					</OnMouseUp>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
			</StatusBar>
			<StatusBar name="$parentManaBar" inherits="TextStatusBar">
				<Size x="42" y="4"/>
				<Anchors>
					<Anchor point="TOPRIGHT" x="-28" y="-20"/>
				</Anchors>
				<Scripts>
					<OnMouseUp>
						self:GetParent():Click(button);
					</OnMouseUp>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
			</StatusBar>
			<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true" parentKey="DropDown">
				<Size x="10" y="10"/>
				<Anchors>
					<Anchor point="TOP" x="-20" y="-10"/>
				</Anchors>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				ArenaEnemyPetFrame_OnLoad(self);
			</OnLoad>
			<OnShow>
				UnitFrame_Update(self);
			</OnShow>
			<OnEvent>
				ArenaEnemyPetFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnEnter>
				UnitFrame_OnEnter(self, motion);
			</OnEnter>
			<OnLeave>
				UnitFrame_OnLeave(self, motion);
			</OnLeave>
		</Scripts>
	</Button>
	<Button name="ArenaPrepFrameTemplate" frameStrata="LOW" toplevel="true" movable="true" hidden="true" inherits="SecureUnitButtonTemplate" virtual="true">
		<Size x="112" y="32"/>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="$parentClassPortrait" file="Interface\TargetingFrame\UI-Classes-Circles" parentKey="classPortrait">
					<Size x="30" y="30"/>
					<Anchors>
						<Anchor point="TOPRIGHT" x="-11" y="-4"/>
					</Anchors>
				</Texture>
				<Texture name="$parentBackground">
					<Size x="72" y="17"/>
					<Anchors>
						<Anchor point="TOPLEFT" x="2" y="-10"/>
					</Anchors>
					<Color r="0" g="0" b="0" a="0.5"/>
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true" parentKey="DropDown">
				<Size x="10" y="10"/>
				<Anchors>
					<Anchor point="TOP" x="-20" y="-10"/>
				</Anchors>
			</Frame>
			<Frame setAllPoints="true"> <!-- These silly nested frames make it so the health/mana bars are underneath the frame borders like they're supposed to be-->
				<Frames>
					<Frame setAllPoints="true">
						<Layers>
							<Layer level="BACKGROUND">
								<Texture name="$parentTexture" file="Interface\ArenaEnemyFrame\UI-ArenaTargetingFrame">
									<Size x="102" y="32"/>
									<Anchors>
										<Anchor point="TOPLEFT" x="0" y="-2"/>
									</Anchors>
									<TexCoords left="0.0" right="0.796" top="0.0" bottom="0.5"/>
								</Texture>
								<FontString name="$parentName" inherits="GameFontNormalSmall" justifyH="LEFT" parentKey="name">
									<Anchors>
										<Anchor point="BOTTOMLEFT" x="3" y="24"/>
									</Anchors>
								</FontString>
								<FontString name="$parentHealthBarText" inherits="TextStatusBarText">
									<Anchors>
										<Anchor point="CENTER" x="-20" y="3"/>
									</Anchors>
								</FontString>
								<FontString name="$parentManaBarText" inherits="TextStatusBarText">
									<Anchors>
										<Anchor point="CENTER" x="-20" y="-6"/>
									</Anchors>
								</FontString>
							</Layer>
							<Layer level="BORDER">	
								<Texture name="$parentSpecPortrait" >
									<Size x="22" y="22"/>
									<Anchors>
										<Anchor point="TOPLEFT" relativeTo="$parentClassPortrait" relativePoint="CENTER" x="2" y="2"/>
									</Anchors>
								</Texture>
							</Layer>
							<Layer level="ARTWORK">
								<Texture name="$parentStatus" file="Interface\Buttons\UI-Debuff-Overlays" hidden="true">
									<Size x="36" y="36"/>
									<TexCoords left="0.0" right="0.2734375" top="0.0" bottom="0.5625"/>
								</Texture>
								<Texture name="$parentSpecBorder" file="Interface\Minimap\MiniMap-TrackingBorder">
									<Size x="50" y="50"/>
									<Anchors>
										<Anchor point="TOPLEFT" relativeTo="$parentClassPortrait" relativePoint="CENTER" x="0" y="4"/>
									</Anchors>
								</Texture>
							</Layer>
							<Layer level="OVERLAY">
								<Texture name="$parentDisconnect" file="Interface\CharacterFrame\Disconnect-Icon" hidden="true">
									<Size x="64" y="64"/>
									<Anchors>
										<Anchor point="LEFT" x="-7" y="-1"/>
									</Anchors>
								</Texture>
								<Texture name="$parentPVPIcon" hidden="true">
									<Size x="40" y="40"/>
									<Anchors>
										<Anchor point="LEFT" relativePoint="RIGHT" x="-12" y="-10"/>
									</Anchors>
								</Texture>
							</Layer>
						</Layers>
					</Frame>
				</Frames>
			</Frame>
			<StatusBar name="$parentHealthBar" inherits="TextStatusBar">
				<Size x="70" y="8"/>
				<Anchors>
					<Anchor point="TOPLEFT" x="2" y="-12"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						TextStatusBar_Initialize(self);
						self.textLockable = 1;
						self.cvar = "partyStatusText";
						self.cvarLabel = "STATUS_TEXT_PARTY";
					</OnLoad>
					<OnMouseUp>
						self:GetParent():Click(button);
					</OnMouseUp>
					<OnValueChanged>
						UnitFrameHealthBar_OnValueChanged(self, value);
					</OnValueChanged>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
			</StatusBar>
			<StatusBar name="$parentManaBar" inherits="TextStatusBar">
				<Size x="70" y="8"/>
				<Anchors>
					<Anchor point="TOPLEFT" x="2" y="-20"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						TextStatusBar_Initialize(self);
						self.textLockable = 1;
						self.cvar = "partyStatusText";
						self.cvarLabel = "STATUS_TEXT_PARTY";
					</OnLoad>
					<OnMouseUp>
						self:GetParent():Click(button);
					</OnMouseUp>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
				<BarColor r="0" g="0" b="1.0"/>
			</StatusBar>
			<StatusBar name="$parentCastingBar" inherits="ArenaCastingBarFrameTemplate">
				<Anchors>
					<Anchor point="RIGHT" relativePoint="LEFT" x="-15" y="-3"/>
				</Anchors>
			</StatusBar>
		</Frames>
		<Scripts>
			<OnShow>
				self:SetFrameLevel(2);
			</OnShow>
		</Scripts>
	</Button>
	<Button name="ArenaEnemyFrameTemplate" frameStrata="LOW" toplevel="true" movable="true" hidden="true" inherits="ArenaPrepFrameTemplate" virtual="true">
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="$parentTotalAbsorbBar" inherits="TotalAbsorbBarTemplate"/>
			</Layer>
			<Layer level="ARTWORK" textureSubLevel="1">
				<Texture name="$parentTotalAbsorbBarOverlay" inherits="TotalAbsorbBarOverlayTemplate"/>
			</Layer>
		</Layers>
		<Frames>
			<Frame setAllPoints="true">
				<Frames>
					<Frame setAllPoints="true">
						<Layers>
							<Layer level="BACKGROUND" textureSubLevel="-1">
								<Texture name="$parentMyHealPredictionBar" inherits="MyHealPredictionBarTemplate"/>
								<Texture name="$parentOtherHealPredictionBar" inherits="OtherHealPredictionBarTemplate"/>
								<Texture name="$parentHealAbsorbBar" inherits="HealAbsorbBarTemplate"/>
								<Texture name="$parentHealAbsorbBarLeftShadow" inherits="HealAbsorbBarLeftShadowTemplate"/>
								<Texture name="$parentHealAbsorbBarRightShadow" inherits="HealAbsorbBarRightShadowTemplate"/>
							</Layer>
							<Layer level="OVERLAY" textureSubLevel="1">
								<Texture name="$parentOverAbsorbGlow" inherits="OverAbsorbGlowTemplate"/>
								<Texture name="$parentOverHealAbsorbGlow" inherits="OverHealAbsorbGlowTemplate"/>
							</Layer>
						</Layers>
					</Frame>
				</Frames>
			</Frame>
			<Button name="$parentPetFrame" inherits="ArenaEnemyPetFrameTemplate" parentKey="petFrame"/>
		</Frames>
		<Scripts>
			<OnLoad>
				local id = self:GetID();
				self.debuffCountdown = 0; 
				self.numDebuffs = 0;
				self.noTextPrefix = 1;
				local prefix = "ArenaEnemyFrame"..id;
				UnitFrame_Initialize(self, "arena"..id,  _G[prefix.."Name"], nil,
						_G[prefix.."HealthBar"], _G[prefix.."HealthBarText"], 
						_G[prefix.."ManaBar"], _G[prefix.."ManaBarText"], nil, nil, nil,
						_G[prefix.."MyHealPredictionBar"], _G[prefix.."OtherHealPredictionBar"],
						_G[prefix.."TotalAbsorbBar"], _G[prefix.."TotalAbsorbBarOverlay"], _G[prefix.."OverAbsorbGlow"],
						_G[prefix.."OverHealAbsorbGlow"], _G[prefix.."HealAbsorbBar"], _G[prefix.."HealAbsorbBarLeftShadow"],
						_G[prefix.."HealAbsorbBarRightShadow"]);
				SetTextStatusBarTextZeroText(_G[prefix.."HealthBar"], DEAD);
				ArenaEnemyFrame_OnLoad(self);
			</OnLoad>
			<OnShow>
				self:SetFrameLevel(2);
			</OnShow>
			<OnEvent>
				ArenaEnemyFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnEnter>
				UnitFrame_OnEnter(self);
			</OnEnter>
			<OnLeave>
				UnitFrame_OnLeave(self);
			</OnLeave>
		</Scripts>
	</Button>
	<Frame name="ArenaPrepFrames" hidden="true" parent="UIParent">
		<Size x="1" y="1"/>
		<Anchors>
			<Anchor point="TOPRIGHT" relativeTo="MinimapCluster" relativePoint="BOTTOMRIGHT" x="-100" y="-25"/>
		</Anchors>
		<Frames>
			<Button name="ArenaPrepFrame1" inherits="ArenaPrepFrameTemplate" id="1">
				<Anchors>
					<Anchor point="TOP"/>
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaPrepFrame2" inherits="ArenaPrepFrameTemplate" id="2">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaPrepFrame1" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaPrepFrame3" inherits="ArenaPrepFrameTemplate" id="3">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaPrepFrame2" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaPrepFrame4" inherits="ArenaPrepFrameTemplate" id="4">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaPrepFrame3" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaPrepFrame5" inherits="ArenaPrepFrameTemplate" id="5">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaPrepFrame4" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Frame name="ArenaPrepBackground" frameStrata="LOW" enableMouse="true" hidden="true">
				<Size x="125" y="10"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="ArenaPrepFrame1" x="-15" y="6"/>
					<Anchor point="BOTTOMLEFT" x="0" y="0"/>
				</Anchors>
				<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\ArenaEnemyFrame\UI-Arena-Border" tile="true">
					<BackgroundInsets>
						<AbsInset left="32" right="32" top="32" bottom="32"/>
					</BackgroundInsets>
					<TileSize>
						<AbsValue val="32"/>
					</TileSize>
					<EdgeSize>
						<AbsValue val="32"/>
					</EdgeSize>
				</Backdrop> 
				<Scripts>
					<OnLoad>
						self:RegisterEvent("SCRIPT_ARENA_PREP_OPPONENT_SPECIALIZATIONS");
						UpdateArenaPrepBackground();
					</OnLoad>
					<OnShow>
						self:SetFrameLevel(1);
					</OnShow>
					<OnEvent>
						if ( event == "SCRIPT_ARENA_PREP_OPPONENT_SPECIALIZATIONS" ) then
							UpdateArenaPrepBackground();
							OpacityFrameSlider:SetValue(tonumber(GetCVar("partyBackgroundOpacity")));
							ArenaPrepBackground_SetOpacity();
						end
					</OnEvent>
					<OnMouseUp>
						if ( button == "RightButton" ) then
							PartyMemberBackground_ToggleOpacity(self);
						end
					</OnMouseUp>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad function="ArenaPrepFrames_OnLoad"/>
			<OnEvent function="ArenaPrepFrames_OnEvent"/>
			<OnShow function="ArenaPrepFrames_OnShow"/>
			<OnHide function="ArenaPrepFrames_OnHide"/>
		</Scripts>
	</Frame>
	<Frame name="ArenaEnemyFrames" hidden="true" parent="UIParent">
		<Size x="1" y="1"/>
		<Anchors>
			<Anchor point="TOPRIGHT" relativeTo="MinimapCluster" relativePoint="BOTTOMRIGHT" x="-100" y="-25"/>
		</Anchors>
		<Frames>
			<Button name="ArenaEnemyFrame1" inherits="ArenaEnemyFrameTemplate" id="1">
				<Anchors>
					<Anchor point="TOP"/>
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaEnemyFrame2" inherits="ArenaEnemyFrameTemplate" id="2">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaEnemyFrame1" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaEnemyFrame3" inherits="ArenaEnemyFrameTemplate" id="3">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaEnemyFrame2" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaEnemyFrame4" inherits="ArenaEnemyFrameTemplate" id="4">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaEnemyFrame3" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Button name="ArenaEnemyFrame5" inherits="ArenaEnemyFrameTemplate" id="5">
				<Anchors>
					<Anchor point="TOP" relativeTo="ArenaEnemyFrame4" relativePoint="BOTTOM" y="-20" />
					<Anchor point="RIGHT" x="-2"/>
				</Anchors>
			</Button>
			<Frame name="ArenaEnemyBackground" frameStrata="LOW" enableMouse="true" hidden="true">
				<Size x="125" y="10"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="ArenaEnemyFrame1" x="-15" y="6"/>
					<Anchor point="BOTTOMLEFT" x="0" y="0"/>
				</Anchors>
				<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\ArenaEnemyFrame\UI-Arena-Border" tile="true">
					<BackgroundInsets>
						<AbsInset left="32" right="32" top="32" bottom="32"/>
					</BackgroundInsets>
					<TileSize>
						<AbsValue val="32"/>
					</TileSize>
					<EdgeSize>
						<AbsValue val="32"/>
					</EdgeSize>
				</Backdrop> 
				<Scripts>
					<OnLoad>
						self:RegisterEvent("VARIABLES_LOADED");
						UpdateArenaEnemyBackground();
					</OnLoad>
					<OnShow>
						self:SetFrameLevel(1);
					</OnShow>
					<OnEvent>
						if ( event == "VARIABLES_LOADED" ) then
							UpdateArenaEnemyBackground();
							OpacityFrameSlider:SetValue(tonumber(GetCVar("partyBackgroundOpacity")));
							ArenaEnemyBackground_SetOpacity();
						end
					</OnEvent>
					<OnMouseUp>
						if ( button == "RightButton" ) then
							PartyMemberBackground_ToggleOpacity(self);
						end
					</OnMouseUp>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad function="ArenaEnemyFrames_OnLoad"/>
			<OnEvent function="ArenaEnemyFrames_OnEvent"/>
			<OnShow function="ArenaEnemyFrames_OnShow"/>
			<OnHide function="ArenaEnemyFrames_OnHide"/>
		</Scripts>
	</Frame>
</Ui>