/*
	DHTML popInfo v0.3
	writen by: me@daantje.nl
	last update: 22 Jul 2003 - 13:31

	documentation:
		This script will pop up a DIV element with the given HTML.
		Just like the TITLE atribute on the A tags... Only this one understands
		HTML and will be visible until you pull out on the link...
		Also build a funtion to replace the title attributes on given tags.
		You can call this function onload of the page.

	license:
		This script is FREE to use! You may copy, edit
		or use this script in ANY way possible!
		But please, mention me in your credits...
*/

//configuration
var infDivID = 'popInfoDiv'; //ID of the <DIV> tag
var infDivOverlap = -7;       //pixels ovelap on link
var infDivOutTime = 0;      //amount of seconds before hidding

//needed
var tmr;
var lastPopInfo;

//pop up an info DIV.
//call with empty txt value to hide the object.
function popInfo(obj,txt){
	if(obj){
		//get popup div element
		infDiv = document.getElementById(infDivID);
		if(infDiv){
			//kill timer
			clearTimeout(tmr);
			//check what to do... over or out...
			if(txt){
				//kill last pop div, when one is there....
				if(lastPopInfo)
					infDiv.style.visibility = "hidden";
				//get position
				t = obj.offsetTop;
				l = obj.offsetLeft;
				//patch position when we are in an other element...
				if(obj.offsetParent.offsetTop || obj.offsetParent.offsetLeft){
					obj2 = obj;
					while(obj2.offsetParent){
						t += obj2.offsetParent.offsetTop;
						l += obj2.offsetParent.offsetLeft;
						obj2 = obj2.offsetParent;
					}
				}
				//puse the popup to the link....
				infDiv.style.top = t + obj.offsetHeight - infDivOverlap+'px';
				infDiv.style.left = l + obj.offsetHeight - infDivOverlap+'px';
				infDiv.innerHTML = txt; //set text...
				infDiv.style.visibility = "visible"; //make it visible
				infDiv.style.zIndex = 9000; //over other layers
				lastPopInfo = infDiv; //remember current div for next over or out...
			}else{
				//it's an out... kill it on a timer...
				tmr = setTimeout('infDiv.style.visibility = "hidden"', (infDivOutTime * 100));
			}
		}
	}
}
