Add this to your HTML:
<div id="darkLayer" class="darkClass" style="display:none"></div>
And this to your CSS:
.darkClass
{
background-color: white;
filter:alpha(opacity=50); /* IE */
opacity: 0.5; /* Safari, Opera */
-moz-opacity:0.50; /* FireFox */
z-index: 20;
height: 100%;
width: 100%;
background-repeat:no-repeat;
background-position:center;
position:absolute;
top: 0px;
left: 0px;
}
And finally this to turn it off and on with JavaScript:
function dimOff()
{
document.getElementById("darkLayer").style.display = "none";
}
function dimOn()
{
document.getElementById("darkLayer").style.display = "";
}
Change the dimensions of the darkClass to suite your purposes.