/* * * * * * * * * * * * * * * * */
/* * * HINTS * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
function findPosition(node)
{
  if(node.offsetParent)
  {
    for(var posX = 0, posY = 0; node.offsetParent; node = node.offsetParent)
    {
      posX += node.offsetLeft;
      posY += node.offsetTop;
    }
    return [posX, posY];
  }
  else
    return [node.x, node.y];
}



function showHint(e) {
  var l,t;
  var pregid = /^h__(.+)/;
  var rez,srcObj,hintstrid;

  if (!e) e = window.event;
  if (e.target) srcObj = e.target;
  else if (e.srcElement) srcObj = e.srcElement;
  if (srcObj.nodeType == 3) srcObj = srcObj.parentNode;

  if (srcObj) {
  	if (rez = srcObj.className.match(pregid)) {
  		hintstrid = rez[1];
    } else return;

  	if (sys_hints[hintstrid]) {
  		var pos = findPosition(srcObj)
  		//l = getOffsetLeft(srcObj);
  		t = getOffsetTop(srcObj);
  		l = pos[0];t = pos[1];
  		hinterObj.style.left = (l + 20) + 'px';
  		hinterObj.style.top = (t + 15) + 'px';


  		/*
  		for (var i in hinterObj.childNodes) {
  			if (hinterObj.childNodes[i].nodeName == '#text') {
  				hinterObj.removeChild(hinterObj.childNodes[i]);
  			}
  		}
  		*/

  		//hinterObj.appendChild(document.createTextNode(sys_hints[hintstrid]));
  		hinterObj.innerHTML = sys_hints[hintstrid];
  		hinterObj.style.display = 'block';
  	}
  };
}
/* * * * * * * * * * * * * * * * */
function hideHint(e) {
	hinterObj.style.display = 'none';
}
/* * * * * * * * * * * * * * * * */
function registerHinter(obj) {
	addEventListener(obj,'mouseover',showHint);
	addEventListener(obj,'mouseout',hideHint);
}
/* * * * * * * * * * * * * * * * */
function addHint(strid,text) {
	sys_hints[strid] = text;
}

/* * * * * * * * * * * * * * * * */
function initHinters() {
     var list = document.getElementsByTagName('acronym');
     var pregid = /^h__(.+)/;
     var rez;
     for (var i in list) {
          if (list[i].className) {
               if (rez = list[i].className.match(pregid)) {
                    addEvent(list[i],'mouseover',showHint);
                    addEvent(list[i],'mouseout',hideHint);
               }
          }
     }
}
/* * * * * * * * * * * * * * * * */
function initHinters_() {
	var list = document.getElementsByTagName('acronym');
	var pregid = /^h__(.+)/;
	var rez;
	for (var i in list) {
		if (list[i].className) {
			if (rez = list[i].className.match(pregid)) {
				addEvent(list[i],'mouseover',showHint,false);
				addEvent(list[i],'mouseout',hideHint,false);
			}
		}
	}
}