//Global Variables

var shadowCover; //Shadow Cover Div

//Add Shadow Cover.  It adds a div absolutely positioned over all controls on the web app.
function addShadowCover(shadowDepth, beforeTag, backgroundImage) {
    if (shadowDepth == null) {
        shadowDepth = 80;
    }
	shadowCover = document.createElement("div"); //create the div element
	if (backgroundImage == null) {
	    shadowCover.style.backgroundColor = "#000"; //set the backgroud color to plack
	    shadowCover.style.filter = "alpha(opacity=" + shadowDepth + ")";  //set the opacity for ie
	    shadowCover.style.opacity = "." + shadowDepth;  //set the opacity for other browsers
	}
	else {
	    shadowCover.style.background = "url(" + backgroundImage + ") repeat";
	}

	shadowCover.style.zIndex = "999";
	shadowCover.style.position = "fixed"; //set the div to fixed positioning
	if (navigator.userAgent.search("MSIE 6") >= 0) {
	    shadowCover.style.position = "absolute"; //set the div to absolute positioning
	}
	shadowCover.style.left = "0px";  //set left position to far left of screen
	shadowCover.style.top = "0px"; //set top position to the top of the screen
	shadowCover.style.width = document.body.scrollWidth + "px"; //set width to the full width of the web page
	shadowCover.style.height = document.body.scrollHeight + "px"; //set height to the full height of the web page
	if(beforeTag == null) { //if a before tag was not supplied
		document.body.appendChild(shadowCover); //insert the Shadow Cover as the last tag in the body
	}
	else {
		document.body.insertBefore(shadowCover, beforeTag); //insert the Shadow Cover before the supplied element
    }                                                       //Elements that are after the shadow cover
	                                                        //will show up on the page over the shadow cover

}

//Deletes the Shadow Cover Div from the page
function deleteShadowCover() {
	document.body.removeChild(shadowCover); //Delete the shadow cover from the page
}

