***************
*** 3743,3824 ****
  
  		current_subject++;
  
- 		time_determinate=temp_subject->time_ok+temp_subject->time_warning+temp_subject->time_unknown+temp_subject->time_critical;
- 		time_indeterminate=total_time-time_determinate;
- 
- 		/* adjust indeterminate time due to insufficient data (not all was caught) */
- 		temp_subject->time_indeterminate_nodata=time_indeterminate-temp_subject->time_indeterminate_notrunning;
- 
- 		/* initialize values */
- 		percent_time_ok=0.0;
- 		percent_time_warning=0.0;
- 		percent_time_unknown=0.0;
- 		percent_time_critical=0.0;
- 		percent_time_ok_known=0.0;
- 		percent_time_warning_known=0.0;
- 		percent_time_unknown_known=0.0;
- 		percent_time_critical_known=0.0;
- 
- 		if(total_time>0){
- 			percent_time_ok=(double)(((double)temp_subject->time_ok*100.0)/(double)total_time);
- 			percent_time_warning=(double)(((double)temp_subject->time_warning*100.0)/(double)total_time);
- 			percent_time_unknown=(double)(((double)temp_subject->time_unknown*100.0)/(double)total_time);
- 			percent_time_critical=(double)(((double)temp_subject->time_critical*100.0)/(double)total_time);
- 			if(time_determinate>0){
- 				percent_time_ok_known=(double)(((double)temp_subject->time_ok*100.0)/(double)time_determinate);
- 				percent_time_warning_known=(double)(((double)temp_subject->time_warning*100.0)/(double)time_determinate);
- 				percent_time_unknown_known=(double)(((double)temp_subject->time_unknown*100.0)/(double)time_determinate);
- 				percent_time_critical_known=(double)(((double)temp_subject->time_critical*100.0)/(double)time_determinate);
- 	                        }
-                         }
- 
- 		if(odd){
- 			odd=0;
- 			bgclass="Odd";
- 	                }
- 		else{
- 			odd=1;
- 			bgclass="Even";
- 	                }
- 
- 		printf("<tr CLASS='data%s'><td CLASS='data%s'>",bgclass,bgclass);
  		if(strcmp(temp_subject->host_name,last_host))
! 			host_report_url(temp_subject->host_name,temp_subject->host_name);
! 		printf("</td><td CLASS='data%s'>",bgclass);
! 		service_report_url(temp_subject->host_name,temp_subject->service_description,temp_subject->service_description);
! 		printf("</td><td CLASS='serviceOK'>%2.3f%% (%2.3f%%)</td><td CLASS='serviceWARNING'>%2.3f%% (%2.3f%%)</td><td CLASS='serviceUNKNOWN'>%2.3f%% (%2.3f%%)</td><td class='serviceCRITICAL'>%2.3f%% (%2.3f%%)</td><td class='data%s'>%2.3f%%</td></tr>\n",percent_time_ok,percent_time_ok_known,percent_time_warning,percent_time_warning_known,percent_time_unknown,percent_time_unknown_known,percent_time_critical,percent_time_critical_known,bgclass,percent_time_indeterminate);
  
  		strncpy(last_host,temp_subject->host_name,sizeof(last_host)-1);
  		last_host[sizeof(last_host)-1]='\x0';
  
! 		get_running_average(&average_percent_time_ok,percent_time_ok,current_subject);
! 		get_running_average(&average_percent_time_ok_known,percent_time_ok_known,current_subject);
! 		get_running_average(&average_percent_time_unknown,percent_time_unknown,current_subject);
! 		get_running_average(&average_percent_time_unknown_known,percent_time_unknown_known,current_subject);
! 		get_running_average(&average_percent_time_warning,percent_time_warning,current_subject);
! 		get_running_average(&average_percent_time_warning_known,percent_time_warning_known,current_subject);
! 		get_running_average(&average_percent_time_critical,percent_time_critical,current_subject);
! 		get_running_average(&average_percent_time_critical_known,percent_time_critical_known,current_subject);
! 		get_running_average(&average_percent_time_indeterminate,percent_time_indeterminate,current_subject);
! 	        }
! 
! 	/* display average stats */
! 	if(odd){
! 		odd=0;
! 		bgclass="Odd";
! 	        }
! 	else{
! 		odd=1;
! 		bgclass="Even";
! 	        }
! 
! 	printf("<tr CLASS='data%s'><td CLASS='data%s' colspan='2'>Average</td><td CLASS='serviceOK'>%2.3f%% (%2.3f%%)</td><td CLASS='serviceWARNING'>%2.3f%% (%2.3f%%)</td><td CLASS='serviceUNKNOWN'>%2.3f%% (%2.3f%%)</td><td class='serviceCRITICAL'>%2.3f%% (%2.3f%%)</td><td class='data%s'>%2.3f%%</td></tr>\n",bgclass,bgclass,average_percent_time_ok,average_percent_time_ok_known,average_percent_time_warning,average_percent_time_warning_known,average_percent_time_unknown,average_percent_time_unknown_known,average_percent_time_critical,average_percent_time_critical_known,bgclass,average_percent_time_indeterminate);
  
! 	printf("</table>\n");
! 	printf("</DIV>\n");
  
  	return;
!         }
  
  
  /* display host availability */
--- 3984,4018 ----
  
  		current_subject++;
  
  		if(strcmp(temp_subject->host_name,last_host))
!                         printServicelist(1, 1, NULL, sg, temp_subject, total_time, current_subject);
!                 else
!                         printServicelist(0, 1, NULL, sg, temp_subject, total_time, current_subject);
  
  		strncpy(last_host,temp_subject->host_name,sizeof(last_host)-1);
  		last_host[sizeof(last_host)-1]='\x0';
  
!                 /* calculate average values */
!                 average.time_ok += temp_subject->time_ok;
!                 average.time_warning += temp_subject->time_warning;
!                 average.time_critical += temp_subject->time_critical;
!                 average.time_indeterminate_nodata += temp_subject->time_indeterminate_nodata;
!                 average.time_indeterminate_notrunning += temp_subject->time_indeterminate_notrunning;
!                 average.scheduled_time_ok += temp_subject->scheduled_time_ok;
!                 average.scheduled_time_warning += temp_subject->scheduled_time_warning;
!                 average.scheduled_time_critical += temp_subject->scheduled_time_critical;
!                 average.scheduled_time_unreachable += temp_subject->scheduled_time_unreachable;
!                 average.scheduled_time_indeterminate += temp_subject->scheduled_time_indeterminate;
!         }
  
!         if (current_subject > 0) {
!                 normalizeAverages(&average, current_subject);
!                 printServicelist(0, 0, NULL, sg, &average, total_time, current_subject+1);
!         }
  
+         printServicelistFooter(NULL, sg);
  	return;
! 	}
  
  
  /* display host availability */
