/* Tool tip */
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function CToolTipData()
{
	var m_showDelay = 50;
	var m_hideDelay = 300;
	var m_state = "hidden";
	var m_elementName = "toolTip";
	var m_htmlElement = -1;
	var m_browser = whichBrs();
	var m_mouseX = 0;
	var m_mouseY = 0;
	var m_class = "";

	var m_offsetX = 10;
	var m_offsetY = 10;
	var m_offsetXDef = m_offsetX;
	var m_offsetYDef = m_offsetY;
	var m_currentIndex = 0;
	var m_abortHide = false;
	var m_timeoutSet = false;
	var m_mouseOver = false;
	var m_hideId = -1;
	var m_showId = -1;

	// Function objects
	this.show = show;
	this.hide = hide;
	this.hideReal = hideReal;
	this.trueBody = trueBody;
	this.mouseMove = mouseMove;
	this.getX = getX;
	this.getY = getY;

	// Function bodies
	function show(id, text, ttClass)
	{
		m_class = ttClass;

		if(m_htmlElement == -1)
			m_htmlElement = getElement(m_elementName);
		
		//if(!m_htmlElement)
		//	alert("Element error");
		if(m_state != "showing")
		{
			if(ttClass)
			{
				
				if(ttClass == "top")
				{
					m_offsetY = -100;
					m_offsetX = 10;
				}
				else if(ttClass == "bottom")
				{
					m_offsetY = -200;
					m_offsetX = 10;
				}
				else if(ttClass == "textBox")
				{
					m_htmlElement.style.width="250px";
				}
			}
			else
			{
				m_offsetX = m_offsetXDef;
				m_offsetY = m_offsetYDef;
			}
		}

		if(m_state == "showing")
		{
			if(m_mouseOver == false)
				return;
			m_state = m_htmlElement.style.visibility = "visible";
			m_htmlElement.style.display = "block";
			m_showId = -1;
		}
		else
		{
			m_mouseOver = true;
			m_state = "showing";
			m_showId = setTimeout("theToolTip.show(" + id + ")", m_showDelay);
		}
		if(text)
			m_htmlElement.innerHTML = text;

	}

	function hide()
	{
		m_hideId = setTimeout("theToolTip.hideReal()", m_hideDelay);
		m_state = "hiding";
		m_mouseOver = false;

		if(m_showId >= 0)
			 clearTimeout(m_showId);
	}

	function hideReal()
	{
		if(m_state != "hiding")
			return;
		m_hideId = -1;
		m_state = m_htmlElement.style.visibility = "hidden";
		m_htmlElement.style.display = "none";
	}

	function mouseMove(e)
	{
		if(ns4 || m_browser == "Firefox")
		{
			m_mouseX = e.pageX;
			m_mouseY = e.pageY;
			
		}
		else if(ie4)
		{
			m_mouseX = event.x;
			m_mouseY = event.y;
		}
			
		// Add scroll offset
		if(m_browser != "Firefox")
		{
			m_mouseX += trueBody().scrollLeft;
			m_mouseY += trueBody().scrollTop;
		}

		if(m_htmlElement == -1 || m_htmlElement == null)
			m_htmlElement = getElement(m_elementName);

		if(!m_htmlElement)
			return;

		if(!m_htmlElement.style)
			return;

		if(m_htmlElement.style.visibility != "visible")
			return;

		if(m_class == "bottom")
		{
			m_htmlElement.style.left	= m_mouseX + m_offsetX + "px";
			m_htmlElement.style.top		= m_mouseY + m_offsetY + "px";
		}
		else
		{
			m_htmlElement.style.left	= m_mouseX + m_offsetX + "px";
			m_htmlElement.style.top		= m_mouseY + m_offsetY + "px";
		}
	}

	function getX() { return m_mouseX };
	function getY() { return m_mouseY };

	function trueBody()
	{
		return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
}

toolTipInitialized = false;
function toolTipInit()
{
	if(toolTipInitialized == true)
		return;

	if (ns4)
		document.captureEvents(Event.MOUSEMOVE);
	
	theToolTip = new CToolTipData();
	document.onmousemove = theToolTip.mouseMove;
	toolTipInitialized = true;
}