Originally done as explained in this post, and then updated with better code. This is 3rd incarnation, which works well in IE7 too. The code is now much simpler, especially considering IE6-only tweaks.