//  Common JavaScript for Help

document.onclick = onclickCheck;


// ***************************************
// onclickCheck checks ID when user clicks and sends to the correct function.
// ***************************************

function onclickCheck(){

var element = window.event.srcElement;

//  if HTML in <A> tag includes other HTML tags, use the parent tag.

	for (var i=0; i < 5; i++)
	if (element.tagName!="A" && element.parentElement!=null) element = element.parentElement;
    
	elementID= element.id.toLowerCase();
				
    if (elementID=="expand")    callExpand(element);
    return;
}


// ***************************************
// callExpand expands and collapses sections of text as it is clicked.
//  <A ID="expand" href="#">Linked_text</A>  <div class="expand"> TEXT  </div>
// ***************************************

function callExpand(Aparams) {

	var Astring = Aparams;
	event.returnValue = false;			// stops <A> tag navigation
	
	var iNextTag, oExpandable;

	for (var i=1;i<4; i++){
		iNextTag = Astring.sourceIndex+Astring.children.length+i;
		oExpandable= document.all(iNextTag);
		if (oExpandable.className.toLowerCase()=="expand" || iNextTag == document.all.length)
			break;
		}

	if (oExpandable.style.display == "block")
		doCollapse(oExpandable);
	else doExpand(oExpandable);
}


// ***************************************
// doExpand expands a collapsed block of information.
// ***************************************
	
var redo = false;	

function doExpand(oToExpand) {
	var oExpandable= oToExpand;

	oExpandable.style.display = "block";
	
	if (!redo) {
		redo = true;
		focus(oToExpand);
		doExpand(oToExpand);
		}
}


// ***************************************
// doCollapse collapses an expanded block of information.
// ***************************************
	
function doCollapse(oToCollapse) {
	var oExpandable= oToCollapse;

    oExpandable.style.display = "none";
}


function doExpand(oToExpand) {
	var oExpandable= oToExpand;

	oExpandable.style.display = "block";
	
	if (!redo) {
		redo = true;
		focus(oToExpand);
		doExpand(oToExpand);
		}
}


// ***************************************
// doCollapse collapses an expanded block of information.
// ***************************************
	
function doCollapse(oToCollapse) {
	var oExpandable= oToCollapse;

    oExpandable.style.display = "none";
}

