<!-- 
/*

04-25-2000  Created this file.

*/

/****************************************************************************************

   Description:  Global variables.

	Date:

		11/30/1999	Create  global variables 
   
****************************************************************************************/

	var	sBrowser,  // 11-30-1999  Web browser.
			sSymbol = 'a',  // 12-01-1999  Special symbol (Greek, math, etc.)
			sTableAttributes,  // 12-01-1999  Different table attributes based on browser version.
			sRowAttributes;

	var	sBrowserVersion;  // 11-30-1999  Web browser version.

//   var arSymbolArray = new Array ();  // 12-02-1999  Array of special symbols.

	var	nsURL = 'http://www.home.netscape.com/download/',
			ieURL = 'http://www.microsoft.com/windows/IE/';


//**********************************************************
//
//   Abstract:  This function obtains the date that this page 
//              was last modified and then writes it into the 
//              dynamic HTML Page.  lastModified is a built-in
//		object property while document is a built-in 
//		object.
//
//**********************************************************

	function write_last_modified () {

		var last_modified = document.lastModified;

		document.write ( "<small> <b> <font color = '#006633'> " );
		document.write ( "This page was last modified on </font> </b> "  );
		document.write ( "<b> <font color = '#663300'>"  +  last_modified  +  ".</font> </b> </small>" );

	}		


/******************************************************************

	Function: goThere ()

	Description: 
	This function displays the .html page based on the user selection from 
	the drop-down lists.

	Date: 
	
		12/28/1999 Modified the function.  The parameter now contains the
			               entire path to the desired page.

		12/13/1999 Created the function.

******************************************************************/

	function goThere ( choice ) {

		if  ( choice == '' ) 
		{
				return;
		} 
		else 
		{
				location = choice;
		}

	}  // End goThere ().


/******************************************************************

	Function: Copyright ()

	Description: 
	This function displays the copyright statement. 

	Date:
	
		05/12/2000	Add <span>.
							Replace '<i>' and '<b>' with class = 'copyright' in <span>.

		12/13/1999 Create the function.

******************************************************************/

	function Copyright () {


			//-- Copyright Statement -->

		document.write ( " <span class = 'copyright'> <small>" );
		document.write ( "©1995 copyright by the U.S. Secretary of Commerce " );
		document.write ( "on behalf of the United States of America. &nbsp; All rights reserved." );
		document.write ( "</small> </span> <hr>" );
}


/******************************************************************

	Function: MakeTableOfLinks ()

	Description: 
	This function creates a table of links to the NIST and other homepages.  
	It takes two parameters.

			    sGif --- variable indicating what gif file to display

			sWebPage --- variable indicating what webpage to display

	Date: 

		07/06/2000	Add variable for NIST Data Home gif file.

		05/11/2000 Add online database link.
			               Chang the prefix of string variables to 's' instead of 'var'.

		05/08/2000 Modify the function to take two parameters instead of 
		                   four.

		04/26/2000 Create the function.

******************************************************************/

	function MakeTableOfLinks ( sGif, sWebPage ) {

		var	sDbMainPage = '../main/its90_main_page.html',
				sDbGifFile = 'its90.gif',
				sDbAltText  = 'ITS-90 Thermocouple Main Page';

		var	sOnlinePage = 'http://www.nist.gov/srd/online.htm',
				sOnlineGifFile = 'nistonline.gif',
				sOnlineAltText = 'NIST Online Databases';

		var	sNISTGif,
				sPage,
				sFile,
				sAltText;

		var	sNISTDataHomeGif = 'datahome.gif';

		if ( sGif == 'home' )
		{
			
			sNISTGif = 'nisthome.gif';

		} 
		else 
		{
			
			sNISTGif = 'nist.gif';

		}

		if ( sWebPage == 'db_main_page' )
		{

			sPage = sDbMainPage;
			sGifFile = sDbGifFile;
			sAltText = sDbAltText;

		} 


		//-- Begin Table of Links to NIST and Other Homepages -->

		document.write ( "<table width = '100%'> 	<tr> <td>	<a href = 'http://www.nist.gov'>" );
		document.write ( "<img border = '0' src = '../gif/" + sNISTGif + "' valign = 'bottom' alt = 'NIST Home Page' >" );
		document.write ( "</a> </td> <td> <a href = 'http://www.nist.gov/srd/'>" );
		document.write ( "<img border = '0' src = '../gif/" + sNISTDataHomeGif + "' valign = 'bottom' height = '30' width = '75'" );
		document.write ( "alt = 'NIST Data Home Page'>" );
		document.write ( "</a> </td>" );
		
		if ( sWebPage == 'db_main_page' )
		{
			document.write ( "<td> <a href = '" + sDbMainPage + "'>" );
			document.write ( "<img border = '0' src = '../gif/" + sDbGifFile + "' valign = 'bottom' height = '30'" );
			document.write ( "width = '95' alt = '" + sDbAltText + "'> </a> </td>" );
		}

		document.write ( "<td> <a href = '" + sOnlinePage + "'>" );
		document.write ( "<img border = '0' src = '../gif/" + sOnlineGifFile + "' valign = 'bottom' height = '30'" );
		document.write ( "width = '78' alt = '" +  sOnlineAltText + "'> </a> </td>" );
		document.write ( "</tr> </table> <hr>" );
		
	}  // End of MakeTableOfLinks().


/******************************************************************

	Function: AgencyStatement ()

	Description: 
	This function writes the NIST agency statement.

	Date: 

		04/26/2000 Create the function.

******************************************************************/

	function AgencyStatement () {


					//-- NIST Agency Statement -->

		document.write ( "<font color = '#006633'> <small> <b> National Institute of Standards and Technology (NIST) is an agency of the " );	
		document.write ( "<a href = 'http://www.doc.gov'> U.S. Commerce Department.</a></b> </small> </font> <br>" );

	}  // End of AgencyStatement().


/******************************************************************

	Function: SetupEndOfPage ()

	Description: 
	This function sets up the Comment statement at the end of an .html page.

	Date: 

		04/26/2000 Create the function.

******************************************************************/

	function SetupEndOfPage () {


		//-- Comment Statement -->

		document.write ( "<font color = '#006633'> <small>" );
		document.write ( "<b> For comments and questions,&nbsp;please " );
		document.write ( "<a href = 'http://srdata.nist.gov/contact/contact'> contact us.</b> </a> </small> </font> <br>" );

	}  // End SetupOfEndPage().


/****************************************************************************************

	Function:		GetBrowserAndVersion ()

	Description:		This function gets the browser name and version number.

	Date:

		11/30/1999	Create the function.
   
****************************************************************************************/

	function GetBrowserAndVersion () {

		var	StartPosition,  // Starting position of string to be extracted.
				Length;  // Length of string to be extracted.

				sBrowser = navigator.appName;
				sBrowserVersion = navigator.appVersion;

		if ( sBrowser == 'Microsoft Internet Explorer' ) 
		{

				StartPosition = sBrowserVersion.search ( 'MSIE' ) + 5;
				Length = sBrowserVersion.indexOf ( ';', StartPosition );

		} 
		else 
		{

				StartPosition = 0;
				Length = sBrowserVersion.indexOf ( '.', StartPosition ) + 3;

		}  // End if ( sBrowser == 'Microsoft Internet Explorer' ).

		sBrowserVersion = sBrowserVersion.substring ( StartPosition, Length );

		return ( sBrowserVersion );

	}  // End GetBrowserAndVersion ().



/****************************************************************************************

	Function:		GetAttributes ()

	Description:	 	GetAttributes () assigns the HTML table attributes based on the browser and 
							its version.

					sTCType	---	thermocouple type

					sTableType	---	coefficients or inverse coefficients table

	Date:
	
		09/25/2000		Add two parameters to the function.

		12/01/1999		Create the function.
   
****************************************************************************************/

	function GetAttributes ( sTCType, sTableType ) {

		sTCType = sTCType.toUpperCase ();

		if ( sBrowser == 'Microsoft Internet Explorer' && sBrowserVersion == 5.0 ) 
		{

				sTableAttributes = "border = '1' width = '100%' cellpadding  = '1' cellspacing  = '1' align = 'left' frame = 'hsides' rules = 'groups'";
			//sRowAttributes = " ";

		} 
		else 
		{

				sTableAttributes = "border = '0' width = '100%' cellpadding  = '1' cellspacing  = '0' align = 'left'";

		}  // End if ( sBrowser == 'Microsoft Internet Explorer' && sBrowserVersion == 5.0 ).

		sTableAttributes = sTableAttributes + " summary = 'This table gives the coefficients for Type  " + sTCType + " thermocouple for the respective temperature";

		if ( sTableType == 'inverse' )
		{

			sTableAttributes = sTableAttributes + " and voltage";

		}

		sTableAttributes = sTableAttributes + " ranges.'";

	}  // End GetAttributes ().


/****************************************************************************************

	Function:		DisplaySymbol ()

	Description:	 	
	DisplaySymbol () displays the Greek symbol.

	Date:
	
		05/08/2000		Created the function.
   
****************************************************************************************/

	function DisplaySymbol ( vSubScript ) {

		document.write ( "<font face = 'Symbol'>" + sSymbol + "</font><sub>" + vSubScript + "</sub> = </td>" );
	
	}  // End DisplaySymbol ().
	

/****************************************************************************************

	Function:		DisplayPageTitle ()

	Description:	 	
	DisplayPageTitle () displays the title of a page.

			    sTCType --- variable indicating which thermocouple type 
				sSign --- variable indicating whether the temperature is positive or negative

	Date:
	
		06/29/2000		Added variable sSign to indicate whether the temperature is positive or negative.

		05/13/2000		Created the function.
   
****************************************************************************************/

	function DisplayPageTitle ( sTCType ) {

		sTCType = sTCType.toUpperCase();
		
		document.write ( "<span class = 'title'> Type " + sTCType + " Thermocouples -- thermoelectric voltage " );
		document.write ( "as a function of temperature (°C); reference junctions at 0 °C" );
		document.write ( "</span> <hr> <br>" );
	
	}  // End DisplayPageTitle ().
	

/****************************************************************************************

	Function:		DisplayVoltageTableCaption ()

	Description:	 	
	DisplayTableCaption () displays the caption of a table.

				sTCType --- variable indicating which thermocouple type 

				sTableType --- variable indicating which type of table (i.e., voltage, coefficients, or
				                          inverse coefficients)

	Date:
	
		05/15/2000		Add two parameters to the function
								
								Modify function to display the caption for voltage, coefficients, and inverse
								coefficients

		05/13/2000		Created the function.
   
****************************************************************************************/

	function DisplayTableCaption ( sTCType, sTableType ) {

		var sTitle;

		sTCType = UpperCase ( sTCType );

		if ( sTableType == 'Voltage' || sTableType == 'voltage' ) 
		{

				// Set title for tables of thermoelectric voltage.
				sTitle = 'Thermoelectric Voltage in mV';

		} 
		else if ( sTableType == 'Inverse' || sTableType == 'inverse' ) 
		{

				// Set title for tables of thermocouples coefficients of approximate inverse functions.
				sTitle = 'Type ' + sTCType + ' Thermocouples Coefficients of Approximate Inverse Functions in mV';

		} 
		else 
		{

				// Set title for tables of thermocouples coefficients.
				sTitle = 'Type ' + sTCType + ' Thermocouples Coefficients in mV';

		}

		document.write ( "<caption align = 'top'> <font size = '+1'>" );
		document.write ( sTitle + "</font> </caption>" );
	
	}  // End DisplayTableCaption ().
	

/****************************************************************************************

	Function:		UpperCase ()

	Description:		This function converts a string to upper case.

				sString --- string to be converted to upper case

	Date:

		11/30/1999	Create the function.
   
****************************************************************************************/

	function UpperCase ( sString ) {

		return ( sString = 	sString.toUpperCase() );

	}  // End UpperCase ().


/****************************************************************************************

	Function:		openWindow ()

	Description:		This function opens another browser window.

				sFileToOpen --- indicator as to which file is to open

	Date:

		11/30/1999	Create the function.
   
****************************************************************************************/

	function openWindow ( sFileToOpen ) {  
	
		var	sURL,
				popupWin,
				sFeatures;

		sFileToOpen = UpperCase ( sFileToOpen );

		if ( sFileToOpen == 'TC' ) 
		{

				// Set URL to point to thermocouple format file.
				sURL = '../function_definitions/tc_format.html';
				sFeatures = 'scrollbars,resizable,width=840,height=350';

		} 
		else if ( sFileToOpen == 'COEFF' )
		{

				// Set URL to point to coefficient format file.
				sURL = '../function_definitions/coeff_format.html';
				sFeatures = 'scrollbars,resizable,width=640,height=350';

		} 
		else 
		{
				
				// Set URL to point to function definition file.
				sURL = '../function_definitions/function_definitions.html';
				sFeatures = 'scrollbars,resizable,width=550,height=350';

		}

		popupWin = window.open ( sURL, 'secondWin', sFeatures);
	
	}  // End openWindow ().


/****************************************************************************************

	Function:		writeDateCreate ()

	Description:		This function writes out the date a web page is created.

				dateCreated --- date the web page is created

	Date:

		08/10/2000	Create the function.
   
****************************************************************************************/

	function writeDateCreate ( dateCreated ) 
	{
		document.write ( "<small> <b> <font color = '#006633'> " );
		document.write ( "This page was created on </font> </b> "  );
		document.write ( "<b> <font color = '#663300'>"  +  dateCreated  +  ".</font> </b> </small> <br>" );		
	}


/****************************************************************************************

	Function:		writeAccessibilityCompliant ()

	Description:		This function displays the Section 508 compliant statement.

				statement --- Section 508 compliant statement

	Date:

		01/23/2001	Create the function.
   
****************************************************************************************/

	function writeAccessibilityCompliant ()
	{
		
		statement = 'This NIST web page meets Section 508 requirements of the Workforce Investment Act & Americans With Disabilities Act.';

		statement = statement + '<br> <a href = "http://www.nist.gov/public_affairs/privacy.htm"> Privacy Policy / Security Notice / Accessibility Statement </a>';

		document.write ( "<br> <span class = 'footnote'>" + statement + "</span>" );

	}


// -->