<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="ContainerFrame.lua"/>
	<Button name="ContainerFrameItemButtonTemplate" inherits="ItemButtonTemplate" hidden="true" virtual="true">
		<Anchors>
			<Anchor point="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="0" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Animations>
			<AnimationGroup parentKey="newitemglowAnim" setToFinalAlpha="true" looping="REPEAT">
				<Alpha childKey="NewItemTexture" smoothing="NONE" duration="0.8" order="1" fromAlpha="1" toAlpha="0.4"/>
				<Alpha childKey="NewItemTexture" smoothing="NONE" duration="0.8" order="2" fromAlpha="0.4" toAlpha="1"/>
			</AnimationGroup>
			<AnimationGroup parentKey="flashAnim" setToFinalAlpha="true">
				<Alpha childKey="flash" smoothing="OUT" duration="0.6" order="1" fromAlpha="1" toAlpha="0"/>
			</AnimationGroup>
		</Animations>
		<Layers>
			<Layer level="ARTWORK" textureSubLevel="1">
				<Texture name="$parentIconQuestTexture">
					<Size>
						<AbsDimension x="37" y="38"/>
					</Size>
					<Anchors>
						<Anchor point="TOP">
							<Offset>
								<AbsDimension x="0" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
			</Layer>
			<Layer level="OVERLAY">
				<Texture parentKey="JunkIcon" atlas="bags-junkcoin" useAtlasSize="true" hidden="true">
					<Anchors>
						<Anchor point="TOPLEFT" x="1" y="0"/>
					</Anchors>
				</Texture>
			</Layer>
			<Layer level="OVERLAY" textureSubLevel="1">
				<Texture parentKey="flash" hidden="false" alpha="0" alphaMode="ADD" atlas="bags-glow-flash" useAtlasSize="true">
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
				<Texture parentKey="NewItemTexture" alpha="0" alphaMode="ADD" atlas="bags-glow-green" useAtlasSize="true">
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
				<Texture parentKey="BattlepayItemTexture" file="Interface\Store\store-item-highlight">
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate"/>
		</Frames>
		<Scripts>
			<OnClick>
				local modifiedClick = IsModifiedClick();
				-- If we can loot the item and autoloot toggle is active, then do a normal click
				if ( button ~= "LeftButton" and modifiedClick and IsModifiedClick("AUTOLOOTTOGGLE") ) then
					local _, _, _, _, _, lootable = GetContainerItemInfo(self:GetParent():GetID(), self:GetID());
					if ( lootable ) then
						modifiedClick = false;
					end
				end
				if ( modifiedClick ) then
					ContainerFrameItemButton_OnModifiedClick(self, button);
				else
					ContainerFrameItemButton_OnClick(self, button);
				end
			</OnClick>
			<OnLoad>
				ContainerFrameItemButton_OnLoad(self);
			</OnLoad>
			<OnEnter>
				ContainerFrameItemButton_OnEnter(self, motion);
			</OnEnter>
			<OnLeave>
				GameTooltip_Hide();
				ResetCursor();
			</OnLeave>
			<OnHide>
				if ( self.hasStackSplit and (self.hasStackSplit == 1) ) then
					StackSplitFrame:Hide();
				end
			</OnHide>
			<OnDragStart>
				ContainerFrameItemButton_OnDrag(self, button);
			</OnDragStart>
			<OnReceiveDrag>
				ContainerFrameItemButton_OnDrag(self);
			</OnReceiveDrag>
		</Scripts>
	</Button>
	<Frame name="ContainerFrameTemplate" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="256" y="256"/>
		</Size>
		<Layers>
			<Layer level="BACKGROUND">
                <Texture name="$parentPortrait" parentKey="Portrait">
                    <Size>
                        <AbsDimension x="40" y="40"/>
                    </Size>
                    <Anchors>
                        <Anchor point="TOPLEFT">
                            <Offset>
                                <AbsDimension x="7" y="-5"/>
                            </Offset>
                        </Anchor>
                    </Anchors>
                </Texture>
            </Layer>
			<Layer level="ARTWORK">
				<Texture name="$parentBackgroundTop" file="Interface\ContainerFrame\UI-Bag-Components">
					<Size>
						<AbsDimension x="256" y="512"/>
					</Size>
					<Anchors>
						<Anchor point="TOPRIGHT" relativeTo="$parent">
							<Offset>
								<AbsDimension x="0" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
				<Texture name="$parentBackgroundMiddle1" file="Interface\ContainerFrame\UI-Bag-Components">
					<Size>
						<AbsDimension x="256" y="512"/>
					</Size>
					<Anchors>
						<Anchor point="TOP" relativeTo="$parentBackgroundTop" relativePoint="BOTTOM"/>
					</Anchors>
					<TexCoords left="0" right="1" top="0.3515625" bottom="0.8515625"/>
				</Texture>
				<Texture name="$parentBackgroundMiddle2" file="Interface\ContainerFrame\UI-Bag-Components" hidden="true">
					<Size>
						<AbsDimension x="256" y="256"/>
					</Size>
					<Anchors>
						<Anchor point="TOP" relativeTo="$parentBackgroundMiddle1" relativePoint="BOTTOM"/>
					</Anchors>
					<TexCoords left="0" right="1" top="0.353515625" bottom="0.8515625"/>
				</Texture>
				<Texture name="$parentBackgroundBottom" file="Interface\ContainerFrame\UI-Bag-Components">
					<Size>
						<AbsDimension x="256" y="10"/>
					</Size>
					<Anchors>
						<Anchor point="TOP" relativeTo="$parentBackgroundMiddle1" relativePoint="BOTTOM"/>
					</Anchors>
					<TexCoords left="0" right="1" top="0.330078125" bottom="0.349609375"/>
				</Texture>
				<FontString name="$parentName" inherits="GameFontHighlight">
					<Size>
						<AbsDimension x="112" y="12"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="47" y="-10"/>
							</Offset>
						</Anchor>
					</Anchors>
				</FontString>
				<Texture name="$parentBackground1Slot" file="Interface\ContainerFrame\UI-Bag-1Slot" hidden="true">
					<Size>
						<AbsDimension x="99" y="74"/>
					</Size>
					<Anchors>
						<Anchor point="TOPRIGHT">
							<Offset>
								<AbsDimension x="0" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
					<TexCoords left="0" right="0.7734375" top="0" bottom="0.578125"/>
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Frame name="$parentMoneyFrame" inherits="SmallMoneyFrameTemplate" hidden="true">
				<Anchors>
					<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
						<Offset>
							<AbsDimension x="-2" y="-227"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						SmallMoneyFrame_OnLoad(self);
						MoneyFrame_SetType(self, "PLAYER");
						MoneyFrame_SetMaxDisplayWidth(self, 168);
					</OnLoad>
				</Scripts>
			</Frame>
			<Button name="$parentItem1" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem2" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem3" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem4" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem5" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem6" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem7" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem8" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem9" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem10" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem11" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem12" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem13" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem14" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem15" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem16" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem17" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem18" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem19" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem20" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem21" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem22" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem23" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem24" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem25" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem26" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem27" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem28" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem29" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem30" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem31" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem32" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem33" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem34" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem35" inherits="ContainerFrameItemButtonTemplate"/>
			<Button name="$parentItem36" inherits="ContainerFrameItemButtonTemplate"/>

			<Button name="$parentPortraitButton" parentKey="PortraitButton">
				<Size>
					<AbsDimension x="40" y="40"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="7" y="-5"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<Texture parentKey="Highlight" atlas="bags-roundhighlight" alphaMode="ADD" hidden="true" alpha="0.8">
							<Size x="36" y="36"/>
							<Anchors>
								<Anchor point="CENTER" x="-3" y="3"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<Scripts>
					<OnEnter>
						self.Highlight:Show();
						GameTooltip:SetOwner(self, "ANCHOR_LEFT");
						if ( self:GetID() == 0 ) then
							GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0, 1.0, 1.0);
							if (GetBindingKey("TOGGLEBACKPACK")) then
								GameTooltip:AppendText(" "..NORMAL_FONT_COLOR_CODE.."("..GetBindingKey("TOGGLEBACKPACK")..")"..FONT_COLOR_CODE_CLOSE)
							end
						else
							local link = GetInventoryItemLink("player", ContainerIDToInventoryID(self:GetID()));
							local name, _, quality = GetItemInfo(link);
							local r, g, b = GetItemQualityColor(quality);
							GameTooltip:SetText(name, r, g, b);
							for i = LE_BAG_FILTER_FLAG_EQUIPMENT, NUM_LE_BAG_FILTER_FLAGS do
								if ( GetBagSlotFlag(self:GetID(), i) ) then
									GameTooltip:AddLine(BAG_FILTER_ASSIGNED_TO:format(BAG_FILTER_LABELS[i]));
									break;
								end
							end
							local binding = GetBindingKey("TOGGLEBAG"..(4 - self:GetID() + 1));
							if ( binding ) then
								GameTooltip:AppendText(" "..NORMAL_FONT_COLOR_CODE.."("..binding..")"..FONT_COLOR_CODE_CLOSE);
							end
						end
						GameTooltip:AddLine(CLICK_BAG_SETTINGS);
						GameTooltip:Show();
					</OnEnter>
					<OnLeave>
						self.Highlight:Hide();
						GameTooltip:Hide();
					</OnLeave>
					<OnClick>
						local parent = self:GetParent();
						PlaySound("igMainMenuOptionCheckBoxOn");
						ToggleDropDownMenu(1, nil, parent.FilterDropDown, self, 0, 0);
					</OnClick>
				</Scripts>
			</Button>
			<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
				<Anchors>
					<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
						<Offset>
							<AbsDimension x="0" y="-1"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnClick>
						ToggleBag(self:GetParent():GetID());
					</OnClick>
				</Scripts>
			</Button>
			<Frame name="$parentFilterDropDown" parentKey="FilterDropDown" inherits="UIDropDownMenuTemplate">
				<Scripts>
					<OnLoad function="ContainerFrameFilterDropDown_OnLoad"/>
				</Scripts>
			</Frame>
			<Button parentKey="ClickableTitleFrame">
				<Size x="118" y="16"/>
				<Anchors>
					<Anchor point="TOP" x="8" y="-8"/>
				</Anchors>
				<Scripts>
					<OnEnter>
						local target = self:GetParent().PortraitButton;
						target:GetScript("OnEnter")(target);
					</OnEnter>
					<OnLeave>
						local target = self:GetParent().PortraitButton;
						target:GetScript("OnLeave")(target);
					</OnLeave>
					<OnClick>
						local target = self:GetParent().PortraitButton;
						target:GetScript("OnClick")(target);
					</OnClick>
				</Scripts>
			</Button>
		</Frames>
		<Scripts>
			<OnEvent>
				ContainerFrame_OnEvent(self, event, ...);
			</OnEvent>
			<OnLoad>
				ContainerFrame_OnLoad(self);
			</OnLoad>
			<OnHide>
				ContainerFrame_OnHide(self);
			</OnHide>
			<OnShow>
				ContainerFrame_OnShow(self);
			</OnShow>
		</Scripts>
	</Frame>
	<Frame name="ContainerFrame1" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame2" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame3" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame4" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame5" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame6" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame7" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame8" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame9" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame10" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame11" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame12" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>
	<Frame name="ContainerFrame13" inherits="ContainerFrameTemplate" parent="UIParent" id="100" hidden="true"/>

	<EditBox name="BagItemSearchBox" inherits="BagSearchBoxTemplate" parent="ContainerFrame1" letters="15" hidden="true">
		<Size x="100" y="18"/>
	</EditBox>

	<Button name="BagItemAutoSortButton" parent="ContainerFrame1" hidden="true">
		<Size x="28" y="26"/>
		<NormalTexture atlas="bags-button-autosort-up"/>
		<PushedTexture atlas="bags-button-autosort-down"/>
		<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD">
			<Size x="26" y="24"/>
			<Anchors>
				<Anchor point="CENTER" x="0" y="1"/>
			</Anchors>
		</HighlightTexture>
		<Scripts>
			<OnClick>
				SortBags();
			</OnClick>
			<OnEnter>
				GameTooltip:SetOwner(self);
				GameTooltip:SetText(BAG_CLEANUP_BAGS);
				GameTooltip:Show();
			</OnEnter>
			<OnLeave function="GameTooltip_Hide"/>
		</Scripts>
	</Button>

	<Frame name="BagHelpBox" parent="UIParent" inherits="GlowBoxTemplate" frameStrata="HIGH" hidden="true">
		<Size x="220" y="200"/>
		<Layers>
			<Layer level="ARTWORK">
				<FontString parentKey="Text" inherits="GameFontHighlightLeft" justifyV="TOP">
					<Size x="188" y="0"/>
					<Anchors>
						<Anchor point="TOPLEFT" x="16" y="-12"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
			<Button parentKey="CloseButton" inherits="UIPanelCloseButton">
				<Anchors>
					<Anchor point="TOPRIGHT" x="6" y="6"/>
				</Anchors>
				<Scripts>
					<OnClick>
						self:GetParent():Hide();
					</OnClick>
				</Scripts>
			</Button>
			<Frame parentKey="Arrow" inherits="GlowBoxArrowTemplate">
				<Anchors>
					<Anchor point="LEFT" relativePoint="RIGHT" x="-2" y="16"/>
				</Anchors>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				self.Text:SetSpacing(4);
				SetClampedTextureRotation(self.Arrow.Arrow, 270);
				SetClampedTextureRotation(self.Arrow.Glow, 270);
				self.Arrow.Glow:ClearAllPoints();
				self.Arrow.Glow:SetPoint("LEFT", self, "RIGHT");
			</OnLoad>
			<OnShow>
				self:SetHeight(self.Text:GetHeight()+30);
			</OnShow>
		</Scripts>
	</Frame>
</Ui>