<?php
/*<outscirt><version>20180409</version></outscirt>*/

function O__tableMaker($O__colLabels,$O__data,$O__style,$O__ID,$O__IDswitch){
	$O__rowCount = 0;
	$O__cellCount = 0;
	$O__rowID = "";
	$O__cellID = "";

	$O__table = "<table class=\"" . $O__style . "\" id=\"" . $O__ID . "\">\n";
	
	// header row
	$O__table .= "<tr>\n";
		foreach($O__colLabels as $O__label) {
			$O__table .= "<th>" . $O__label . "</th>\n";
		}
	$O__table .= "</tr>\n";
	
	// row/ cell data
	foreach($O__data as $O__dataRow) {
		if($O__IDswitch == 1){ $O__rowID = " id=\"" . $O__rowCount. "\""; }
		$O__table .= "<tr" . $O__rowID . ">\n";
			foreach($O__dataRow as $O__dataCell) {
				if($O__IDswitch == 1){ $O__cellID = " id=\"" . $O__rowCount . $O__cellCount. "\""; }
				$O__table .= "<td" . $O__cellID . ">" . $O__dataCell . "</td>\n";
				$O__cellCount++;
			}
			$O__cellCount = 0;
		$O__table .= "</tr>\n";
		$O__cellCount = 0;
		$O__rowCount++;
	}
		
	$O__table .= "</table>\n";
	
	return $O__table;		
}
?>
