function fAddTableRow(oCurrentRow,oNewRow,iRowLength)
{	while (oCurrentRow.cells.length>iRowLength)									// copy the extra cells to the new row
    {	if (fNavVersion()<5)
    	{	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  //                  								
		}
        else
        {	var oCell=oCurrentRow.cells[iRowLength].cloneNode(true);
        	oCurrentRow.deleteCell(iRowLength);										// delete the first extra cell in the row above
        	oNewRow.appendChild(oCell);
        }
}	}

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!='menuTable')
	{	var oTempC=findPE(oMT,'TD');
    	oMT=findPE(oTempC,'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 fFromButton(oElement)
{	var oTempE=oElement;
	while (oTempE.tagName !='BUTTON')
	{	oTempE=findPE(oTempE,'BUTTON');
		if (oTempE==null) return null;
	}
	return oTempE;
}

function fDoHighlight(oElement,bActive,bOver)
{	if (fNavVersion()<5) return;
	/* find the cell moved from. */
	var oC=findPE(oElement,'TD');
	var oT=findPE(oC,'TABLE');

	if (oC==null) return;
	
	if (fFromLink(oElement)==null) return;
	
	var oMT=fReturnMenuTable(oT);
    
    if ((!oMT.id)||(oMT.id!='menuTable')) return;
    if ((!oMT.activeID)||(!oMT.passiveID)) return;
    
    if ((oMT.forceMenuTable)&&(oMT.forceMenuTable=='true'))
    {	while (oT!=oMT) 
        {	oC=findPE(oT,'TD');
        	oT=findPE(oC,'TABLE');
    }   }
        
	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].getAttribute('id')==oMT.activeID) oT.cells[i]=oMT.passiveID;
        oC.id=oMT.activeID;
  	}
	else oC.id=oMT.passiveID
}

function fUnHighlightCell(oFe,bActive)
{	
	fDoHighlight(oFe,bActive,false);
}

function fHighlightCell(oEvent,bActive)
{	oEvent.cancelBubble=true;
	var oE=oEvent.srcElement;
	fDoHighlight(oE,bActive,true);	
}

register('menuTable.js v.1507030946',false);