function findLivePageWidth() {
	if (window.innerWidth) {
		return window.innerWidth;
	}
	if (document.body.clientWidth) {
		return document.body.clientWidth;
	}
	return (null);
}

function findLivePageHeight () {
	if (window.scrollHeight) {
		return window.scrollHeight;
	}
	if (document.body.scrollHeight) {
		return document.body.scrollHeight;
	}
	return (null);
}

function findLiveScrollPosition () {
	if (window.scrollHeight) {
		return window.pageYOffset; //window.scrollHeight - 
	}
	if (document.body.scrollHeight) {
		return document.body.scrollTop; //document.body.scrollHeight - 
	}
	return (null);
}

function initOverlay() {
	objectOverlay=document.getElementById('overlay');
	objectWindow=document.getElementById('overlayWindow');
	objectContent=document.getElementById('overlayContent');
}

function initOverlayNoClose() {
	objectOverlay=document.getElementById('overlay');
	objectWindow=document.getElementById('overlayWindowNoClose');
	objectContent=document.getElementById('overlayContent');
}

function showOverlay(evt, strHTML, overlayWidth) {
	objectContent.innerHTML=strHTML;
	
	livePageWidth 	= findLivePageWidth();
	livePageHeight  = findLivePageHeight();
	liveTopPosition = f_scrollTop() + 100; //findLiveScrollPosition();
		
	newLeft = (livePageWidth/2) - (overlayWidth/2) - 10;
	
	//position content window in current browser view
	objectWindow.style.left = newLeft + 'px';
	objectWindow.style.top =  liveTopPosition + 'px';
	
	//adjust overlay transparency to cover entire page
	objectOverlay.style.height = livePageHeight + 'px';
	
	objectWindow.style.display = 'block';
	objectOverlay.style.display = 'block';
}

function hideOverlay() {
	objectOverlay.style.display = 'none';	
	objectWindow.style.display = 'none';
}


function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}



