//Global Variable
var overlays;

//Function
function creatingOverlays () {
	if (!document.getElementById("lightbox")) {
		overlays = document.createElement("div");
		var ie = document.all;
		if (ie) {
			overlays.attributes("id").value = "lightBox";
		}
		else {
			overlays.setAttribute("id","lightBox");
		}
		
		document.getElementById("outer").appendChild(overlays);
		//document.body.appendChild(overlays);
	}
}

function setOverlaysSize () {
    //JUST ENABLE THIS SCRIPT ONLY WHEN YOU WANT TO DISABLE THE VERTICAL-SCROLLBAR
    //disable scrollbar
    //var getBody = document.getElementsByTagName("body")[0];
    //var getHtml = document.getElementsByTagName("html")[0];
    //getBody.style.overflow = "hidden";
    //getHtml.style.overflow = "hidden";
    
    //Reset LightBox Size Value To Zero All To Remove ScrollBar To Get The Exactly Window Size
    overlays.style.width = 0 + "px";
    overlays.style.height = 0 + "px";

    var overlaysWidth = document.body.clientWidth; //get the width of the content in the body
    var overlaysHeight = document.body.clientHeight; //get the height of the content in the body
    
    //content height is wider than screen height
    if (overlaysHeight < document.documentElement.clientHeight) {
        overlaysHeight = document.documentElement.clientHeight; //get the Height of the Screen
    }
    //content height is longer than screen height
    else {
        overlaysHeight = document.body.clientHeight;
    }
	
    //content width is wider than screen width
    if (overlaysWidth < document.documentElement.clientWidth) {
        overlaysWidth = document.documentElement.clientWidth; //get the Width of the Screen
    }
    //content width is longer than screen width
    else {
        overlaysWidth = document.body.clientWidth;
    }
    //Set attribute for LightBox
    overlays.style.display = "block";
    overlays.style.width = overlaysWidth + "px";
    overlays.style.height = overlaysHeight + "px";
}
function setOverlaysPosition () {
    var screenWidth = document.documentElement.clientWidth;
    //Get the Scroll Top Position
    var ie = document.all; //If IE
    if (ie) {
        scrollLeft = document.documentElement.scrollLeft;
    }
    else {
        scrollLeft = window.pageXOffset;
    }
	
    if (overlays.clientWidth > document.documentElement.clientWidth) {
        scrollLeft = 0;
    }
	
	overlays.style.left = scrollLeft + "px";
}
