
  var currentDiv = "TBD";
  function getPageSize(){
    var xScroll, yScroll;
	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;
	}
	var windowWidth, windowHeight;
	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.body) { // 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;
	}
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
  }
  function createOverlay(){
    var overDiv = document.createElement("div");
  	overDiv.style.position = "absolute";
	  overDiv.style.top = "0px";
		overDiv.style.left = "0px";
		overDiv.style.width = getPageSize()[0] + "px";
		overDiv.style.height = getPageSize()[1] + "px";
		overDiv.style.background = "#000000";
		overDiv.style.opacity = "0.4";
		overDiv.style.filter = "alpha(opacity=10)";
		overDiv.style.display = "none";
		document.getElementsByTagName("body").item(0).appendChild(overDiv);
		overDiv.setAttribute("id", "overlayDiv");
  }
  function showOverlay(contentDivID, leftPos, topPos) {
	toggleDropdowns(false);
    currentDiv = contentDivID;
	document.getElementById("overlayDiv").style.display = "block";
	document.getElementById(contentDivID).style.zIndex = 10000;
	document.getElementById(contentDivID).style.position = "absolute";
	document.getElementById(contentDivID).style.left = leftPos;
	document.getElementById(contentDivID).style.top = topPos;
	document.getElementById(contentDivID).style.display = "block";
  }
  function hideOverlay() {
	toggleDropdowns(true);
    if(currentDiv) { document.getElementById(currentDiv).style.display = "none"; }
	  document.getElementById("overlayDiv").style.display = "none";
  }
  function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	while (offsetTrail) {
	  offsetLeft += offsetTrail.offsetLeft;
	  offsetTop += offsetTrail.offsetTop;
	  offsetTrail = offsetTrail.offsetParent;
	}
	if (navigator.userAgent.indexOf("Mac") != -1 &&
	  typeof document.body.leftMargin != "undefined") {
	  offsetLeft += parseInt(document.body.leftMargin);
	  offsetTop += parseInt(document.body.topMargin);
	}
	return {left:offsetLeft, top:offsetTop};
  }
  function prepareOverlay(overlayDivId, fromLeft, fromTop, overlayCallerId) {
    fromLeft = getElementPosition(overlayCallerId).left + fromLeft;
	fromTop  = getElementPosition(overlayCallerId).top + fromTop;
	showOverlay(overlayDivId, fromLeft, fromTop);
  }
  function toggleDropdowns(showBoolean) {
    for(var i=0; i<document.forms.length; i++) {
	  for(var j=0; j<document.forms[i].elements.length; j++) {
	    if(document.forms[i].elements[j].type.indexOf("select")!=-1) {
		  document.forms[i].elements[j].style.visibility = (showBoolean==true)?'visible':'hidden';
		}
	  }
	}
  }

  function getPageScroll(){
	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.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
  }

  function computePosition(id) {
    var arrayPageScroll = getPageScroll();
    iframeHeight = document.getElementById(id).height;
    iframeWidth = document.getElementById(id).width;
    iframefromTop = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - iframeHeight) / 2));
    iframefromLeft = (((arrayPageSize[0] - 20 - iframeWidth) / 2));
  }

