<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="ISync_MiniMapButton.lua"/>
	
	<Frame name="ISync_MiniMapButtonFrame" parent="Minimap" enableMouse="true" hidden="false" frameStrata="LOW">
		<Size>
			<AbsDimension x="32" y="32"/>
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" relativeTo="Minimap" relativePoint="RIGHT">
				<Offset>
					<AbsDimension x="2" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Frames>
			<Button name="ISync_MiniMapButton">
				<Size>
					<AbsDimension x="32" y="32"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="0" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<NormalTexture file="Interface\AddOns\ItemSync\images\ISync_ButtonUp"/>
				<PushedTexture file="Interface\AddOns\ItemSync\images\ISync_ButtonDown"/>
				<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
				<Scripts>
					<OnClick>
						if(ISync) then ISync:MiniMapButton_Toggle(); end
					</OnClick>
					<OnEnter>
						GameTooltip_SetDefaultAnchor(GameTooltip, UIParent);
						GameTooltip:SetText("ItemSync (V:"..ISYNC_VERSION..")");
					</OnEnter>
					<OnLeave>
						GameTooltip:Hide();
					</OnLeave>
				</Scripts>
			</Button>
		</Frames>
		<Scripts>
		</Scripts>
	</Frame>



	<Frame name="ISync_MiniMapOptionsFrame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="UIParent">
		<Size>
			<AbsDimension x="355" y="160"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
			<BackgroundInsets>
				<AbsInset left="11" right="12" top="12" bottom="11"/>
			</BackgroundInsets>
			<TileSize>
				<AbsValue val="32"/>
			</TileSize>
			<EdgeSize>
				<AbsValue val="32"/>
			</EdgeSize>
		</Backdrop>
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="ISync_MiniMapOptionsFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
					<Size>
						<AbsDimension x="256" y="64"/>
					</Size>
					<Anchors>
						<Anchor point="TOP">
							<Offset>
								<AbsDimension x="0" y="12"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
				<FontString inherits="GameFontNormal" text="ISYNC_BT_MINIMAP">
					<Anchors>
						<Anchor point="TOP" relativeTo="ISync_MiniMapOptionsFrameHeader">
							<Offset>
								<AbsDimension x="0" y="-14"/>
							</Offset>
						</Anchor>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>


  
  			<Frame name="ISync_MiniMapOptions_MiniMapButtonFrame" inherits="OptionFrameBoxTemplate">
  				<Size>
  					<AbsDimension x="335" y="80"/>
  				</Size>
  				<Anchors>
  					<Anchor point="CENTER" relativeTo="ISync_MiniMapOptionsFrame" relativePoint="CENTER">
  						<Offset>
  							<AbsDimension x="0" y="-15"/>
  						</Offset>
  					</Anchor>
  				</Anchors>
  				<Layers>
  					<Layer level="BACKGROUND">
						<FontString inherits="GameFontNormal" text="ISYNC_MINIMAPBUTTON_CHECKBUTTON">
							<Anchors>
								<Anchor point="TOPLEFT"> 
									<Offset>
										<AbsDimension x="30" y="-10"/>
									</Offset>
								</Anchor>
							</Anchors>
						</FontString>
  					</Layer>
  				</Layers>
  
  				<Frames>
  				
 					<CheckButton name="ISync_MiniMapOptions_MiniMapButtonFrame_CheckButton1" inherits="OptionsCheckButtonTemplate">
 						<Size>
 							<AbsDimension x="26" y="26"/>
 						</Size>
 						<Anchors>
 							<Anchor point="TOPLEFT">
 								<Offset>
 									<AbsDimension x="5" y="-5"/>
 								</Offset>
 							</Anchor>
 						</Anchors>
   						<Scripts>
   							<OnClick>
   								if(ISyncOpt and ISyncOpt.MiniMapButton_Show) then
   								
   									if(this:GetChecked()) then
   									
   										ISyncOpt.MiniMapButton_Show = 1;
   										
   										if(ISync and ISync.MiniMapButton_Init) then ISync:MiniMapButton_Init(); end
   										
 
 									else
 										ISyncOpt.MiniMapButton_Show = 0;
 										
 										if(ISync and ISync.MiniMapButton_Init) then ISync:MiniMapButton_Init(); end
   									end
   								
   								end
   							</OnClick>
   						</Scripts>
					</CheckButton>
					

					<Slider name="ISync_MiniMapButton_SliderButtonPos" inherits="OptionsSliderTemplate">
						<Size>
							<AbsDimension x="220" y="16"/>
						</Size>
						<Anchors>
							<Anchor point="TOP">
								<Offset>
									<AbsDimension x="0" y="-50" />
								</Offset>
							</Anchor>
						</Anchors>
						<Scripts>
							<OnLoad>
								if(not ISyncOpt) then ISyncOpt = { }; end
								if( not ISyncOpt.MiniMapButton_Loc) then ISyncOpt.MiniMapButton_Loc = 305; end
								
								getglobal(this:GetName().."Text"):SetText(ISYNC_MINIMAPBUTTON_SLIDERTEXT);
								getglobal(this:GetName().."High"):SetText();
								getglobal(this:GetName().."Low"):SetText();
								ISync_MiniMapButton_SliderButtonPos:SetMinMaxValues(0,360);
								ISync_MiniMapButton_SliderButtonPos:SetValueStep(1);
								
								ISync_MiniMapButton_SliderButtonPos:SetValue(ISyncOpt.MiniMapButton_Loc);
								
							</OnLoad>
							<OnValueChanged>
			
								ISyncOpt.MiniMapButton_Loc = ISync_MiniMapButton_SliderButtonPos:GetValue();
								
								if(ISync and ISync.MiniMapButton_UpdatePosition) then ISync:MiniMapButton_UpdatePosition(); end
								
							</OnValueChanged>
						</Scripts>
					</Slider>
			
					<Button name="ISync_Options_Regular_Help_MiniMapOptHelp" virtual="true" hidden="false">
						<Size>
							<AbsDimension x="18" y="16"/>
						</Size>
						<Anchors>
							<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT">
								<Offset>
									<AbsDimension x="-8" y="-8"/>
								</Offset>
							</Anchor>
						</Anchors>
						<Layers>
							<Layer level="OVERLAY">
								<FontString name="$parentText" inherits="GameFontNormal" justifyH="RIGHT" text="[?]">
									<Anchors>
										<Anchor point="RIGHT">
											<Offset>
												<AbsDimension x="0" y="0"/>
											</Offset>
										</Anchor>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
						<Scripts>
							<OnEnter>
								getglobal(this:GetName() .. "Text"):SetTextColor(1, 1, 0);
								GameTooltip:SetOwner(this, "ANCHOR_LEFT");
								GameTooltip:SetText(ISYNC_MINIMAPBUTTON_TOOLTIP, 1, 0.72, 0, nil, 1);
								GameTooltip:Show();
							</OnEnter>
							<OnLeave>
								getglobal(this:GetName() .. "Text"):SetTextColor(1, 0.82, 0);
								GameTooltip:Hide();						
							</OnLeave>
						</Scripts>
  					</Button>
  					
  				</Frames>
  
  				<Scripts>
  					<OnLoad>
  						this:SetBackdropBorderColor(0.4, 0.4, 0.4);
  						this:SetBackdropColor(0.15, 0.15, 0.15);
  						getglobal(this:GetName().."Title"):SetText(ISYNC_MINIMAPBUTTON_HEADER);
  						
  					</OnLoad>
  				</Scripts>
  			</Frame>
  
			<Button name="ISYNC_MiniMapOptions_Close" inherits="UIPanelCloseButton">
				<Anchors>
					<Anchor point="TOPRIGHT" relativeTo="ISync_MiniMapOptionsFrame" relativePoint="TOPRIGHT">
						<Offset>
							<AbsDimension x="-5" y="-7"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Button>
			
		</Frames>
		<Scripts>
 				<OnShow>
 				
						if(not ISyncOpt) then ISyncOpt = { }; end
						if( not ISyncOpt.MiniMapButton_Show) then ISyncOpt.MiniMapButton_Show = 1; end
						if( not ISyncOpt.MiniMapButton_Loc) then ISyncOpt.MiniMapButton_Loc = 305; end



						--show minimap button
						if(ISyncOpt and ISyncOpt.MiniMapButton_Show and ISyncOpt.MiniMapButton_Show == 1) then

							getglobal("ISync_MiniMapOptions_MiniMapButtonFrame_CheckButton1"):SetChecked(1);

						elseif(ISyncOpt and ISyncOpt.MiniMapButton_Show and ISyncOpt.MiniMapButton_Show == 0) then

							getglobal("ISync_MiniMapOptions_MiniMapButtonFrame_CheckButton1"):SetChecked(0);
						end
						


 				</OnShow>
				<OnMouseDown> this:StartMoving();  </OnMouseDown>
				<OnMouseUp>  this:StopMovingOrSizing(); </OnMouseUp>
				<OnDragStop> this:StopMovingOrSizing(); </OnDragStop>
		</Scripts>
	</Frame>
	
	

</Ui>
