// functions specific to eldora project pages (all projects)
function TableOfContents( d, imageIndex, id) {

	// an array containing the initial images
	var initial = new Array();
	initial[0] = 'flightTrack.off.gif';
	initial[1] = 'images.off.gif';
	initial[2] = 'scanlistAft.off.gif';
	initial[3] = 'scanlistFore.off.gif';
	initial[4] = 'headerInformation.off.gif';
	initial[5] = 'flightLog.off.gif';
	initial[6] = 'data.off.gif';

	// based on the index of the image (flight track=0; images = 1;
	// scan list aft = 2; scan list fore = 3; header information = 4;
	// known problems = 5; data retrieval = 6...the order in which
	// they appear on the page
	// this is so the 'on' image appears for the selected page :-) 
	for (var i=0; i < initial.length; i++) {
		if ( i == imageIndex ) {
			var newImage = initial[i].replace(/\.off\./, "\.on\.");
			initial[i] = newImage;
			break;
		}
	}

	var graphicsDir = "../../graphics/";
	// write the table of contents that appears on the banner
	// for the iop information pages

	// the swpImage functions are used to change the color
	// of the image (really, change the image) when the user
	// passes the cursor over the button

	// the current document
	var td = "";
	var onMouseOver = new Array();
	var onMouseOut = ' onMouseOut="MM_swapImgRestore()"';
	onMouseOver['flightTrack'] = 
	' onMouseOver="MM_swapImage(\'flightTrack\',' +
	'\'\',\'' + graphicsDir + 'flightTrack.on.gif\',1)"';
	onMouseOver['images'] = 
	' onMouseOver="MM_swapImage(\'images\',' +
	'\'\',\'' + graphicsDir + 'images.on.gif\',1)"';
	onMouseOver['scanListAft'] = 
	' onMouseOver="MM_swapImage(\'scanListAft\',' +
	'\'\',\'' + graphicsDir + 'scanlistAft.on.gif\',1)"';
	onMouseOver['scanListFore'] = 
	' onMouseOver="MM_swapImage(\'scanListFore\',' +
	'\'\',\'' + graphicsDir + 'scanlistFore.on.gif\',1)"';
	onMouseOver['headers'] = 
	' onMouseOver="MM_swapImage(\'headers\',' +
	'\'\',\'' + graphicsDir + 'headerInformation.on.gif\',1)"';
	onMouseOver['flightLog'] = 
	' onMouseOver="MM_swapImage(\'flightLog\',' +
	'\'\',\'' + graphicsDir + 'flightLog.on.gif\',1)"';
	onMouseOver['data'] = 
	' onMouseOver="MM_swapImage(\'data\',' +
	'\'\',\'' + graphicsDir + 'data.on.gif\',1)"';

	//  write out the table of contents
	d.writeln('<table border="0" align="left" cellpadding="3">'); 

	d.writeln('<tr>');
	// flight track button
	td = '<td><br><br><a href="flight_track.html"' + onMouseOut +
	onMouseOver['flightTrack'] + 
	'><img name="flightTrack" src="' + graphicsDir + initial[0] + 
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');

	// images button
	d.writeln('<tr>');
	td = '<td><a href="images.html"' + onMouseOut +
	onMouseOver['images'] + 
	'><img name="images" src="' + graphicsDir + initial[1] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');

	// aft scan list button
	d.writeln('<tr>');
	td = '<td><a href="scanlist_aft.1.html"' + onMouseOut +
	onMouseOver['scanListAft'] + 
	'><img name="scanListAft" src="' + graphicsDir + initial[2] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');

	// fore scan list button
	d.writeln('<tr>');
	td = '<td><a href="scanlist_fore.1.html"' + onMouseOut +
	onMouseOver['scanListFore'] + 
	'><img name="scanListFore" src="' + graphicsDir + initial[3] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');

	// header information button
	d.writeln('<tr>');
	td = '<td><a href="header.html"' + onMouseOut +
	onMouseOver['headers'] + 
	'><img name="headers" src="' + graphicsDir + initial[4] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');
	
	// known problems button
	d.writeln('<tr>');
	td = '<td><a href="flight_log.html"' + onMouseOut +
	onMouseOver['flightLog'] + 
	'><img name="flightLog" src="' + graphicsDir + initial[5] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');
	
	// data retrieval button
	d.writeln('<tr>');
	td = '<td><a href="data.html"' + onMouseOut +
	onMouseOver['data'] + 
	'><img name="data" src="' + graphicsDir + initial[6] +
	'" border="0"></a></td>';
	d.writeln(td);
	d.writeln('</tr>');

	d.writeln('</table>');
	d.writeln('<p></p>');

}
function DisplayProblems( iop, currentIop ) {
	// display the known problems..highlighting the iop number
	// this is what is displayed when the user hits the
	// 'Known Problems' button
	var d = eval('document');
	var flightNum = '';
	var date = '';
	var time = '';
	var problem = '';
	var theIop = null; 
	d.writeln('<table border="1" bgcolor="white">');
	d.writeln('  <tr bgcolor="lavender">');
	d.writeln('    <th><b>FLIGHT</b></th>');
	d.writeln('    <th><b>DATE</b></th>');
	d.writeln('    <th><b>TIME</b></th>');
	d.writeln('    <th><b>PROBLEM</b></th>');
	d.writeln('  </tr>');
	for (var i=0; i < iop.length; i++) {
		theIop = iop[i];
		problem = theIop.problem;
		flightNum = theIop.flightNum;
		date = theIop.day1 + '-' +
		       theIop.month1 + '-' +
		       theIop.year1;

		time = theIop.hour1 + ':' + theIop.min1 + ' - ' +
		       theIop.hour2 + ':' + theIop.min2;
		if ( i == currentIop ) {
		   d.writeln('  <tr bgcolor="yellow">');
		} else {
		   d.writeln('  <tr>');
		}
		d.writeln('    <td>' + flightNum + '</td>');
		d.writeln('    <td>' + date + '</td>');
		d.writeln('    <td>' + time + '</td>');
		d.writeln('    <td>' + problem + '</td>');
		d.writeln('  </tr>');
	}
	d.writeln('</table>');
}
