<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">
	<Button name="PartyBuffButtonTemplate" virtual="true" hidden="true">
		<Size>
			<AbsDimension x="15" y="15"/>
		</Size>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentIcon" setAllPoints="true"/>
			</Layer>
			<Layer level="OVERLAY">
				<Texture name="$parentBorder" file="Interface\Buttons\UI-Debuff-Overlays">
					<Size>
						<AbsDimension x="17" y="17"/>
					</Size>
					<Anchors>
						<Anchor point="CENTER">
							<Offset>
								<AbsDimension x="0" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
					<TexCoords left="0.296875" right="0.5703125" top="0" bottom="0.515625"/>
				</Texture>	
			</Layer>
		</Layers>
		<Scripts>
			<OnEnter>
				GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
				GameTooltip:SetUnitDebuff("party"..self:GetParent():GetID(), self:GetID());
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Button>
	<Button name="PartyPetBuffButtonTemplate" inherits="PartyBuffButtonTemplate" virtual="true" hidden="true">
		<Scripts>
			<OnEnter>
				GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
				GameTooltip:SetUnitDebuff("partypet"..self:GetParent():GetParent():GetID(), self:GetID());
			</OnEnter>
		</Scripts>
	</Button>
	<Button name="PartyMemberPetFrameTemplate" frameStrata="LOW" toplevel="true" inherits="SecureUnitButtonTemplate" virtual="true">
		<Size>
			<AbsDimension x="64" y="26"/>
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset>
					<AbsDimension x="20" y="-47"/>
				</Offset>
			</Anchor>
		</Anchors>
		<HitRectInsets>
			<AbsInset left="3" right="33" top="3" bottom="3"/>
		</HitRectInsets>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="$parentFlash" file="Interface\TargetingFrame\UI-PartyFrame-Flash" hidden="true">
					<Size>
						<AbsDimension x="64" y="32"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="-1" y="1"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
				<Texture name="$parentPortrait">
					<Size>
						<AbsDimension x="18" y="18"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="3" y="-3"/>
							</Offset>
						</Anchor>
					</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>
										<AbsDimension x="64" y="32"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT">
											<Offset>
												<AbsDimension x="0" y="-1"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
								<FontString name="$parentName" inherits="GameFontNormalSmall">
									<Anchors>
										<Anchor point="BOTTOMLEFT">
											<Offset>
												<AbsDimension x="25" y="21"/>
											</Offset>
										</Anchor>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
					</Frame>
				</Frames>
			</Frame>
			<StatusBar name="$parentHealthBar" inherits="TextStatusBar">
				<Size>
					<AbsDimension x="35" y="4"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="23" y="-6"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnValueChanged>
						UnitFrameHealthBar_OnValueChanged(self, value);
					</OnValueChanged>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
			</StatusBar>
			<Button name="$parentDebuff1" inherits="PartyPetBuffButtonTemplate" id="1">
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="24" y="-16"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff2" inherits="PartyPetBuffButtonTemplate" id="2">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff1" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff3" inherits="PartyPetBuffButtonTemplate" id="3">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff2" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff4" inherits="PartyPetBuffButtonTemplate" id="4">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff3" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
		</Frames>
		<Scripts>
			<OnLoad>
				local id = self:GetParent():GetID();
				local prefix = "PartyMemberFrame"..id.."PetFrame";
				local unit = "partypet"..id;
				UnitFrame_Initialize(self, unit,  getglobal(prefix.."Name"), getglobal(prefix.."Portrait"),
					   getglobal(prefix.."HealthBar"), getglobal(prefix.."HealthBarText"),
				       nil, nil, getglobal(prefix.."Flash"));
				SetTextStatusBarTextZeroText(getglobal(prefix.."HealthBar"), DEAD);
				getglobal(prefix.."Name"):Hide();
				SecureUnitButton_OnLoad(self, unit);
			</OnLoad>
			<OnShow>
				UnitFrame_Update(self);
			</OnShow>
			<OnEvent>
				UnitFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnEnter>
				UnitFrame_OnEnter(self);
			</OnEnter>
			<OnLeave>
				UnitFrame_OnLeave(self);
			</OnLeave>
		</Scripts>
	</Button>
	<Button name="PartyMemberFrameTemplate" frameStrata="LOW" toplevel="true" movable="true" hidden="true" inherits="SecureUnitButtonTemplate" virtual="true">
		<Size>
			<AbsDimension x="128" y="53"/>
		</Size>
		<HitRectInsets>
			<AbsInset left="7" right="85" top="6" bottom="7"/>
		</HitRectInsets>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="$parentFlash" file="Interface\TargetingFrame\UI-PartyFrame-Flash" hidden="true">
					<Size>
						<AbsDimension x="128" y="64"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="-3" y="2"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
				<Texture name="$parentPortrait">
					<Size>
						<AbsDimension x="37" y="37"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="7" y="-6"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true">
				<Size>
					<AbsDimension x="10" y="10"/>
				</Size>
				<Anchors>
					<Anchor point="TOP">
						<Offset>
							<AbsDimension x="-20" y="-10"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						PartyFrameDropDown_OnLoad(self);
					</OnLoad>
				</Scripts>
			</Frame>
			<Frame setAllPoints="true">
				<Frames>
					<Frame setAllPoints="true">
						<Layers>
							<Layer level="BACKGROUND">
								<Texture name="$parentTexture" file="Interface\TargetingFrame\UI-PartyFrame">
									<Size>
										<AbsDimension x="128" y="64"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT">
											<Offset>
												<AbsDimension x="0" y="-2"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
								<Texture name="$parentVehicleTexture" file="Interface\Vehicles\UI-Vehicles-PartyFrame" hidden="true">
									<Size>
										<AbsDimension x="128" y="64"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT">
											<Offset>
												<AbsDimension x="-6" y="6"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
								<FontString name="$parentName" inherits="GameFontNormalSmall" justifyH="LEFT">
									<Anchors>
										<Anchor point="BOTTOMLEFT">
											<Offset>
												<AbsDimension x="50" y="43"/>
											</Offset>
										</Anchor>
									</Anchors>
								</FontString>
								<FontString name="$parentHealthBarText" inherits="TextStatusBarText">
									<Anchors>
										<Anchor point="CENTER">
											<Offset>
												<AbsDimension x="20" y="12"/>
											</Offset>
										</Anchor>
									</Anchors>
								</FontString>
								<FontString name="$parentManaBarText" inherits="TextStatusBarText">
									<Anchors>
										<Anchor point="CENTER">
											<Offset>
												<AbsDimension x="20" y="2"/>
											</Offset>
										</Anchor>
									</Anchors>
								</FontString>
							</Layer>
							<Layer level="ARTWORK">
								<Texture name="$parentStatus" file="Interface\Buttons\UI-Debuff-Overlays" hidden="true">
									<Size>
										<AbsDimension x="36" y="36"/>
									</Size>
									<Anchors>
										<Anchor point="CENTER" relativeTo="$parentPortrait">
											<Offset>
												<AbsDimension x="0" y="0"/>
											</Offset>
										</Anchor>
									</Anchors>
									<TexCoords left="0" right="0.2734375" top="0" bottom="0.5625"/>
								</Texture>
							</Layer>
							<Layer level="OVERLAY">
								<Texture name="$parentLeaderIcon" file="Interface\GroupFrame\UI-Group-LeaderIcon" hidden="true">
									<Size>
										<AbsDimension x="16" y="16"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT"/>
									</Anchors>
								</Texture>
								<Texture name="$parentMasterIcon" file="Interface\GroupFrame\UI-Group-MasterLooter" hidden="true">
									<Size>
										<AbsDimension x="16" y="16"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT">
											<Offset>
												<AbsDimension x="32" y="0"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
								<Texture name="$parentPVPIcon" hidden="true">
									<Size>
										<AbsDimension x="32" y="32"/>
									</Size>
									<Anchors>
										<Anchor point="TOPLEFT">
											<Offset>
												<AbsDimension x="-9" y="-15"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
								<Texture name="$parentDisconnect" file="Interface\CharacterFrame\Disconnect-Icon" hidden="true">
									<Size>
										<AbsDimension x="64" y="64"/>
									</Size>
									<Anchors>
										<Anchor point="LEFT">
											<Offset>
												<AbsDimension x="-7" y="-1"/>
											</Offset>
										</Anchor>
									</Anchors>
								</Texture>
							</Layer>
						</Layers>
					</Frame>
				</Frames>
			</Frame>
			<StatusBar name="$parentHealthBar" inherits="TextStatusBar">
				<Size>
					<AbsDimension x="70" y="8"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="47" y="-12"/>
						</Offset>
					</Anchor>
				</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>
						PartyMemberHealthCheck(self, value);
						UnitFrameHealthBar_OnValueChanged(self, value);
					</OnValueChanged>
				</Scripts>
				<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
			</StatusBar>
			<StatusBar name="$parentManaBar" inherits="TextStatusBar">
				<Size>
					<AbsDimension x="70" y="8"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="47" y="-21"/>
						</Offset>
					</Anchor>
				</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>
			<Button name="$parentSpeaker" inherits="VoiceChatSpeakerTemplate">
				<Size>
					<AbsDimension x="12" y="12"/>
				</Size>
				<Anchors>
					<Anchor point="BOTTOMLEFT" relativeTo="$parentTexture" relativePoint="BOTTOMLEFT">
						<Offset>
							<AbsDimension x="10" y="14"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						self:SetFrameLevel(self:GetFrameLevel() +2);
					</OnLoad>
					<OnClick>
						
					</OnClick>
				</Scripts>
			</Button>
			<Frame name="$parentSpeakerFrame" inherits="VoiceChatSpeakerTemplate" hidden="true">
				<Size>
					<AbsDimension x="16" y="16"/>
				</Size>
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentTexture" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="-5" y="15"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnUpdate>
						VoiceChat_OnUpdate(self, elapsed);
					</OnUpdate>
				</Scripts>
			</Frame>
			<Frame name="$parentReadyCheck" inherits="ReadyCheckStatusTemplate" hidden="true">
				<Anchors>
					<Anchor point="CENTER" relativeTo="$parentPortrait" relativePoint="CENTER">
						<Offset>
							<AbsDimension x="0" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						self:SetFrameLevel(self:GetFrameLevel() +2);
					</OnLoad>
				</Scripts>
			</Frame>
			<Button name="$parentDebuff1" inherits="PartyBuffButtonTemplate" id="1">
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="48" y="-32"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff2" inherits="PartyBuffButtonTemplate" id="2">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff1" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff3" inherits="PartyBuffButtonTemplate" id="3">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff2" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentDebuff4" inherits="PartyBuffButtonTemplate" id="4">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentDebuff3" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="2" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentPetFrame" inherits="PartyMemberPetFrameTemplate"/>
		</Frames>
		<Scripts>
			<OnLoad>
				local id = self:GetID();
				self.debuffCountdown = 0; 
				self.numDebuffs = 0;
				self.noTextPrefix = 1;
				local prefix = "PartyMemberFrame"..id;
				UnitFrame_Initialize(self, "party"..id,  getglobal(prefix.."Name"), getglobal(prefix.."Portrait"),
					   getglobal(prefix.."HealthBar"), getglobal(prefix.."HealthBarText"), 
					   getglobal(prefix.."ManaBar"), getglobal(prefix.."ManaBarText"),
				       getglobal(prefix.."Flash"));
				SetTextStatusBarTextZeroText(getglobal(prefix.."HealthBar"), DEAD);
				PartyMemberFrame_OnLoad(self);
			</OnLoad>
			<OnShow>
				self:SetFrameLevel(2);
			</OnShow>
			<OnEvent>
				PartyMemberFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnEnter>
				UnitFrame_OnEnter(self);
				PartyMemberBuffTooltip:SetPoint("TOPLEFT", self, "TOPLEFT", 47, -30);
				PartyMemberBuffTooltip_Update(self);
			</OnEnter>
			<OnLeave>
				UnitFrame_OnLeave(self);
				PartyMemberBuffTooltip:Hide();
			</OnLeave>
			<OnUpdate>
				PartyMemberFrame_OnUpdate(self, elapsed);
			</OnUpdate>
		</Scripts>
	</Button>
</Ui>
