-- Get references to the DockShelf and its children

local fldr = script.Parent.Parent
local Pop = script.Parent.Parent.Parent.Popular
local Trcks = script.Parent.Parent.Parent.Tracks
local Serch = script.Parent.Parent.Parent.SearchTracks
local SerchVal = script.Parent.Parent.Parent.SearchActive
local btn = script.Parent

local function toggleWindow()
	if SerchVal.Value == true then
		-- Close the window by tweening back to the button position and size
		fldr:TweenSizeAndPosition(
			UDim2.new(1, 0, 0.022, 0),
			UDim2.new(0.0,0,0.978,0),
			'Out',
			'Quad',
			0.4,
			false,
			function()
			fldr.Visible = false
			Pop.Visible = false
			Trcks.Visible = false
			Serch.Visible = true
			end
		)
	elseif SerchVal.Value == false then
		fldr:TweenSizeAndPosition(
			UDim2.new(1, 0, 0.022, 0),
			UDim2.new(0.0,0,0.978,0),
			'Out',
			'Quad',
			0.4,
			false,
			function()
				fldr.Visible = false
				Pop.Visible = true
				Trcks.Visible = true
				Serch.Visible = false
			end
		)
	end
end
