+function output_table($data,$caption="",$class="")
+{
+ if($class!="")
+ $HTML = "\n<table class=\"$class\">\n";
+ else
+ $HTML = "\n<table>\n";
+
+ $i=0;
+
+ if($caption!="")
+ $HTML .= " <caption> $caption </caption>\n";
+
+ foreach($data as $record)
+ {
+ if(!$i)
+ $HTML .= " <thead>\n <tr>\n";
+ else
+ {
+ if($i==1) $HTML .= " <tbody>\n";
+ if($i % 2)
+ $HTML .= " <tr class=\"odd\"> ";
+ else
+ $HTML .= " <tr class=\"even\"> ";
+ }
+ foreach($record as $point)
+ {
+ if($i)
+ $HTML .= " <td>$point</td> ";
+ else
+ $HTML .= " <th>$point</th> ";
+ }
+
+ if(!$i)
+ $HTML .= " </tr>\n </thead>\n";
+ else
+ {
+ $HTML .= " </tr>\n";
+ }
+ $i++;
+ }
+ $HTML .= " </tbody>\n</table>\n";
+
+ return $HTML;
+}
+