//Global Variable
var overlays;
var isAutoClose = false;
//Function
function creatingOverlays () {
	//if (!document.getElementById("lightbox")) {
		overlays = document.createElement("div");
		var ie = document.all;
		if (ie) {
//			overlays.attributes("id").value = "lightBox";
//			overlays.attributes("class").value = "IlightBox";
            overlays.id = "lightBox";
			overlays.className = "IlightBox";
		}
		else {
			overlays.setAttribute("id","lightBox");
			overlays.setAttribute("class","IlightBox");
			
		}
		
		if(document.getElementById("lightBox") != null)
		{
		   overlays.style.zIndex = "11";
		   overlays.style.background = "none";
	    }
		
		document.body.appendChild(overlays);
		if( isAutoClose ){
		    overlays.onclick = function(){
		        hidePopUp();
		    }		        
		}
	//}
}

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
    if(overlays == null) return;
    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;
    }
    
    if (overlaysHeight < $(document).height()) {
        overlaysHeight = $(document).height(); //get the Height of the Screen
    }
	
    //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";
    //overlays.style.height = 10000 + "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";
}
