 <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">
	
	<!-- Don't touch, this order is important -->
	<Script file="Libs\LibStub\LibStub.lua"/>
	<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
	<Script file="Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
	<Script file="Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
	<Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
	<Include file="libs\AceDB-3.0\AceDB-3.0.xml"/>
	
	
	<Frame name="LOLIB_MapPinTemplate" virtual="true">
		<Size x="16" y="16"/>
		<Layers>
			<Layer level="OVERLAY">
				<Texture parentKey="glow" file="Interface\MINIMAP\Ping\ping5" hidden="true" alphaMode="ADD">
					<Size x="24" y="24"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
			</Layer>
			<Layer level="ARTWORK">
				<Texture parentKey="tex" file="Interface\AddOns\LoreLibrary\Images\icon_Object" />
			</Layer>
		</Layers>
		
		<Scripts>
			<OnEnter>
				GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
				if (self.lore) then
					GameTooltip:SetText(self.lore.title);
				end
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Frame>
	
	<StatusBar name="LOLIB_CoreStatusTemplate" inherits="LOLIB_ProgressBarTemplate" virtual="true">
		<Anchors>
			<Anchor point="TOP" x="0" y="-39"/>
		</Anchors>
		<Layers>
			<Layer level="OVERLAY">
				<Texture parentKey="border" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder">
					<Size x="205" y="29" />
					<Anchors>
						<Anchor point="LEFT" x="-5" y="0"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
	</StatusBar>

	<StatusBar name="LOLIB_ProgressBarTemplate" virtual="true">
		<Size x="196" y="13"/>
		<Layers>
			<Layer level="OVERLAY">
				<FontString parentKey="text" inherits="TextStatusBarText" justifyH="CENTER">
					<Size x="0" y="9" />
					<Anchors>
						<Anchor point="CENTER" y="1" />
					</Anchors>
				</FontString>
			</Layer>
			<Layer parentKey="background" level="BACKGROUND">
				<Texture>
					<Anchors>
						<Anchor point="TOPLEFT" x="0" y="-1"/>
						<Anchor point="BOTTOMRIGHT" x="0" y="1"/>
					</Anchors>
					<Color r="0.0" g="0.0" b="0.0" a="1.0"/>
				</Texture>
			</Layer>
		</Layers>
		<BarTexture file="Interface\PaperDollInfoFrame\UI-Character-Skills-Bar"/>
		<BarColor r="0.03125" g="0.85" b="0.0" />
	</StatusBar>
	
	<Button name="LOLIB_SourceTemplate" virtual="true">
		<Size y="40"/>
		<Anchors>
			<Anchor point="LEFT"/>
			<Anchor point="RIGHT"/>
		</Anchors>
		<Frames>
			<Frame parentKey="icon">
				<Size x="32" y="32"/>
				<Anchors>
					<Anchor point="LEFT"/>
				</Anchors>
				<NormalTexture file="Interface\AddOns\LoreLibrary\Images\icon_Container" />
				
				<Layers>
					<Layer level="ARTWORK">
						<Texture parentKey="tex" file="Interface\AddOns\LoreLibrary\Images\icon_Container" />
					</Layer>
				</Layers>
				
				<Frames>
					<Frame parentKey="factionAlliance" hidden="true">
						<Size x="18" y="18" />
						<Anchors>
							<Anchor point="BOTTOMRIGHT" relativeKey="$parent.icon" x="3"/>
						</Anchors>
						<Layers>
							<Layer level="ARTWORK">
								<Texture  file="Interface\FriendsFrame\PlusManz-Alliance" />
							</Layer>
						</Layers>
					</Frame>
					
					<Frame parentKey="factionHorde" hidden="true">
						<Size x="18" y="18" />
						<Anchors>
							<Anchor point="BOTTOMRIGHT" relativeKey="$parent.icon" x="3"/>
						</Anchors>
						<Layers>
							<Layer level="ARTWORK">
								<Texture  file="Interface\FriendsFrame\PlusManz-Horde" />
							</Layer>
						</Layers>
					</Frame>
				</Frames>
				
				<Scripts>
					<OnEnter>
						if (self.sourceType ~= nil) then
							GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
							GameTooltip:SetText(self.sourceType);
						end
					</OnEnter>
					<OnLeave>
						GameTooltip:Hide();
					</OnLeave>
				</Scripts>
			</Frame>
			
		</Frames>
		
		<Layers>
			<Layer level="ARTWORK">
				<FontString inherits="QuestFont" hidden="false" justifyH="LEFT" justifyV="MIDDLE" parentKey="text" maxLines="3" text="This is where text goes">
					<Anchors>
						<Anchor point="LEFT" relativeKey="$parent.icon" relativePoint="RIGHT" x="7"/>
						<Anchor point="RIGHT" x="7"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<HighlightTexture file="Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight-yellow" alphaMode="ADD">
			<Color r="1" g="1" b="1" a="0.3"/>
		</HighlightTexture>
	</Button>
	
	<Frame name="LOLIB_SourceContainerTemplate" virtual="true">
		<Frames>
			<Button parentKey="s1" inherits="LOLIB_SourceTemplate" id="1">
				<Anchors>
					<Anchor point="TOP"/>
				</Anchors>
			</Button>
			
			<Button parentKey="s2" inherits="LOLIB_SourceTemplate" id="2">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s1" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s3" inherits="LOLIB_SourceTemplate" id="3">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s2" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s4" inherits="LOLIB_SourceTemplate" id="4">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s3" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s5" inherits="LOLIB_SourceTemplate" id="5">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s4" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s6" inherits="LOLIB_SourceTemplate" id="6">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s5" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s7" inherits="LOLIB_SourceTemplate" id="7">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s6" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s8" inherits="LOLIB_SourceTemplate" id="8">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s7" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
			<Button parentKey="s9" inherits="LOLIB_SourceTemplate" id="9">
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.s8" relativePoint="BOTTOM"/>
				</Anchors>
			</Button>
		</Frames>
	</Frame>
	
	<Frame name="LOLIB_InsetTemplate" inherits="InsetFrameTemplate" virtual="true">
		<Layers>
			<Layer level="OVERLAY">
				<Texture parentKey="OverlayShadowTopLeft" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="4" y="-4"/>
					</Anchors>
				</Texture>

				<Texture parentKey="OverlayShadowTop" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="17" y="-4"/>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-17" y="-4"/>
					</Anchors>
					<TexCoords left="0.9999" right="1" top="0" bottom="1"/>
				</Texture>

				<Texture parentKey="OverlayShadowTopRight" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-4" y="-4"/>
					</Anchors>
					<TexCoords left="1" right="0" top="0" bottom="1"/>
				</Texture>

				<Texture parentKey="OverlayShadowLeft" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="4" y="-17"/>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="4" y="16"/>
					</Anchors>
					<TexCoords left="0" right="1" top="0.9999" bottom="1"/>
				</Texture>

				<Texture parentKey="OverlayShadowBottomLeft" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="4" y="3"/>
					</Anchors>
					<TexCoords left="0" right="1" top="1" bottom="0"/>
				</Texture>

				<Texture parentKey="OverlayShadowRight" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-4" y="-17"/>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-4" y="16"/>
					</Anchors>
					<TexCoords left="1" right="0" top="0.9999" bottom="1"/>
				</Texture>

				<Texture parentKey="OverlayShadowBottomRight" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-4" y="3"/>
					</Anchors>
					<TexCoords left="1" right="0" top="1" bottom="0"/>
				</Texture>

				<Texture parentKey="OverlayShadowBottom" atlas="collections-background-shadow-small" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="17" y="3"/>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-17" y="3"/>
					</Anchors>
					<TexCoords left="0.9999" right="1" top="1" bottom="0"/>
				</Texture>
			</Layer>

			<Layer level="BORDER" textureSubLevel="2">
				<Texture parentKey="ShadowCornerTopLeft" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" x="4" y="-4"/>
					</Anchors>
				</Texture>

				<Texture parentKey="ShadowCornerTopRight" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-4" y="-4" />
					</Anchors>
					<TexCoords left="1.0" right="0.0" top="0.0" bottom="1.0"/>
				</Texture>

				<Texture parentKey="ShadowCornerBottomLeft" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="4" y="4"/>
					</Anchors>
					<TexCoords left="0.0" right="1.0" top="1.0" bottom="0.0"/>
				</Texture>

				<Texture parentKey="ShadowCornerBottomRight" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-4" y="4"/>
					</Anchors>
					<TexCoords left="1.0" right="0.0" top="1.0" bottom="0.0"/>
				</Texture>

				<Texture parentKey="ShadowCornerTop" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="149" y="-4"/>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-149" y="-4"/>
					</Anchors>
					<TexCoords left="0.9999" right="1" top="0" bottom="1"/>
				</Texture>

				<Texture parentKey="ShadowCornerLeft" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="4" y="-151"/>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="4" y="151"/>
					</Anchors>
					<TexCoords left="0" right="1" top="0.9999" bottom="1"/>
				</Texture>

				<Texture parentKey="ShadowCornerRight" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="-4" y="-151"/>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-4" y="151"/>
					</Anchors>
					<TexCoords left="1" right="0" top="0.9999" bottom="1"/>
				</Texture>

				<Texture parentKey="ShadowCornerBottom" atlas="collections-background-shadow-large" useAtlasSize="true">
					<Anchors>
						<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="149" y="4"/>
						<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-149" y="4"/>
					</Anchors>
					<TexCoords left="0.9999" right="1" top="1" bottom="0"/>
				</Texture>
			</Layer>
		</Layers>
	</Frame>
	
	<Button name="LOLIB_SuggestionTemplate" hidden="false" inherits="SecureFrameTemplate" virtual="true">
		<Size>
			<AbsDimension x="200" y="40"/>
		</Size>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture atlas="PetList-ButtonBackground" parentKey="background"/>
			</Layer>
			<Layer level="ARTWORK">
				<FontString name="$parentTitle" inherits="GameFontWhite" maxLines="2" hidden="false" justifyH="LEFT" justifyV="MIDDLE" parentKey="title">
					<Anchors>
						<Anchor point="TOPLEFT" x="20"/>
						<Anchor point="BOTTOMRIGHT" x="-20"/>
					</Anchors>
				</FontString>
			</Layer>
			<Layer level="OVERLAY">
				<FontString inherits="GameFontWhite" maxLines="1" hidden="false" justifyH="LEFT" justifyV="MIDDLE" parentKey="new" text="New !">
					<Anchors>
						<Anchor point="LEFT" x="20" y=""/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<HighlightTexture atlas="PetList-ButtonHighlight">
			<Color r="1" g="1" b="1" a="1"/>
		</HighlightTexture>
		<Frames>
			<Button name="$parentRemove" parentKey="remove">
				<Size x="10" y="10"/>
				<Anchors>
					<Anchor point="TOPRIGHT" x="-2" y="-2"/>
				</Anchors>
				<NormalTexture file="Interface\AddOns\LoreLibrary\Images\icon_Unavailable">
					<Color r="1" g="1" b="1" a="1"/>
				</NormalTexture>
			</Button>
			<Scripts>
				<OnLoad>

					self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
				</OnLoad>
			</Scripts>
		</Frames>
		
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
			</OnLoad>
		</Scripts>
	</Button>
	
	<Button name="LOLIB_ListBookTemplate" hidden="false" inherits="SecureFrameTemplate" virtual="true">
		<Size>
			<AbsDimension x="252" y="40"/>
		</Size>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture atlas="PetList-ButtonBackground" parentKey="background"/>
			</Layer>
			<Layer level="ARTWORK">
				<FontString name="$parentTitle" inherits="GameFontNormal" maxLines="2" hidden="false" justifyH="LEFT" justifyV="MIDDLE" parentKey="title">
					<Anchors>
						<Anchor point="TOPLEFT" x="20"/>
						<Anchor point="BOTTOMRIGHT" x="-20"/>
					</Anchors>
				</FontString>
			</Layer>
			<Layer level="OVERLAY">
                <Texture parentKey="selectedTexture" atlas="PetList-ButtonSelect" hidden="true"/>
				<Texture parentKey="favorite" atlas="PetJournal-FavoritesIcon" useAtlasSize="true">
                    <Anchors>
                        <Anchor point="TOPLEFT" relativeKey="$parent.icon" x="-2" y="2"/>
                    </Anchors>
                </Texture>
			</Layer>
		</Layers>
		
		<HighlightTexture atlas="PetList-ButtonHighlight">
			<Color r="1" g="1" b="1" a="1"/>
		</HighlightTexture>

		<Scripts>
			<OnClick function="LOLIB_ListBook_OnClick"/>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
			</OnLoad>
		</Scripts>
	</Button>
	
	<Frame name="LoreLibraryCore" inherits="PortraitFrameTemplate" movable="true" toplevel="true" frameStrata="HIGH" enableMouse="true" parent="UIParent" hidden="true">
		<Size x="703" y="606"/>
		<Anchors>
			<Anchor point="CENTER" x="0" y="0"/>
		</Anchors>

		<Frames>
			<StatusBar parentKey="progressBar" inherits="LOLIB_CoreStatusTemplate" />
			
			<Frame parentKey="tokenCount" inherits="InsetFrameTemplate3" enableMouse="true">
				<Size x="50" y="20"/>
				<Anchors>
					<Anchor point="LEFT" relativeKey="$parent.progressBar" relativePoint="RIGHT" x="25"/>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<FontString parentKey="count" inherits="GameFontHighlightSmall" justifyH="RIGHT" text="25">
							<Anchors>
								<Anchor point="TOP" x="-7" y="-5"/>
							</Anchors>
						</FontString>
						<Texture parentKey="icon" file="Interface\GossipFrame\WorkOrderGossipIcon">
							<Size x="14" y="14"/>
							<Anchors>
								<Anchor point="RIGHT" x="-7"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<Scripts>
					<OnEnter>
						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
						GameTooltip:SetText("Lost pages" ,1 ,1 ,1);
						GameTooltip:AddLine("Pages are gained with every 20 pieces of lore you unlock, and can be used to unlock unavailable lore." ,1 ,0.83 ,0 ,true);
						GameTooltip:AddDoubleLine("Unlocks until next:", (self.untilNext or 20) ,1 ,1 ,1 ,1 ,1 ,1 );
						GameTooltip:Show();
					</OnEnter>
					<OnLeave>
						GameTooltip:Hide();
					</OnLeave>
				</Scripts>
			</Frame>
			
			<Button name="$parentSuggestionButton" inherits="UIMenuButtonStretchTemplate" text="" parentKey="suggestBtn">
				<Size x="26" y="26"/>
				<Anchors>
					<Anchor point="LEFT" relativeKey="$parent.tokenCount" relativePoint="RIGHT" x="25"/>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<Texture parentKey="icon" file="Interface\GossipFrame\AvailableQuestIcon">
							<Size x="16" y="16"/>
							<Anchors>
								<Anchor point="CENTER"/>
							</Anchors>
						</Texture>
					</Layer>
					<Layer level="OVERLAY">
						<Texture parentKey="glow" file="Interface\BUTTONS\CheckButtonGlow" hidden="true">
							<Anchors>
								<Anchor point="TOPLEFT" x="-6" y="6"/>
								<Anchor point="BOTTOMRIGHT" x="6" y="-6"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>	
				
				<HighlightTexture file="Interface\BUTTONS\UI-Common-MouseHilight" alphaMode="ADD"/>
			</Button>
			<Frame name="$parentSuggestionFrame" inherits="TooltipBorderedFrameTemplate" parentKey="suggestions" enableMouse="true" frameStrata="DIALOG" hidden="true">
				<Size x="210" y="160"/>
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.suggestBtn" relativePoint="BOTTOM" />
				</Anchors>
				
				<Layers>
					<Layer level="ARTWORK">
						<FontString name="$parentTitle" inherits="GameFontNormal" maxLines="1" hidden="false" justifyH="LEFT" justifyV="MIDDLE" text="Daily Suggestions" parentKey="title">
							<Anchors>
								<Anchor point="TOP" y="-13"/>
							</Anchors>
						</FontString>
						
					</Layer>
				</Layers>
				
				<Frames>
					<Button parentKey="b3" inherits="LOLIB_SuggestionTemplate" id="3">
						<Anchors>
							<Anchor point="BOTTOM" relativePoint="BOTTOM" y="5"/>
						</Anchors>
					</Button>
					<Button parentKey="b2" inherits="LOLIB_SuggestionTemplate" id="2">
						<Anchors>
							<Anchor point="BOTTOM" relativeKey="$parent.b3" relativePoint="TOP"/>
						</Anchors>
					</Button>
					<Button parentKey="b1" inherits="LOLIB_SuggestionTemplate" id="1">
						<Anchors>
							<Anchor point="BOTTOM" relativeKey="$parent.b2" relativePoint="TOP"/>
						</Anchors>
					</Button>
				</Frames>
			</Frame>
			
			<Button name="$parentOptionsButton" inherits="UIMenuButtonStretchTemplate" text="">
				<Size x="35" y="22"/>
				<Anchors>
					<Anchor point="TOPRIGHT" x="-15" y="-35"/>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<Texture parentKey="gear" file="Interface\Worldmap\Gear_64Grey">
							<Size x="16" y="16"/>
							<Anchors>
								<Anchor point="LEFT" relativeKey="$parent.Left" relativePoint="LEFT" x="5"/>
							</Anchors>
						</Texture>
						<Texture parentKey="Icon" file="Interface\ChatFrame\ChatFrameExpandArrow">
							<Size x="10" y="12"/>
							<Anchors>
								<Anchor point="RIGHT" relativeKey="$parent.Right" relativePoint="RIGHT" x="-5"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<HighlightTexture file="Interface\BUTTONS\UI-Common-MouseHilight" alphaMode="ADD"/>
				<Scripts>
					<OnClick> 
						PlaySound("igMainMenuOptionCheckBoxOn");
						ToggleDropDownMenu(1, nil, LoreLibraryCoreOptionsDropDown, "LoreLibraryCoreOptionsButton", -40, 0);
					</OnClick>	
				</Scripts>						
			</Button>
			<Frame name="$parentOptionsDropDown" inherits="UIDropDownMenuTemplate" />
			
		</Frames>

		<Scripts>
			<OnLoad>
				self:SetClampedToScreen(true);
				self.TitleText:SetText("Lore Library");
				self:RegisterForDrag("LeftButton");
				self:SetScript("OnDragStart", self.StartMoving );
				self:SetScript("OnDragStop", self.StopMovingOrSizing);
				SetPortraitToTexture(LoreLibraryCorePortrait, "Interface\\ICONS\\INV_Misc_Book_07");
				UIPanelWindows["LoreLibraryCore"] = { area = "left", pushable = 4 }
			</OnLoad>
		</Scripts>
	</Frame>
	
	<Frame name="LoreLibraryList" parent="LoreLibraryCore">
		<Size y="541"/>
		<Anchors>
			<Anchor point="BOTTOMLEFT" x="0" y="0"/>
			<Anchor point="BOTTOMRIGHT" x="0" y="0"/>
		</Anchors>
		
		
		
		<Frames>
			<Frame name="$parentDisplay" inherits="LOLIB_InsetTemplate">
				<Size x="414"/>
				<Anchors>
					<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" y="4" x="-6"/>
					<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-6" y="5"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						LoreLibraryListDisplayBg:Hide();
					</OnLoad>
				</Scripts>
				
				<Layers>
					<Layer level="BACKGROUND">
						<Texture name="$parentParchmentBg" file="Interface\AddOns\LoreLibrary\Images\QuestBG">
							<Anchors>
								<Anchor point="TOPLEFT" x="4" y="-4"/>
								<Anchor point="BOTTOMRIGHT" x="-4" y="3"/>
							</Anchors>
							<TexCoords left="0" right="0.587890625" top="0" bottom="0.65625"/>
						</Texture>
					</Layer>
					<Layer level="ARTWORK">
						<FontString name="$parentTitle" inherits="QuestTitleFont" justifyH="CENTER" parentKey="title">
							<Size y="40"/>
							<Anchors>
								<Anchor point="TOPLEFT" x="60" y="-25"/>
								<Anchor point="TOPRIGHT" x="-60" y="-25"/>
							</Anchors>
							<Color r="0" g="0" b="0"/>
						</FontString>
					</Layer>
				</Layers>
				
				<Frames>
					
					<SimpleHTML name="$parentPageText" parentKey="pageText">
						<Size x="280" y="420"/>
						<Anchors>
							<Anchor point="TOP" x="0" y="-75"/>
						</Anchors>
						<FontString inherits="QuestFont"/>
					</SimpleHTML>
					
					<Frame parentKey="sources" inherits="LOLIB_SourceContainerTemplate" hidden="true">
						<Anchors>
							<Anchor point="TOPLEFT" relativeTo="$parentPageText" relativePoint="TOPLEFT" x="5" y="-45"/>
							<Anchor point="BOTTOMRIGHT" relativeTo="$parentPageText" relativePoint="BOTTOMRIGHT"/>
						</Anchors>
						<Frames>
							<Frame name="LoreLibraryLostPages">
								<Size y="100"/>
								<Anchors>
									<Anchor point="TOPLEFT" relativeKey="$parent.s1" relativePoint="BOTTOMLEFT" y="-10"/>
									<Anchor point="TOPRIGHT" relativeKey="$parent.s1" relativePoint="BOTTOMRIGHT" y="-10"/>
								</Anchors>
								
								<Layers>
									<Layer level="BACKGROUND">
										<Texture file="Interface\Garrison\GarrisonMissionTypeIcons" parentKey="pageIcon">
											<Size x="56" y="56"/>
											<Anchors>
												<Anchor point="BOTTOMRIGHT" x="-60"/>
											</Anchors>
											<TexCoords left="0" right="0.12890625" top="0.775390625" bottom="0.90234375"/>
										</Texture>
									</Layer>
									<Layer level="ARTWORK">
										<FontString inherits="GameFontBlack" justifyH="CENTER" maxLines="2" parentKey="info" text="You can use a lost page\nto unlock this lore.">
											<Anchors>
												<Anchor point="TOPLEFT" x="5" y="-15"/>
												<Anchor point="TOPRIGHT" x="-5" y="-15"/>
											</Anchors>
										</FontString>
										<FontString inherits="GameFontBlack" justifyH="LEFT" maxLines="5" parentKey="content" text="">
											<Anchors>
												<Anchor point="BOTTOMLEFT" x="60" y="5"/>
											</Anchors>
										</FontString>
									</Layer>
								</Layers>
								
								<Frames>
									<Button parentKey="button">
										<Size x="32" y="32"/>
										<NormalTexture file="Interface\PETBATTLES\PetBattle-LockIcon" parentKey="normal"/>
										<PushedTexture file="Interface\PETBATTLES\PetBattle-LockIcon" parentKey="pushed"/>
										<DisabledTexture file="Interface\PETBATTLES\PetBattle-LockIcon"  parentKey="disabled"/>
										<HighlightTexture file="Interface\PETBATTLES\PetBattle-LockIcon" alphaMode="ADD"/>
										<Anchors>
											<Anchor point="BOTTOMLEFT" relativeKey="$parent.pageIcon" x="-5" y="-5"/>
										</Anchors>
										<Scripts>
											<OnLoad> 
												self.disabled:SetDesaturated(true);
												self.pushed:SetPoint("TOPLEFT", self, "TOPLEFT", 1, -1);
												self.pushed:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1);
											</OnLoad>	
											<OnEnter>
												GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
												if (self:IsEnabled()) then
													GameTooltip:SetText("Use a lost page to unlock this lore.");
												else
													GameTooltip:SetText("You have no lost pages available.");
												end
											</OnEnter>
											<OnLeave>
												GameTooltip:Hide();
											</OnLeave>
										</Scripts>	
									</Button>
								</Frames>
							</Frame>
						</Frames>
					</Frame>
				
					
				
					<Frame name="$parentNav" parentKey="navigation" hidden="true">
						<Size>
							<AbsDimension x="100" y="50"/>
						</Size>
						<Anchors>
							<Anchor point="BOTTOMRIGHT" relativeTo="$parent">
								<Offset>
									<AbsDimension x="-20" y="12"/>
								</Offset>
							</Anchor>
						</Anchors>
					
						<Layers>
							<Layer level="OVERLAY">
								<FontString name="$parentText" inherits="GameFontBlack" justifyH="RIGHT" parentKey="text" text="Page 1">
									<Size>
										<AbsDimension x="102" y="0"/>
									</Size>
									<Anchors>
										<Anchor point="BOTTOMRIGHT">
											<Offset>
												<AbsDimension x="-79" y="12"/>
											</Offset>
										</Anchor>
									</Anchors>
									<Color r="0.25" g="0.12" b="0"/>
								</FontString>
							</Layer>
						</Layers>
						<Frames>
							<Button name="$parentPrev" parentKey="prev">
								<Size>
									<AbsDimension x="32" y="32"/>
								</Size>
								<Anchors>
									<Anchor point="BOTTOMRIGHT" relativeTo="$parent">
										<Offset>
											<AbsDimension x="-35" y="0"/>
										</Offset>
									</Anchor>
								</Anchors>
								<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up" parentKey="normal"/>
								<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
								<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Disabled"  parentKey="disabled"/>
								<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
							</Button>
							<Button name="$parentNext" parentKey="next">
								<Size>
									<AbsDimension x="32" y="32"/>
								</Size>
								<Anchors>
									<Anchor point="BOTTOMRIGHT">
										<Offset>
											<AbsDimension x="0" y="0"/>
										</Offset>
									</Anchor>
								</Anchors>
								<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up" parentKey="normal"/>
								<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Down"/>
								<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Disabled" parentKey="disabled"/>
								<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
							</Button>
						</Frames>
					</Frame>
				</Frames>
				
			</Frame>
			
			<Frame name="$parentInsetLeft" inherits="InsetFrameTemplate" parentKey="insetLeft">
				<Size x="260"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPLEFT" y="4" x="4"/>
					<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="4" y="5"/>
				</Anchors>
			</Frame>
			
			<ScrollFrame name="$parentScrollFrame" parentKey="scrollFrame" inherits="HybridScrollFrameTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentInsetLeft" x="3" y="-34"/>
					<Anchor point="BOTTOMRIGHT" relativeTo="$parentInsetLeft" x="-2" y="5"/>
				</Anchors>
				<Frames>
					<Slider name="$parentScrollBar" inherits="HybridScrollBarTrimTemplate" parentKey="scrollBar">
						<Anchors>
							<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" x="4" y="19"/>
							<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" x="4" y="11"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								self.trackBG:Show();
								self.trackBG:SetVertexColor(0, 0, 0, 0.75);
							</OnLoad>
						</Scripts>
					</Slider>
				</Frames>
			</ScrollFrame>
			
			<Frame name="$parentFavoriteMenu" inherits="UIDropDownMenuTemplate" enableMouse="true" parentKey="favoriteMenu"/>
			
			<EditBox parentKey="searchBox" inherits="SearchBoxTemplate" letters="40">
				<Size x="145" y="20"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeKey="$parent.insetLeft"  x="15" y="-9"/>
				</Anchors>
			</EditBox>
			
			<Button name="$parentFilterButton" inherits="UIMenuButtonStretchTemplate" text="FILTER">
				<Size x="93" y="22"/>
				<Anchors>
					<Anchor point="TOPRIGHT" relativeKey="$parent.insetLeft" x="-5" y="-9"/>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<Texture parentKey="Icon" file="Interface\ChatFrame\ChatFrameExpandArrow">
							<Size x="10" y="12"/>
							<Anchors>
								<Anchor point="RIGHT" relativeKey="$parent.Right" relativePoint="RIGHT" x="-5"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<Scripts>
					<OnClick> 
						PlaySound("igMainMenuOptionCheckBoxOn");
						ToggleDropDownMenu(1, nil, LoreLibraryListFilterDropDown, "LoreLibraryListFilterButton", 74, 15);
					</OnClick>	
				</Scripts>						
			</Button>
			<Frame name="$parentFilterDropDown" inherits="UIDropDownMenuTemplate" />
			
		</Frames>
		<Layers>
		
		</Layers>
	</Frame>

	<Frame name="LoreLibraryMap" toplevel="false" parent="WorldMapDetailFrame" enableMouse="false" hidden="false">
		<Anchors>
			<Anchor point="TOPLEFT"/>
			<Anchor point="BOTTOMRIGHT"/>
		</Anchors>
		<Frames>
			<StatusBar name="$parentProgressBar" inherits="LOLIB_ProgressBarTemplate" parentKey="progressBar">
			<Size x="100" y="13"/>
			<Anchors>
				<Anchor point="BOTTOMLEFT" x="10" y="10"/>
			</Anchors>
			<Layers>
				<Layer level="OVERLAY">
					<Texture parentKey="border" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder">
						<Size x="104" y="29" />
						<Anchors>
							<Anchor point="LEFT" x="-3" y="0"/>
						</Anchors>
					</Texture>
				</Layer>
			</Layers>
			<Frames>
				<Button name="$parentOptionsButton" parentKey="button">
					<Anchors>
						<Anchor point="TOPLEFT"/>
						<Anchor point="BOTTOMRIGHT"/>
					</Anchors>
					<Layers>
						<Layer level="ARTWORK">
							<Texture parentKey="Icon" file="Interface\ChatFrame\ChatFrameExpandArrow">
								<Size x="10" y="12"/>
								<Anchors>
									<Anchor point="RIGHT" relativeKey="$parent.Right" relativePoint="RIGHT" x="-5" y="2"/>
								</Anchors>
							</Texture>
						</Layer>
					</Layers>
					<Scripts>
						<OnLoad>
							self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
						</OnLoad>
					</Scripts>						
				</Button>
				<Frame name="LolibOptionDropDown" inherits="UIDropDownMenuTemplate" />
				<HighlightTexture atlas="PetList-ButtonHighlight">
					<Color r="1" g="1" b="1" a="1"/>
				</HighlightTexture>
			</Frames>
			
		</StatusBar>
		
		<Frame name="$parentPoI" parentKey="PoI">
			<Size x="25" y="25"/>
			<Anchors>
				<Anchor point="CENTER"/>
			</Anchors>
			<Layers>
				<Layer level="OVERLAY">
					<Texture parentKey="glow" file="Interface\MINIMAP\Ping\ping4" alphaMode="ADD">
						<Size x="50" y="50"/>
						<Anchors>
							<Anchor point="CENTER"/>
						</Anchors>
					</Texture>
				</Layer>
				<Layer level="ARTWORK">
					<Texture parentKey="icon" file="Interface\AddOns\LoreLibrary\Images\icon_NPC" />
				</Layer>
			</Layers>
			
			<Scripts>
				<OnEnter>
					GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
					if (self.lore) then
						GameTooltip:SetText(self.lore.title);
					end
				</OnEnter>
				<OnLeave>
					GameTooltip:Hide();
				</OnLeave>
			</Scripts>
		</Frame>
		</Frames>
	</Frame>
	
	<Frame name="LoreLibraryUnlockPopup" toplevel="true" parent="ItemTextScrollFrame" enableMouse="false" hidden="true">
		<Size>
			<AbsDimension x="210" y="50"/>
		</Size>
		
		<Anchors>
			<Anchor point="BOTTOM" y="20"/>
		</Anchors>
		
		<Layers>
			<Layer level="BACKGROUND">
				<Texture parentKey="BGTL" file="Interface\Garrison\GarrisonMissionUI2">
					
					<TexCoords left="0.423828125" right="0.6513671875" top="0.6142578125" bottom="0.6845703125" />
				</Texture>
			</Layer>
			<Layer level="ARTWORK">
				<FontString name="$parentTitle" inherits="GameFontNormal" maxLines="1" justifyH="CENTER" justifyV="MIDDLE" parentKey="title" text="This is a title right here but longer">
					<Size y="10"/>
					<Anchors>
						<Anchor point="TOPLEFT" x="13" y="-11"/>
						<Anchor point="RIGHT" x="-13"/>
					</Anchors>
				</FontString>
				<FontString name="$parentSubText" inherits="GameFontWhite" maxLines="1" justifyH="CENTER" justifyV="MIDDLE" parentKey="text" text="Added to your library.">
					<Anchors>
						<Anchor point="BOTTOM" y="11"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<Frames>
			<Frame parentKey="suggestion" hidden="true">
				<Size x="150" y="17"/>
				<Anchors>
						<Anchor point="TOP" relativePoint="BOTTOM" y="6"/>
					</Anchors>
				<Layers>
					<Layer level="BACKGROUND">
						<Texture parentKey="BGTL" file="Interface\Garrison\GarrisonMissionUI2">
							<TexCoords left="0.423828125" right="0.6513671875" top="0.6242578125" bottom="0.6845703125" />
							<Color r="0.75" g="0.75" b="0.75" a="1" />
						</Texture>
					</Layer>
					<Layer level="ARTWORK">
						<FontString name="$parentTitle" inherits="GameFontNormalSmall" maxLines="1" justifyH="CENTER" justifyV="MIDDLE" parentKey="title" text="Suggestion completed">
							<Size c="120" y="10"/>
							<Anchors>
								<Anchor point="TOP" y="-2"/>
							</Anchors>
							<Color r="0.9" g="0.75" b="0" a="1" />
						</FontString>
					</Layer>
				</Layers>
			</Frame>
		</Frames>
	</Frame>
 </Ui>