I'll say you need help ... (sorry, couldn't help myself)
First of all, big hint: don't put links (URLs) in [code][/code] tags. Use the link facility for that (the button with the blue globe and yellow link, or just use [url=<url>][/url]. That link was too damned long.
What was that thing, anyhow? I actually did get a simulator window to pop up, but I have no idea what to do with it.
You certainly cannot connect a flip-flop to the AC coming from a power circuit. They run (usually) on 5 volts DC.
Where do you get 40 Hz from? Power line frequency is 50 or 60 Hz.
Anyhow, I'm sure someone will be along shortly to help you with those flip-flops and such.