// JScript source code
// M Burns  08/04/2006  created
// B Pike	12/08/2006	modified showHelp to use DOM offset positioning
// -------------------
var fileContent = '';
var theLocation = '';
var mousex = 0;
var mousey = 0;
var helpObj = null;

function showHelp(theLocation, elem)
{
	var xPos;
	var yPos;
	var tempEl;

	helpObj = document.getElementById('helpBox');
	if (!helpObj) {return;} // we did not get an object, terminate function

	xmlhttpLoad(theLocation);

	//get position left (X)
	xPos = elem.offsetLeft;
	tempEl = elem.offsetParent;
  	while (tempEl != null)
  	{
  		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
  	}
  	//get position top (Y)
	yPos = elem.offsetTop;
	tempEl = elem.offsetParent;
	while (tempEl != null)
	{
  		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
  	}

  	//assign left and top values
	if (helpObj.style)
	{
		helpObj.style.left = xPos + 'px';
	    helpObj.style.top = yPos + 'px';
		helpObj.style.visibility = 'visible';
	}
	else
	{
	    helpObj.left = xPos + 'px';
	    helpObj.top = yPos + 'px';
		helpObj.visibility = 'visible';
    }

}

//DOM compliant innerHTML emulation (for DOM browsers) and alternate method for IE
function hideHelp()
{
	helpBoxObj = document.getElementById('helpBox')
	if (helpObj.style)
	{
		helpObj.style.visibility = 'hidden';
	}
	else
	{
		helpObj.visibility = 'hidden';
	}	
}
function alterContent(theElement,newContent)
{
	if (document.all)												//if IE or derivative use deprecated innerHTML method
	{
		theElement.innerHTML=newContent;
	}
	else if (document.getElementById)								//otherwise populate using DOM
	{
		rng = document.createRange();								//--set the range to the entire document
		el = theElement;
		//el = document.getElementById(menuElement);					//--get the specific element object reference
		rng.setStartBefore(el);										//--set insertion point
		htmlFrag = rng.createContextualFragment(newContent);		//--create new content
		while (el.hasChildNodes()) el.removeChild(el.lastChild);	//--remove child nodes (elements and text)
		el.appendChild(htmlFrag);									//--insert new content nodes
	}
}
// XMLHTTPGET FUNCTIONS -----------
function xmlhttpChange()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		if (xmlhttp.status==200)
		{
			httpContent  = xmlhttp.responseText;
			xmlhttp = null;
			validXMLhttpResponse = true;
			alterContent(helpObj,httpContent);
			return true;
		}
		else
		{
			xmlhttp = null;
			return false;
		}
	}
}

function xmlhttpLoad(url)
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		if(xmlhttp)
		{
			xmlhttp.onreadystatechange=xmlhttpChange
			xmlhttp.open("GET",url,true)
			xmlhttp.send(null)
		}
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=xmlhttpChange
			xmlhttp.open("GET",url,true)
			xmlhttp.send()
		}
	}
}
//-->