// This file contains JScript functions for Zen help

function doExpand(paraNum, arrowNum)
{
	// expand the paragraph and rotate the arrow; collapse and rotate it back
	if (paraNum.style.display == "none"){
		paraNum.style.display = "";
		arrowNum.src="images/arrowdn.gif";
	}
	else {
		paraNum.style.display="none";
		arrowNum.src="images/arrowrt.gif";
	}
}

function doExpandNo(paraNum)
{
	// expand/collapse the paragraph
	if (paraNum.style.display=="none"){paraNum.style.display="";}
	else {paraNum.style.display="none";}
}

function CreateTooltipDialog(){
	document.body.insertAdjacentHTML("BeforeEnd","<DIV></DIV>");
	oNewDialog=document.body.children(document.body.children.length-1);
	oNewDialog.className="clsTooltip";
	oNewDialog.style.width=300;
	oNewDialog.style.height=50;
	return oNewDialog;
}

var oDialog = null; // used for tooltip

function ShowTooltip(text_section, width)
{	
	if (oDialog == null) oDialog = CreateTooltipDialog();
	
	oDialog.innerHTML = text_section.innerHTML;		
	oNewDialog.style.width=width;

	// lets position the tooltip	
	dialog_left = event.screenX - window.screenLeft - 20 + document.body.scrollLeft;	
	width1 = window.screenLeft + document.body.clientWidth;
	width2 = event.screenX + oDialog.style.pixelWidth;	
	if (width1 < width2) {
		dialog_left = dialog_left - (width2 - width1);
	}
	oDialog.style.left = dialog_left;

	dialog_top = event.screenY - window.screenTop + 20  + document.body.scrollTop;
	height1 = window.screenTop + document.body.clientHeight;
	height2 = event.screenY + oDialog.style.pixelHeight;	
	if (height1 < height2) {
		dialog_top = dialog_top - (height2 - height1);
	}
	oDialog.style.top = dialog_top;

	oDialog.style.display="block";	
}

function HideTooltip()
{	
	if (oDialog != null) 
		oDialog.style.display="none";
}

function liteGo(spNo){
	spNo.style.background="#cc0033";
	spNo.style.color="#FFFFFF";
}

function liteOff(spNo){
	spNo.style.background="transparent";
	spNo.style.color="blue";
}
