
function xClientHeight() {
 var xcwh;
 if (window.innerHeight) {
  xcwh=window.innerHeight; }
 else if (document.documentElement && document.documentElement.clientHeight) {
  xcwh=document.documentElement.clientHeight; }
 else if (document.body) {
  xcwh=document.body.clientHeight; }
 return xcwh;
};

function xClientWidth() {
 var xcww;
 if (window.innerWidth) {
  xcww=window.innerWidth; }
 else if (document.documentElement && document.documentElement.clientWidth) {
  xcww=document.documentElement.clientWidth; }
 else if (document.body) {
  xcww=document.body.clientWidth; }
 return xcww;
};

function getWindowSize() {
	ww=xClientWidth(); wh=xClientHeight();
};

function xDocSize() {
  var b=document.body,e=document.documentElement;
  var esw=0,eow=0,bsw=0,bow=0,esh=0,eoh=0,bsh=0,boh=0;
  if (e) {
    esw=e.scrollWidth;
    eow=e.offsetWidth;
    esh=e.scrollHeight;
    eoh=e.offsetHeight;
  }
  if (b) {
    bsw=b.scrollWidth;
    bow=b.offsetWidth;
    bsh=b.scrollHeight;
    boh=b.offsetHeight;
  }
  return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
};

function showLightbox() {
	var doc=xDocSize();
	var sel=document.getElementById("bluecover");
	sel.style.width=doc['w']+'px';
	sel.style.height=doc['h']+'px';
	sel.style.display='block';
	getWindowSize();
	sel=document.getElementById("lightbox");
	var xpos=Math.round((ww-594)/2);
	sel.style.left=xpos+'px';
	var ypos=Math.round((wh-494)/2);
	sel.style.top=ypos+'px';
	sel.style.display='block';
};

function hideLightbox() {
	var sel=document.getElementById("bluecover");
	sel.style.display='none';
	sel=document.getElementById("lightbox");
	sel.style.display='none';
};
