Moved javascript to just before the end of the body tag