
	var WindowID = "Window";
    var innerWindowID = "innerWindow";
	var WindowDiv;
	var innerWindowDiv;
	var contentHeight=20;
	
	var imgClassName = '';
	
	window.onload = WindowInitialize;
	

	function WindowGetPageScroll(){
		var yScroll;
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
		} else if (document.bo) {// all other Explorers
			yScroll = document.body.scrollTop;
		}
		arrayPageScroll = new Array('',yScroll) 
		return arrayPageScroll;
	}
	function WindowGetPageSize(){
		var xScroll, yScroll;
		var windowWidth, windowHeight;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.bo) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
		WindowArrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return WindowArrayPageSize;
	}
	function WindowInitialize(){
		var WindowArrayPageSize = WindowGetPageSize();
		var arrayPageScroll = WindowGetPageScroll();
		if (!document.getElementById(WindowID)) {
			var WindowNewNode = document.createElement("div");
			WindowNewNode.setAttribute("id", WindowID);
			WindowNewNode.setAttribute("class", "outerDIV");
			WindowNewNode.setAttribute("style", "cursor:pointer;visibility:visible;text-align:center;clear:both");
			document.body.appendChild(WindowNewNode);
		}		
		WindowDiv = document.getElementById(WindowID);
		WindowDiv.className='outerDIV';
		WindowDiv.style.position = "absolute";
		WindowDiv.style.left = "0px";
		WindowDiv.style.top = "0px";
		WindowDiv.style.height =WindowArrayPageSize[1]+'px';
		WindowDiv.style.width ='100%';
		WindowDiv.style.visibility = "hidden";
		WindowDiv.style.display = "none";
		WindowDiv.style.zIndex = 10000;
		WindowDiv.onclick='return false';
		if (!document.getElementById(innerWindowID)) {
			var WindowNewNode = document.createElement("div");
			WindowNewNode.setAttribute("id", innerWindowID);
			WindowNewNode.setAttribute("class", "innerDIV");
			WindowNewNode.setAttribute("style", "cursor:pointer;visibility:visible;text-align:center;clear:both");
			document.body.appendChild(WindowNewNode);
		}		
		innerWindowDiv = document.getElementById(innerWindowID);
		innerWindowDiv.className='innerDIV';
		innerWindowDiv.onlick='return false';
		innerWindowDiv.style.position = "absolute";
		innerWindowDiv.style.left = '0px';
		innerWindowDiv.style.width = '100%';
		innerWindowDiv.style.top = (arrayPageScroll[1] + ((WindowArrayPageSize[3] - 35 - contentHeight) / 2) + 'px');
		innerWindowDiv.style.visibility = "hidden";
		innerWindowDiv.style.display = "none";
		innerWindowDiv.style.zIndex = 10000;
		if (!document.getElementById('img_loader')) {
			var innerImg = document.createElement("img");
			innerImg.setAttribute("id", 'img_loader');
			innerImg.setAttribute("style", "display:none;margin:0pt auto;");
			innerImg.setAttribute("src", imgSrc);
			innerWindowDiv.appendChild(innerImg);
		}	
		hideSelectBoxes();

	}
	function displayLoader(){
		WindowInitialize();
		var WindowDiv = document.getElementById(WindowID);
		WindowDiv.style.visibility = "visible";
		WindowDiv.style.display = "block";
		var innerWindowDiv = document.getElementById(innerWindowID);
		innerWindowDiv.style.visibility = "visible";
		innerWindowDiv.style.display = "block";
		var imgObj = document.getElementById('img_loader');
		imgObj.style.display = 'block';
		hideSelectBoxes();
	}
	function hideLoader(){
		var WindowDiv = document.getElementById(WindowID);
		WindowDiv.style.visibility = "hidden";
		WindowDiv.style.display = "none";
		var innerWindowDiv = document.getElementById(innerWindowID);
		innerWindowDiv.style.visibility = "hidden";
		innerWindowDiv.style.display = "none";
		var imgObj = document.getElementById('img_loader');
		imgObj.style.display = 'none';
		displaySelectBoxes();
	}

	function hideSelectBoxes() {
		for(var i = 0; i < document.forms.length; i++) {
			for(var e = 0; e < document.forms[i].length; e++){
				if(document.forms[i].elements[e].tagName == "SELECT") {
					document.forms[i].elements[e].style.visibility="hidden";
				}
			}
		}
	}
	function displaySelectBoxes() {
		for(var i = 0; i < document.forms.length; i++) {
			for(var e = 0; e < document.forms[i].length; e++){
				if(document.forms[i].elements[e].tagName == "SELECT") {
				document.forms[i].elements[e].style.visibility="visible";
				}
			}
		}
	}
