//
// DetailBox
//
var IWIDTH=150  // Tip box width
var ns4         // Are we using Netscape4?
var ie4         // Are we using Internet Explorer Version 4?
var ie5         // Are we using Internet Explorer Version 5 and up?
var kon         // Are we using KDE Konqueror?
var x,y,winW,winH  // Current help position and main window size
var idiv=null   // Pointer to infodiv container
var px="px"     // position suffix with "px" in some cases

function nsfix(){setTimeout("window.onresize = rebrowse", 2000);}

function rebrowse(){window.location.reload();}

function initDetailBox() {
	ns4=(document.layers)?true:false, ie4=(document.all)?true:false;
 	ie5=((ie4)&&((navigator.userAgent.indexOf('MSIE 5')>0)||(navigator.userAgent.indexOf('MSIE 6')>0)))?true:false;
	kon=(navigator.userAgent.indexOf('konqueror')>0)?true:false;
	x=0;
	y=0;
	winW=1024;
	winH=768;
	idiv=null;
	document.onmousemove = mouse_move;
	if(ns4&&document.captureEvents) document.captureEvents(Event.MOUSEMOVE);

	// Workaround for just another netscape bug: Fix browser confusion on resize
	// obviously Konqueror has a similar problem :-(
	if(ns4||kon){ nsfix() }
	if(ns4) { px=""; }
}

function gettip(name){return (document.layers&&document.layers[name])?document.layers[name]:(document.all&&document.all[name]&&document.all[name].style)?document.all[name].style:document[name]?document[name]:(document.getElementById(name)?document.getElementById(name).style:0);}

function showDetailBox(name,text,width) {
	if(idiv) removeDetailBox();
	idiv=gettip("DetailBox");

	var content='<div id="'+name+'" name="'+name+'" style="position:absolute; z-index:20; top:0'+px+'; left:0'+px+';"><table width="'+width+'" border=0><tr><td bgcolor="#6699CC"><table width="98%"><tr><td bgcolor="#6699CC"><font size="1" color="white">'+text+'</font></td></tr></table></td></tr></table></div>'+"\n";

	winW=(window.innerWidth)? window.innerWidth+window.pageXOffset-16:document.body.offsetWidth-20;
	winH=(window.innerHeight)?window.innerHeight+window.pageYOffset  :document.body.offsetHeight;
	if(x<=0||y<=0){ // konqueror can't get mouse position
		x=(winW-IWIDTH)/2+(window.pageXOffset?window.pageXOffset:0);
		y=(winH-50)/2+(window.pageYOffset?window.pageYOffset:0); // middle of window
	}
	idiv.left=(((x+390)<winW)?x+12:x-385)+px;
	idiv.top=(((y+90)<winH)?y+12:y-90)+px;
	idiv.visibility=ns4?"show":"visible";

	document.getElementById("DetailBox").innerHTML=content;
	//document.write(content);
}

function removeDetailBox() {
	if (idiv) idiv.visibility=ns4?"hide":"hidden";
	idiv=null;
}

function mouse_move(e){
	if(e)   {x=e.pageX?e.pageX:e.clientX?e.clientX:0; y=e.pageY?e.pageY:e.clientY?e.clientY:0;}
	else if(event) {x=event.clientX; y=event.clientY;}
	else {x=0; y=0;}

	if(document.body) // Workaround for scroll offset of IE
	{
		x+=document.body.scrollLeft;
		y+=document.body.scrollTop;
	}
}

// Initialize after loading the page
window.onload=initDetailBox;
//
// EOF DetailBox
//
