var what
var delay = 30 											// speed of growing low = faster, high = slower
var pixels = 10											// pixels to grow/shrink
var offset_X = 10   								  // distance of popup from mouse (neg = left, pos = right)
var offset_Y = 10    							  // distance of popup from mouse (neg = above, pos = below)
var startDelay = 0  								// delay to wait on mouseover
var screenX = screen.width - 200 					// The width 0f the screen
var curDelay = 950
function grow(divId,text, fHeight){
	curDelay ++;
	if ((what == "grow") && (curDelay > startDelay)) {
		var change = false
		theheight=document.getElementById(divId).offsetHeight;
		if(theheight<fHeight){
			if (fHeight-theheight > pixels){
				document.getElementById(divId).style.height=theheight+pixels+'px';
				document.getElementById(divId).innerHTML = unescape(text)
			}
			else {
				document.getElementById(divId).style.height=fHeight+'px';
				curDelay = 0
			}
		}
	}
}
function shrink(divId){
	if (what == "shrink"){
		theheight=document.getElementById(divId).offsetHeight;
		if (theheight >= pixels){
			document.getElementById(divId).style.height = theheight - pixels+'px';
		}
		else {
			document.getElementById(divId).style.height = "0px"
			document.getElementById(divId).style.left = "-100"
			document.getElementById(divId).style.visibility = "hidden"
		}
	}
}
function startGr(divId){
	if (document.getElementById(divId).style.visibility != "visible") {
		what = "grow"
		shrinkAll()
		text = escape(document.getElementById(divId).innerHTML)
		fHeight = document.getElementById(divId).offsetHeight
		fWidth	= document.getElementById(divId).offsetWidth
		if (fWidth + mouseX + offset_X < screenX - 50 ){
			document.getElementById(divId).style.left = mouseX +  offset_X
		}
		else {
			document.getElementById(divId).style.left = screenX - fWidth -50
		}
		document.getElementById(divId).style.top = mouseY + offset_Y
		document.getElementById(divId).innerHTML = ""
		document.getElementById(divId).style.height = "0px"
		document.getElementById(divId).style.visibility = "visible"
		growInt = setInterval("grow('"+divId+"','" + text+ "'," + fHeight+")",delay);
	}
	else {
		startSh(divId)
	}
}
function startSh(divId){
	what = "shrink"
	shrinkInt = setInterval("shrink('"+divId+"')",delay);
}
function shrinkAll(){
	var num = document.getElementsByTagName('div').length;
	for (i=0;i<=num;i++){
		for (j=0;j<=3;j++){
  		var curDiv_id = "div_" + i + "_" + j
  		if (document.getElementById(curDiv_id)){
  			document.getElementById(curDiv_id).style.visibility = "hidden"
  		}
  	}
  }  
}
var mouseX, mouseY;
function getMousePos(e){
	if (!e)
		var e = window.event||window.Event;
	if('undefined'!=typeof e.pageX){
		mouseX = e.pageX;
		mouseY = e.pageY;
	} else {
		mouseX = e.clientX + document.body.scrollLeft;
		mouseY = e.clientY + document.body.scrollTop;
	}
}
// You need to tell Mozilla to start listening:
if(window.Event && document.captureEvents) {
 	document.captureEvents(Event.MOUSEMOVE);
}
// Then assign the mouse handler
document.onmousemove = getMousePos;
