If nobody gets why it works by tomorrow, I'll post the answer. Somebody will get it, though, I bet. Have fun!

http://www.mc.hik.se/~mid95wem/trams/magic/welcome.html