function HelpHover2()
{
	var me=this;
	this._mousePosX = 0;
	this._mousePosY = 0;
	this._hoverItem = null;
	this._hoverContents = null;
	this.over_label=false;
	this.over_tooltip=false;
	this.over_tooltip_content=false;

  this.outtimer=function() {
		setTimeout(function() {
		  if (!me.over_label && !me.over_tooltip && !me.over_tooltip_content) me.out();
		},100);
  }
}

HelpHover2.prototype.init = function()
{
	var hh = this;

	var helpItems = document.getElementsByClassName('hasHelp2');

	for (var i=0; i<helpItems.length; i++)
	{
		helpItems[i].onmouseover = function(e)
		{
			hh.over_label=true;
      if (hh._hoverItem && hh._hoverItem!=this) hh.out();
			if (hh._hoverItem!=this)  {

				if (!e) var e = window.event;
				if (e.pageX || e.pageY)
				{
					hh.mousePosX = e.pageX;
					hh.mousePosY = e.pageY;
				}
				else if (e.clientX || e.clientY)
				{
					hh.mousePosX = e.clientX + document.body.scrollLeft;
					hh.mousePosY = e.clientY + document.body.scrollTop;
				}
				hh._hoverItem = this;
				hh._hoverContents = document.getElementById(this.id+'Help');
				hh.move();

			}

			hh._hoverContents.onmouseover=function() { hh.over_tooltip=true; }
			hh._hoverContents.onmouseout=function() { hh.over_tooltip=false; hh.outtimer(); }

      var children=hh._hoverContents.childNodes;
			for (var cn in children) if (children[cn].nodeName=='A') {
				children[cn].onmouseover=function() { hh.over_tooltip_content=true; }
  			children[cn].onmouseout=function() { hh.over_tooltip_content=false; hh.outtimer(); }
			}

		}
		helpItems[i].onmouseout = function (e)
		{
			hh.over_label=false;
			hh.outtimer();
		}
	}
}

HelpHover2.prototype.out = function()
{
  if (this._hoverContents!=undefined) if (this._hoverContents.style!=undefined) {
	this._hoverContents.style.top = -10000+'px';
	this._hoverContents.style.left = -10000+'px';
  }
	this._hoverItem = null;
	this._hoverContents = null;
}

HelpHover2.prototype.move = function()
{
	this.noout=false;
  if (this._hoverContents!=undefined) if (this._hoverContents.style!=undefined) {	
	var dx=(this._hoverContents.className.match('hover_left')?-this._hoverContents.offsetWidth:0);
	var dy=(this._hoverContents.className.match('hover_top')?-this._hoverContents.offsetHeight:0);
	this._hoverContents.style.top = (this.mousePosY+1+dy)+'px';
	this._hoverContents.style.left = (this.mousePosX+1+dx)+'px';
  }
}

addEvent(window, 'load', function()
{
	var hh2 = new HelpHover2();
	hh2.init();
});