
var nHint;
var _traceHint;

if(_traceHint==undefined) {
	var mX=0,mY=0;
	var _traceHintF=new Array('moveHint()');
	if(!document.all) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove=traceHint;
	_traceHint=1;
}

function traceHint(e) {
	if(!document.all) {
		mX=e.pageX;
		mY=e.pageY;
	} else {
		mX=document.body.scrollLeft+event.clientX;
		mY=document.body.scrollTop+event.clientY;
	}
	for(var i=0; i<_traceHintF.length; i++)
		eval(_traceHintF[i]);
}

function moveHint() {
	if(nHint!=undefined&&document.getElementById(nHint)._s=="c") {
		var o=document.getElementById(nHint);
		var w=document.body.clientWidth;
		var h=document.body.clientHeight;
		posHint(null,o,w,h);
	}
}

function initHint(n,s,x,y,h,c) {
  if (c.length>0)
	  document.write('<div onMouseOver="showHint(document.getElementById(\''+n+'\')._a,\''+n+'\');" onMouseOut="hideHint(\''+n+'\','+h+');" id="'+n+'" style="position: absolute; left:0px; top:0px; visibility: hidden;"></div>');
	var o=document.getElementById(n);
	o._s=s;
	o._x=x;
	o._y=y;
	o._h=undefined;
	o._a=undefined;
	if (c.length>0)
	  o.innerHTML=c;
}

function showHint(a,n) {
	var o=document.getElementById(n);
	var w=document.body.clientWidth;
	var h=document.body.clientHeight;
	if(o._h!=undefined) 
      clearTimeout(o._h);
	if(o._a==undefined||o._a!=a) 
      o.style.visibility='hidden';
	posHint(a,o,w,h);
	if(o.scrollWidth>w||o.scrollHeight>h) 
      return;
	setTimeout("document.getElementById('"+n+"').style.visibility='visible'",10);
	o.style.zIndex=20;
	if(nHint!=undefined) 
      document.getElementById(nHint).style.zIndex=10;
	nHint=n;
	o._a=a;
}

function posHint(a,o,w,h) {
	var sl=document.body.scrollLeft;
	var st=document.body.scrollTop;
	if(o._s=="c") {
		var x=o._x+mX;
		var y=o._y+mY;
	} else {
		var x=o._x+a.offsetLeft;
		var y=o._y+a.offsetTop;
	}
	if(x-sl+o.scrollWidth>w) x=sl-o.scrollWidth+w;
	if(x<sl) 
      x=sl;
	if(y-st+o.scrollHeight>h) y=st-o.scrollHeight+h;
	if(y<st) 
      y=st;
	o.style.left=x;
	o.style.top=y;
}

function hideHint(n,t) {
	var o=document.getElementById(n);
	if(t!=undefined) 
      o._h=setTimeout("hideHint('"+n+"');",t*1000);
	else {
		o.style.visibility='hidden';
		if (nHint==n) 
          nHint = undefined;
	}
}

