-- preload our two static images here

Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=58247550")
Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=58247679")

function waitForChild(parent, child)
	while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
end

local screen = script.Parent

local staticDecal = Instance.new("Decal")
staticDecal.Name = "Static"
staticDecal.Texture = "http://www.roblox.com/asset/?id=58247550"
staticDecal.Face = "Left"

waitForChild(screen, "ClickDetector")
local clickDetector = screen.ClickDetector

function flicker(timeToFlicker)
	local startTime = tick()
	while tick() - startTime < timeToFlicker do
		staticDecal.Texture = "http://www.roblox.com/asset/?id=58247679"
		wait(flickerSpeed)
		staticDecal.Texture = "http://www.roblox.com/asset/?id=58247550"
		wait(flickerSpeed)
	end
end

local debounce = false
function tvOn()
	if debounce then return end
	debounce = true

	-- should take care of one little data persistance caveat...
	static = screen:FindFirstChild("Static")
	if static then static:Remove() end

	staticDecal.Parent = screen

	flicker(3)

	staticDecal.Parent = nil
	debounce = false
end

clickDetector.MouseClick:connect(tvOn)
