The problem with z-index is that it is relative. By moving the div so it's a child of the body tag, it will have a relative z-index to elements that are also children of the body tag and not of the body tag's siblings' children.
See
http://stackoverflow.com/a/7482870 for a good explanation.