/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var page_loaded, startTime, timerId;
//if (document.getElementById || document.all) window.onload = initInfoLyr;
function initInfoLyr() {
  page_loaded = true;
  var screenLyr = (document.getElementById)? document.getElementById('infoDiv'): (document.all)? document.all['infoDiv']: null;
  if ( screenLyr && typeof screenLyr.innerHTML != "undefined" ) 
    if (screenLyr.style) screenLyr.style.visibility = "visible";
  displayInfo('infoDiv','');	// show message
}

function displayInfo(id, sHtml) {
	//if (!page_loaded) return; 
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: null;
  if (!el) return;
  if (sHtml == '') startTimer();
	else if (timerId) clearInterval(timerId);
  if (typeof el.innerHTML != "undefined") el.innerHTML = '<div class="info">' + sHtml + '</div>';
}

// called from displayInfo when mouseouts write empty string
function startTimer() {
	startTime = new Date().getTime();
	timerId = setInterval("checkElapsed()",500);
}

function checkElapsed() {
	var elapsed = new Date().getTime();
	// show default message if screen blank for 2 seconds
	if ( elapsed - startTime > 2000 ) {
		displayInfo('infoDiv',dfltMsg);
		clearInterval(timerId);
	} 
}