function fAddTableRow(oCurrentRow,oNewRow,iRowLength)
{	while (oCurrentRow.cells.length>iRowLength)									// copy the extra cells to the new row
    {	var oCell=oNewRow.insertCell(-1);										// add a new cell
        var sHTML=oCurrentRow.cells[iRowLength].innerHTML;						// copy the HTML of the first extra cell in the row above
                    															// the HTML is cached then the cell deleted to prvent conflicts
                                                                                // should any HTML within the cell require a unique ID
        oCurrentRow.deleteCell(iRowLength);										// delete the first extra cell in the row above
        oCell.innerHTML=sHTML;													// add the chached HMTL into the new cell
                   // ** note ** innerHTML is copied to preserve backward compatibility into IE4  //                  								
}	}

function fTidyTable(oTable, iRowLength)
{	with (oTable)																// add extra cells to any rows that don't have enough
		for (var i=0;i<rows.length;i++)											// this should only apply to the last row
    		with (rows[i])
        		while (cells.length<iRowLength)
                {	var oCell=insertCell();
                	oCell.innerHTML='&nbsp;';
                }
}	

function fArrangeTable(oTable, iRowLength)										// Arranges oTable into rows of iRowLength long
{	if (fNavVersion()<4) return;												// not tested in non IE and versions <4

	with (oTable) 
    	// the while loop is tested after each iteration.  This means that rows can be added and then re-split as necessary
        while (oTable.rows[rows.length-1].cells.length>iRowLength) fAddTableRow(oTable.rows[rows.length-1],insertRow(-1),iRowLength);               
	
    fTidyTable(oTable, iRowLength);
}

function fReturnMenuTable(oTable)
{	var oMT=oTable;
	while ((oMT.id)&&(oMT.id!='menuTable'))
	{	oMT=findPE(oMT,'TABLE');
		if (oMT==null) return oTable;
	}
	return oMT;
}

function fFromLink(oElement)
{	var oTempE=oElement;
	while (oTempE.tagName !='A')
	{	oTempE=findPE(oTempE,'A');
		if (oTempE==null) return null;
	}
	return oTempE;
}

function fDoHighlight(oElement,bActive,bOver)
{	/* find the cell moved from. */
	var oC=findPE(oElement,'TD');
	var oT=findPE(oC,'TABLE');
	var sTHighlight=sHighlight;
	var sTHighlightTextColor=sHighlightTextColor;

	if (oC==null) return;
	if (fFromLink(oElement)==null) return;
	var oMT=fReturnMenuTable(oT);

	if ((oMT.id)&&(oMT.id=='menuTable'))
	{	if (oMT.highlightStyle) sTHighlight=oMT.highlightStyle;
		if (oMT.highlightTextColor) sTHighlightTextColor=oMT.highlightTextColor;
		if ((oMT.forceMenuTable)&&(oMT.forceMenuTable=='true'))
		{	oT=oMT;
			oR=findPE(oC,'TR');
			oC=findPE(oR,'TD');
		}

		if ((oMT.highlightRow)&&(oMT.highlightRow=='true')) oC=findPE(oC,'TR');
	}

	if (bOver)
	{	//unhighlight any highlighted cells
		for (i=0;i<oT.cells.length;i++)
		{	if ((oT.cells[i].style.color==sTHighlightTextColor)||(oT.cells[i].style.background==sTHighlight))
			{	//unhighlight it
				oT.cells[i].style.color='';
				oT.cells[i].style.background='';	
	}	}	}
	else
	{	sTHighlight='';
		sTHighlightTextColor='';
	}
	
	if (bActive) oElement.style.color=sTHighlightTextColor;
	oC.style.background=sTHighlight;
}

function fUnHighlightCell(oFe,bActive)
{	
	fDoHighlight(oFe,bActive,false);
}

function fHighlightCell(oEvent,bActive)
{	oEvent.cancelBubble=true;
	var oE=oEvent.srcElement;
	fDoHighlight(oE,bActive,true);	
}

/* Legacy functions. Simply call the new functions and forward
   any passed variables.  They are retained here to maintain backward compatibility. */
   
function unHighlightCell(fe,active)
{	fUnHighlightCell(fe,active);
}

function highlightCell(theEvent,active)
{	fHighlightCell(theEvent,active);	
}

/* aim to define sHighLight in the document without having to define
   highlightColor.  Have to check for existance of highlightColor. */
var sHighlight=highlightColor;
var sHighlightTextColor=highlightTextColor;

/* end legacy functions. */

register('navTable.js v.1407031937',false);