function HelpHover()
{
	this._mousePosX = 0;
	this._mousePosY = 0;
	this._hoverItem = null;
	this._hoverContents = null;
}

HelpHover.prototype.init = function()
{
	var hh = this;
	var helpItems = document.getElementsByClassName('hasHelp');
	for (var i=0; i<helpItems.length; i++)
	{
		helpItems[i].onmousemove = function(e)
		{
			if (!e) var e = window.event;
			if (e.pageX || e.pageY)
			{
				// mozilla
				hh.mousePosX = e.pageX;
				hh.mousePosY = e.pageY;
			}
			else if (e.clientX || e.clientY)
			{
				// IE
				
				// DJC added:
				var topDJC = (document.documentElement && document.documentElement.scrollTop) ?  document.documentElement.scrollTop : document.body.scrollTop; 
  
				hh.mousePosX = e.clientX + document.body.scrollLeft;
				hh.mousePosY = e.clientY + topDJC;
				
			}
			hh._hoverItem = this;
			hh._hoverContents = document.getElementById(this.id+'Help');
			hh.move();
		}
		helpItems[i].onmouseout = function (e)
		{
			hh.out();
		}
	}
}

HelpHover.prototype.out = function()
{
	if (!this._hoverContents) { return; } // added by DJC to stop erros if its slow in loading
	
	this._hoverContents.style.top = -10000+'px';
	this._hoverContents.style.left = -10000+'px';
	this._hoverItem = null;
	this._hoverContents = null;
}

HelpHover.prototype.move = function()
{
	if (!this._hoverContents) { return; } // added by DJC to stop error if its slow in loading
	
	this._hoverContents.style.top = this.mousePosY+10+'px';
	this._hoverContents.style.left = this.mousePosX+10+'px';
	
	// added by DJC for rightHelp class
	if (this._hoverContents.className.indexOf("helpRight") != -1){		
		
		this._hoverContents.style.left = (this.mousePosX-160)+'px';
	}
}

addEvent(window, 'load', function()
{
	var hh = new HelpHover();
	hh.init();
});
