That's a really neat-o trick!
Seriously though, it's probably (more than likely) a layout issue, and not having anything to do with the PHP code itself... Take out the stylesheets first, and see if the problem persists.
These lines here:
<link rel="stylesheet" href="css/default.css" type="text/css">
<link rel="stylesheet" href="css/dossier.css" type="text/css">
<link rel="stylesheet" href="css/menubar.css" type="text/css">
Also, take out the script blocks pertaining to the menubar.js and menuitems.js...
Basically, get it to pure HTML and PHP and see if the problem goes away... If it does go away, start putting things back in one by one, until the problem resurfaces, and then focus on that source of your problem...
If you have HTML/PHP only, and the problem is still there, then all I can say is good luck 😉!