//script for dsiplaying a html layer window for menus message boxes etc.

//detemermin line of the current browser
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;

var htmlWndIntervalCheckId = 0;
var bHideMenu = 1;

offsetX = 0;
offsetY = 20;

var htmlWndStyle="";

function initHTMLWnd()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) htmlWndStyle = document.theHTMLWndLayer;
    else if(ns6) htmlWndStyle = document.getElementById("theHTMLWndLayer").style;
    else if(ie4) htmlWndStyle = document.all.theHTMLWndLayer.style;
   
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      htmlWndStyle.visibility = "visible";
      htmlWndStyle.display = "none";
    }
  }
  
  htmlWndIntervalCheckId = 0;
  bHideMenu = 1;
}
function showHTMLWnd(thisLayer, x, y, fg, bg)
{
	hideHTMLWnd();
	clearHTMLWndCheck();
	
	//get innerHTML for the layer
	var content = thisLayer.innerHTML;
	
	//set default position of the contents
	if (!x) x=0;
	if (!y) y=0;
	
	htmlWndStyle.left = x;
	htmlWndStyle.top = y;
	
	//set default colors of the contents
	if(!fg) fg = "#777777";
	if(!bg) bg = "#FFFFFF";
	/*
	//sample contents for testing
	var content =
	'<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
	'<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
	'"><td align="center"><font face="sans-serif" color="' + fg +
	'" size="-2">&nbsp\;' + msg +
	'&nbsp\;</font></td></table></td></table>';
	*/
	if(ns4)
	{
	  htmlWndStyle.document.write(content);
	  htmlWndStyle.document.close();
	  htmlWndStyle.visibility = "visible";
	}
	if(ns6)
	{
	  document.getElementById("theHTMLWndLayer").innerHTML = content;
	  htmlWndStyle.display='block'
	}
	if(ie4)
	{
	  document.all("theHTMLWndLayer").innerHTML=content;
	  htmlWndStyle.display='block'
	}

  	
}

function hideHTMLWnd()
{
	if(ns4) htmlWndStyle.visibility = "hidden";
    else htmlWndStyle.display = "none";
	/*
	NOTE: DONOT call clearHTMLWndCheck() in this method, or it will go into circular call
	*/
}

function checkHTMLWndHide()
{
	if (bHideMenu == 1)
	{
		hideHTMLWnd();
		clearHTMLWndCheck();
	}
}

function onHTMLWndMouseOut()
{
	startHTMLWndCheck();
}

function onHTMLWndMouseMove()
{
	clearHTMLWndCheck();
}

function startHTMLWndCheck()
{
	bHideMenu = 1;
	htmlWndIntervalCheckId = setInterval("checkHTMLWndHide()", 500); 
}

function clearHTMLWndCheck()
{
	bHideMenu = 0;
	if (htmlWndIntervalCheckId != 0)
	{
		clearInterval(htmlWndIntervalCheckId);
		htmlWndIntervalCheckId = 0;
	}
}

function showPlainWnd(filename) 
{ 
	window.open(filename,"miniwin","toolbar=0, scrollbars=1,resizable=1,location=0,directories=0,status=0,menubar=0,width=506,height=410, left=305, top=220") ;
} 