Hello, I am having an issue with PHP, Javasript, and CSS seemingly conflicting with each other. In my page, I have a Javascript function which is called in the body onload function to display a popup which darkens and deactivates the underlying html and displays a message based upon a code sent to the Javascript function.
Code:
var msgSuccess="<div id='overlay'><h1>Your form has been submitted by email to the proper recipients.</h1> <h2>Thank you for using the Newsweb Radio Status monitor to make your submission.</h2></div><div class='darken'></div>";
var msgEmailError="<div id='overlay'><h1>An error occurred while attempting to send your error report!</h1> <h2>Please try to submit your form again. Sorry for the inconvenience.</h2></div><div class='darken'></div>";

function finish(code) {
	switch (code){
		case 1:
			fade("overlaycontainer",0,msgSuccess);
		case 3:
			fade("overlaycontainer",0,msgEmailError);
		default:
			var msgUnknownError="<div id='overlay'><h1>An unknown error has occurred! Error Code:" + code + "</h1> <h2>Please try to submit your form again. Sorry for the inconvenience.</h2></div><div class='darken'></div>";
			fade("overlaycontainer",0,msgUnknownError);
		}
}
The fade function simply adds the div to the form while increment the opacity over time to give the popup a fade in effect.

The CSS styles for darken and overlay are shown below.
Code:
#overlay{
	position: fixed;
	background-color:black;
	color: white;
	z-index: 4;
	width: 100%;
	top: 30%;
	left: 0;
	right: 0;
	text-align: center;
	opacity: 1;
}
.darken {
background-color: rgb(0, 0, 0);
opacity: 0.7; /* Safari, Opera */
-moz-opacity:0.7: /* FireFox */
filter: alpha(opacity=70); /* IE */
z-index: 3;
height: 100%;
width: 100%;
background-repeat:repeat;
position:fixed;
top: 0px;
left: 0px;
}
This USED to work perfectly fine until I added PHP script to my HTML page (now a php page). It seems that the PHP scripts on the page cause the popup to be overridden, with the result that the page is still deactivated (you can't click on anything), but the popup is not visible. It sometimes also appears for an instant then disappears again without affecting the page at all.

The popup is displayed based upon this HTML/PHP code
Code:
<body onload="setup();timeInfo(false);startTime('time');loadXMLConfigs();<?php if (isset($_SESSION['error']) && intval($_SESSION['error']) != 2){echo('finish('.$_SESSION['error'].');');session_destroy();}?>">
The PHP code only allows the popup to be displayed if the user has completely filled in the form.

I am sorry that this question is vague and complex, but any advice is appreciated. Thank You