/*
 * Tech Prep Script
 *
 * Author: James Gilbert
 * Date: October 26, 2006
 *
 * This function will setup the bottom and right lines in the articulation table for Tech Prep, as
 *   well as the very top line of the table and setup the style for the breaking rows.
 */

function techPrepLoad() {
	var tPTable = document.getElementById( "techPrep" );
	if ( tPTable == null )
		return;

	var tPRows = tPTable.rows;
	var tpCells;
	var i;
	tPRows[0].cells[0].style.borderTop = "1px solid black";
	
	//Loop through rows
	for(i=0;i<tPRows.length;i++) {
		tPCells = tPRows[i].cells;
		tPCells[tPCells.length-1].style.borderRight = "1px solid black";
		
		//If only one cell/Heading then format it.
		if ( tPCells.length == 1 && tPCells[0].innerHTML == "&nbsp;" ) {
			tPCells[0].style.background = "#008251";
			tPCells[0].style.fontSize = "2px";
			tPCells[0].style.borderBottom = "1px solid black";
		}
		
		//All 4 cells must be present
		if ( tPCells.length == 4 ) {
			//Only place a border if all of these are true
			if ( tPCells[0].innerHTML.indexOf( "(and)" ) == -1 &&
				 tPCells[0].innerHTML.indexOf( "(or)" ) == -1 &&
				 tPCells[1].innerHTML.indexOf( "(and)" ) == -1 &&
				 tPCells[1].innerHTML.indexOf( "(or)" ) == -1 &&
				 tPCells[2].innerHTML.indexOf( "(and)" ) == -1 &&
				 tPCells[2].innerHTML.indexOf( "(or)" ) == -1 &&
				 tPCells[3].innerHTML.indexOf( "(and)" ) == -1 &&
				 tPCells[3].innerHTML.indexOf( "(or)" ) == -1 ) {
				tPCells[0].style.borderBottom = "1px solid black";
				tPCells[1].style.borderBottom = "1px solid black";
				tPCells[2].style.borderBottom = "1px solid black";
				tPCells[3].style.borderBottom = "1px solid black";
			}
		}
	}
}