/* Generates footer for main pages */
/* 30-Jul-2011.BMJ: Added support for Google +1 btn in footer table */

/* Global data objects */
var monthNames = new Array( 12 );
	/* This is an array of (index, name) hashes for use by routines that want to write out the month
		name in a date expansion. */
	monthNames[ 0 ] = "Jan";
	monthNames[ 1 ] = "Feb";
	monthNames[ 2 ] = "Mar";
	monthNames[ 3 ] = "Apr";
	monthNames[ 4 ] = "May";
	monthNames[ 5 ] = "Jun";
	monthNames[ 6 ] = "Jul";
	monthNames[ 7 ] = "Aug";
	monthNames[ 8 ] = "Sep";
	monthNames[ 9 ] = "Oct";
	monthNames[10 ] = "Nov";
	monthNames[11 ] = "Dec";

var navButtons = new Array( 3 );
	/* This array contains data for all the possible links that we might want to put in the footer
		of a page.  The caller of GenFooter() passes the indices of the desired links in the call. */
	navButtons[ 0 ] = new Object();
	navButtons[ 0 ].href = '#Top';
	navButtons[ 0 ].target = '';
	navButtons[ 0 ].text = 'Top';
	navButtons[ 1 ] = new Object();
	navButtons[ 1 ].href = './index.html?frame2';	// Pseudo-query tells us not to display animation - user has seen it once already
	navButtons[ 1 ].target = '_top';
	navButtons[ 1 ].text = 'Home';
	navButtons[ 2 ] = new Object();
	navButtons[ 2 ].href = './calcsLegal.html';
	navButtons[ 2 ].target = '';
	navButtons[ 2 ].text = 'Legal &amp; Non-Warranty';
	navButtons[ 3 ] = new Object();
	navButtons[ 3 ].href = './index.html?calcs';	// Pseudo-query tells us to display Calcs.html in Frame2
	navButtons[ 3 ].target = '';
	navButtons[ 3 ].text = 'Calculators';
	/* For the GoServe page */
	navButtons[10 ] = new Object();
	navButtons[10 ].href = 'http://www2.hursley.ibm.com/goserve/';
	navButtons[10 ].target = '';
	navButtons[10 ].text = 'GoServe Home Page';
	navButtons[11 ] = new Object();
	navButtons[11 ].href = './index.html';
	navButtons[11 ].target = '_top';
	navButtons[11 ].text = 'ITE-Engineering Home Page';

/*-----------------------------------------------------------------------*/
function GenFooter(
	){
/* We receive a variable No. of arguments.  We create the buttons in the nav table in the order
		that the arguments are supplied, left to right.  Table width=90% of window in all cases.
		Unwanted gutter space seems to be added if 100% is used.  Find out how many arguments we have
		and build a width= string for use in table cell creation below.  Take floor() to prevent
		accumulation of roundoff errors that could cause table width to exceed 100%. */
/* Note that document will need a <br clear=left> tag prior to calling us if the last defined
	 	 element is not a block. */
//
/*--------------------------------^--------------------------------------*/
	document.writeln( "<hr class='footer'>" );
	/* We receive a variable No. of arguments.  We create the buttons in the nav table in the order
		that the arguments are supplied, left to right.  Table width=90% of window in all cases.
		Unwanted gutter space seems to be added if 100% is used.  Find out how many arguments we have
		and build a width= string for use in table cell creation below.  Take floor() to prevent
		accumulation of roundoff errors that could cause table width to exceed 100%. */
	if ( arguments.length ) {				// 'None' is a valid request
		var tdWidth = Math.floor( 90 / arguments.length );
		document.writeln( "<table id='footerMnu'><tr>" );
		for ( var i = 0; i < arguments.length; i++ )
			if ( navButtons[ arguments[ i ] ] ) {	// Ignore invalid indices submitted by caller
				document.write( "<td width='", tdWidth, "%'>[ <a href='", navButtons[ arguments[ i ] ].href,
						"' target='", navButtons[ arguments[ i ] ].target, "'>",
						navButtons[ arguments[ i ] ].text, "</a> ]" );
				document.writeln( "<hr class='footer' style='margin-top: 2px;'></td>" );
				} /* if */
		document.writeln( "</tr></table>" );
		} /* if */
	document.writeln( "<table id='footer'><tr><td id='R1C1'>" );

	/* Timestamp the page.  If the server doesn't provide a document.lastModified value, don't
		output the 'Last modified' timestamp.  Note that Perl scripts can set the http header
		'Last-Modified: ' to timestamp their documents. */
	if ( top.bd != null && Date.parse( document.lastModified ) != 18000000 ) {
		/* Create a Date object from which we will generate the 'Last Modified' timestamp */
		var timeStamp = new Date( document.lastModified );
		if ( top.bd.JSVersion < 1.2 ) {
			/* JS < 1.2 doesn't support Date.getFullYear, and NS 2, 3, 4 have stupid getYear() returns,
				so we do a workaround.  IE JS 1.0 returns years delta from 1900 for that century, 4-digit
				years otherwise.  NS 2, 4 return same until 2000, then they return 4-digit year. */
			var timeStampYear = timeStamp.getYear();
			if ( timeStampYear < 1000 )
				timeStampYear += 1900;
			} /* if */
		else {												// We can avoid all that b-s if JS 1.2 or higher
			timeStampYear = timeStamp.getFullYear();
			/* Idiotic return from some IE versions is 100 yrs short */
			browVer = top.bd.majVer + '.' + top.bd.minVer;
			if ( top.bd.browser == 'IE' && browVer >= 4 && browVer < 5.0 )
				timeStampYear += 100;
			} /* else */
		document.write( "This page last modified: ", timeStamp.getDate(), "-",
				monthNames[ timeStamp.getMonth() ], "-", timeStampYear,
				"<br /><span id='footerCo'>&copy;1998-", timeStampYear );
		} /* if */
	else
		document.write( "<span id='footerCo'>&copy;1998-present" );
	document.writeln( ", ITE - Engineering</span>" );
	document.writeln( "<br /><strong>All Rights Reserved.</strong>" );
	document.writeln( "<br />2115 Rexford Road, Suite 205" );
	document.writeln( "<br />Charlotte NC 28211" );
	document.writeln( "</td><td><g:plusone></g:plusone></td>" );		// Container for Google +1 button
	document.writeln( "<td id='R1C2'><img src='/gfx/ITE Anniversary.gif' alt='19th Anniversary'></tr></table>" );
	// Write call to script to populate Google plusone tag(s) (sync load)
	document.writeln( "<script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script>" );
	} /* GenFooter() */

/* Begin Main() */
/* End of Main() */

/* End footer.js */

