#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string>
#include <math.h>
#include <time.h>
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	int num;
	char fileout[10];
	ofstream stream3,stream4;
	
	for (num=11; num<=230; num++) {

		sprintf(fileout,"%d",num);
		strcat(fileout,"f.html");
		//cout << fileout << endl;	
		stream3.open(fileout);
		
		
		//Writing into the file

		stream3 << " <html> " << endl;
		stream3 << " <head> " << endl;
		stream3 << " <meta http-equiv=""Content-Type""  " << endl;
		stream3 << " content=""text/html; charset=iso-8859-1"">  " << endl;
		stream3 << " <title>Run " << num << " </title> " << endl;
		stream3 << " </head>  " << endl;

		stream3 << "  <frameset rows=""30%,70%"" frameborder=""no""> " << endl;
		stream3 << " <frame src=""http://isrcadws3/cgi-bin/dqm""> " << endl;
		stream3 << " <frame src=""http://isrcadws3/cgi-bin/"<< num <<".html""> " << endl;
		stream3 << "</frameset> " << endl;
		stream3 << "</html>"  << endl;

		stream3.close();
		
		
		sprintf(fileout,"%d",num);
		strcat(fileout,".html");
		stream4.open(fileout);


stream4 << "<html> " << endl;

stream4 << "<head> " << endl;
stream4 << "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1""> " << endl;
stream4 << "<title>Run " << num << " </title> " << endl;
stream4 << "</head> " << endl;

stream4 << "<body> " << endl;


stream4 << "<p align=""center"">&nbsp;</p> " << endl;
stream4 << "<div align=""center""><center> " << endl;
stream4 << "<table border=""0""> " << endl;
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""""../icons/IMG/" << num << "chi2_tracksx.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_number_track2x.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_number_track3x.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_number_timing.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_size_track1x.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_size_track2x.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_size_track3x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "cluster_size_timing.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track1x.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track2x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track3x.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_timing.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
        stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track1y.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track2y.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_track3y.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_3d_track1.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_3d_track2.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "beam_prof_3d_track3.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_track3x_track2x_clean.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_track3x_track1x_clean.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_track2x_track1x_clean.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl; 
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "correlation_track3x_track2x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "correlation_track3x_track1x.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "correlation_track2x_track1x.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;     
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "correlation_timing_track1x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_track3y_track1y_clean.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_track2y_track1y_clean.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;        
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "correlation2_timing_track1x_clean.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "correlation3_track3x_track2x_clean.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "correlation3_track3x_track1x_clean.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;     
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "correlation3_track2x_track1x_clean.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "beam_profile_track1_clean.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "beam_profile_track2_clean.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;      
    stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track1x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track2x.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "residual_totx.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;     
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track3x.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "chi2_tracksx.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track1y.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;        
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track2y.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "residual_track3y.gif"" width=""375"" height=""375"">" << endl;
         stream4 << " <td><img src=""../icons/IMG/" << num << "residual_toty.gif"" width=""375"" height=""375"">" << endl;
    stream4 << "</tr> " << endl;        
     stream4 << " <tr>" << endl;
        stream4 << " <td><img src=""../icons/IMG/" << num << "chi2_tracky.gif"" width=""375"" height=""375"">" << endl;
	stream4 << " <td><img src=""../icons/IMG/" << num << "space_resolution_timing.gif"" width=""375"" height=""375"">" << endl;

    stream4 << "</tr> " << endl;        
stream4 << "</table> " << endl; 


stream4 << "</center></div> " << endl; 
stream4 << "</body> " << endl; 
stream4 << "</html> " << endl; 
		
		stream4.close();
		
	}
}
