// ============================
//  File: inet_js_code.js
// ============================

var gFirstPage_ShowContactMenu = false;
var gFirstPage_ShowStoreBtns = false;
var gWeCanUseCookies = false;
var gCurrentFileIsFrom_LocalHardDiskAndNotInternet = true;
var gCurrentFileIsFrom_WwwInstrunetCom = false;
var gPageTracker = null;
var gPageTracker_InitializedOk = false;
var gOurCookies = "";
var gFirstPage_Referrer = "";
var gFirstPage_ReferrerDisplayedName = "";
var gFirstPage_SearchTerm = "";
var gP4 = "";
var gP9 = "";
var gFirstPage_gclid = "";
var gP9_SessionSummary = "";
var gRedirect__ShowContactMenu = false;
var gRedirect_gclid = "";
var gGoogleAnalytics_JavascriptFileLoadedOk = false;
var gWeAreOnMacintosh = false;
var gBrowserIs_Netscape  = false;
var gBrowserIs_IE = false;
var gThisPage_URL = "";
var gFavicon_URL = "";
var gBrowserIs_Firefox = false;
var gBrowserIs_Mozilla = false;
var gBrowserIs_Safari = false;
var g_gwiStore_url = 'http://store.gwinst.com';
var gRedirect__ShowStoreBtns  = false;
var gRedirect__P4 = "";
var gRedirect__P9 = "";
var gWeAreRedirectingToPriceListPage = false;
var gCurrentFileIsFrom_WwwGwinstCom = false;
var gCurrentFileIsFrom_InernetServer = false;
var gWeAreTryingToTrackWithGoogle = false;
var gFirstPage_DocReferrer = "";
var gFirstPage_FirstUrlOfSession_StartFromTop = "";
var gRedirectToThisNewUrl = "";
var gNumTimesCreatedCookie = 0;
var sCookie_name    = 'instrunetcookie';
var sCookie_path    = '\/';
var sCookie_domain  = '';  // this would need to be www.instrunet.com
var gFirstPage_PrimaryInterest = "";
var gNeedToTest_readyState = true;
var gContact_sepChar = ";";
var gFirstPage_Country = "";
var gHome_page_ref = "";
var gContact_page_ref = "";
var gDownload_Folder_ref = "";
var gImages_Folder_ref = "";
var gUrlToThisPageOnInternet = "";
var gStartChar_thisPage = 0;
var gUrlOfThisPageStartingFromTopLevel = "";
var gNameOf_GswLocalHardDiskDir 							= 'instrunet_website_local_org_files';
var gNameOf_GswLocalHardDiskDir_2 							= 'instrunet%20web%20site%20original';
var gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd 		= 'instrunet web site original';
var gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd_2 	= 'instrunet_web_site_original';
var gCurrentFile_IsFrom_GswDevelopmentLocalHardDisk = false;
var gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd = false;
var gEnclosingFolderThisPage = "";
var gTackSummaryToUrl = false; // always false
var gThisPageWasAutoGeneratedWith_iNet32_dll_C_code = false;
var gPage_body_width = 0;
var gThisPageIsWebsiteHomePage = false;
var gHeight_of_header_px = 0;
var gImages_Menu_Folder_ref = "";
var g_p_Folder_ref = "";
var gSoftware_Folder_ref = "";
var gDataAcq_Folder_ref = "";
var gProducts_Folder_ref = "";
var gProgramming_Folder_ref = "";
var gProductsIndexPage_ref = "";
var gDataAcq_Folder_ref = "";
var gSoftware_Folder_ref = "";
var gTop_level_ref = "";
var gReference_Folder_ref = "";
var cp_top = 0, cp_mid = 1, cp_bot = 2;
var gWeAreShowingMenubar = false;
var gCenter_text = "";
var gRight_text_if_referrer_not_shown = "";
var gPre  = '<div><a href=\"';
var gPost = '<\/a><\/div>';
var gBaseUrl_IfOnInternet = "";
var gBaseUrl_IfOnInternet_short = "";
var gBaseUrl_IfOnInternet_full = "";
var gTrack_Google_Conversion___buy__ok = false;
var gFirstPage_Search = "";
var gFirstPage_ShowGwinstHeader = false;
var g3CharDistiNameInUrl = "";
var gThisPage_IsFromLinkFrom_store_gwinst_com = false;
var gSys = ""; 
var gUsr = "";
var gLang = "";
var gFirstPage_SearchTerm_Is_WwwGwinstCom = false;

// ============================
//	enables debugging

var gDebuggingAlertsOn = false;
var gDebuggingAlerts_Function_InOut_On = false;
var gDebuggingCookies = false;
var gDonChangeSearchOnAll_A_Links = true;  // <<< this is buggy on local hd w/ # anchors and buggy on internet

// ============================
//	HEAD jScript code

function Execute_HEAD_jScript_code(thisPageWasAutoGeneratedWith_iNet32_dll_C_code, page_body_width, additional_space_under_header_px, center_text, right_text_if_referrer_not_shown )
{
	gWeAreShowingMenubar = true;
	var t = "";

	if (gDebuggingAlerts_Function_InOut_On) { alert('head() in'); }

	gHeight_of_header_px = Number((gWeAreShowingMenubar ? 70 : 50) + Number(additional_space_under_header_px));

	gThisPageWasAutoGeneratedWith_iNet32_dll_C_code = thisPageWasAutoGeneratedWith_iNet32_dll_C_code;

	gPage_body_width = Number( page_body_width );

	//	if suffix is "#128" or "#169" we redirect to www.gwinst.com...
	if ((we_redirected = redirect_to_another_url_if_suffix_tells_us_to_do_that()) != false) { return; }

	//	before/after printing to printer (e.g. create pdf), these will run
	window.onbeforeprint=beforeprint;
	window.onafterprint=afterprint;

	//	learn about what we are doing, this is BIG
	inet_interrogate_situation_before_loading();

	//	Load google analytics javascript file if we are on internet. google
	//	documentation says they want this to occur before </body> tag.
	GoogleAnalytics_LoadJavascript();

	//	print little 16x16 icon that shows up in brownser, only works if on www.gwinst.com or www.instrunet.com (not local hard disk)
	if (gFavicon_URL != "") {
		document.write( '<link rel=\"shortcut icon\" href=\"' + gFavicon_URL + '\">' );
	}

	//	meta 'title' and 'description' is written by javascript (inet_js_code.js) since we 
    //	are on the gwinst.com or instrunet.com Homepage (i.e. gWeAreOnHomePage = true) -->
	if (WeAreOneFirstPageOfThisWebsite() == true) {			//	we are on 1st page of website

		if (gCurrentFileIsFrom_WwwGwinstCom == true) {		//	www.gwinst.com

			//	title shows up in menubar, description shows up in search results window
			document.write( 							  '<title>GW Instruments, Inc - USB Data Acquisition Hardware &amp; Software, instruNet<\/title>' );
			document.write( '<meta name=\"description\" content=\"GW Instruments, Inc - USB Data Acquisition Hardware &amp; Software, instruNet\">' );

			//	keywords picked up by search engines
  			document.write( '<meta name=\"keywords\" content=\"gw instruments, gw instrument, , gw instrument company \">' );
   			document.write( '<meta name=\"keywords\" content=\"gw instrunet, gw instrunet inc, gw instrunets inc \">' );
 			document.write( '<meta name=\"keywords\" content=\"gw instruments company, gw instrument co, gw instruments co, instrunets \">' ); 
		} 
		else {												//	www.instrunet.com

			//	title shows up in menubar, description shows up in search results window
			document.write( 													'<title>USB Data Acquisition Hardware &amp; Software, Direct-To-Sensor, instruNet<\/title>' );
			document.write( '<meta name=\"description\" 					  content=\"USB Data Acquisition Hardware &amp; Software, Direct-To-Sensor, instruNet\">' );
		}
	}

	//	specify things for menubar
	if (gWeAreShowingMenubar) { 

		//	gsw comment Feb09: I don't think this does anything w/ non-netscape browsers 
		MM_reloadPage(true);	

		gCenter_text = center_text;

		gRight_text_if_referrer_not_shown = right_text_if_referrer_not_shown;
	}

	if (gDebuggingAlerts_Function_InOut_On) { alert("head() out"); }
}

// ============================
//	Return true if we are on the 1st page of this website

function WeAreOneFirstPageOfThisWebsite()
{	
	var exists = false;

	try { exists = (gWeAreOnHomePage != undefined); }

	catch(e) { exists = false; }

	if ( exists != true ) { return false; }

	else if (gWeAreOnHomePage == true) { return true; }

	else { return false; }
}

//	============================
//	Top of BODY jScript code

function Execute_TOP_OF_BODY_jScript_code( )
{
	var t="";

	if (gDebuggingAlerts_Function_InOut_On) { alert('topOfBody() in'); }

	After_load_relative_ref_to_other_files();
 
	if (gWeAreShowingMenubar) {

		<!-- turn off when printing closing bracket -->
		document.write('<div class=\"turnoffwhenprinting\">')

			//	============================
			//	print the menubar, absolute coords between y=50 and y=70

			Print_MenuBar_Item_htmlCode();

			Print_Download_And_Search_Btns(); 

			P7_setMM2('none', 0, 3,'Sublink 1.2','p7tbdn');

			P7_trigMM2();
	
			//	============================
			//	print the picture above the menubar; we start printing at 0,0

			document.write( '<table width=\"' + String(Number(gPage_body_width)+1) + '\" height=\"70\" class=\"Area_ABOVE_MenuBar_table\" >' );		

				Print_top_picture_table_row( gCenter_text, gRight_text_if_referrer_not_shown );
			
			document.write('<\/table>');
	
		<!-- turn off when printing closing bracket -->
		document.write('</div>'); 
	}

	if (gDebuggingAlerts_Function_InOut_On) { alert('topOfBody() out'); }
}

// ============================
//	Process_A_Front_End_Redirection_HEAD()   				-- place in HEAD
//	Process_A_Front_End_Redirection_BODY()   				-- place in BODY
//	Process_A_Front_End_Redirection_onreadystatechange()	-- we attach this to the document &amp; it runs after doc becomes ready
//
// 	The page that is being loaded is redirected to another page. 
//	Process_A_Front_End_Redirection_HEAD() excutes in the head before the page is loaded. 
//	And Process_A_Front_End_Redirection_BODY() executes in the body, when loading it.
function Process_A_Front_End_Redirection_HEAD( newUrl )
{
	// alert('Process_A_Front_End_Redirection_HEAD');

	//	============================
	//	interrogate ?x=y params at end of new url, which is the target
	//	page that we are redirecting to

	gRedirect__ShowContactMenu 		= (GetParameter_PassParamsToJavaScript(newUrl, 3) == 'c');
	gRedirect__ShowStoreBtns  		= (GetParameter_PassParamsToJavaScript(newUrl, 8) == 'p');
	gRedirect__P4            		=  GetParameter_PassParamsToJavaScript(newUrl, 4);
	gRedirect__P9            		=  GetParameter_PassParamsToJavaScript(newUrl, 9);
   	gRedirect_gclid    	    		=  GetParameter_PassParamsToJavaScript(newUrl, 'gclid'); // google adWords id tag

	//	============================
	//	CREATE COOKIE FOR SESSION
	//	
	//	We now run some routines before loading (e.g. printing body). In here,
	//	we will see who the referrer is and then CREATE A cookie based on that
	//	info (e.g. disti is refer).
	//
	//	CAREFUL:  BODY text may not have loaded yet, therefore we cannot operate
	//	operate ON object id's or things that have not yet been loaded.
	inet_interrogate_situation_before_loading(); 
  
	//	============================
	//	remember the new url that we will jump to
	//  alert('new url = ' + newUrl);
	gRedirectToThisNewUrl = newUrl;

	//	Load google analytics javascript file if we are on internet. google
	//	documentation says they want this to occur before </body> tag.
	GoogleAnalytics_LoadJavascript();

	//	============================
	// 	Run the Website tracker if we are on the internet, so that we can
	//	see that we are redirecting from this page to another page.

	Track_iNet_Page_If_On_Internet(document);

	//	============================
	//	dataplain does not work with: when document activates, we will run this routine
	// 		window.onactivate = Process_A_Front_End_Redirection_onactivate();
	// 		window.document.onload = Process_A_Front_End_Redirection_onactivate();

	return;
}

function Process_A_Front_End_Redirection_BODY()
{
	//	we redirect after the document is loaded (i.e. ready = complete)
	//	because dataplain/search engines will not recognize this thing if it does
	//	not fully load to the point of becoming ready
	
	//	ref: http://dean.edwards.name/weblog/2005/02/order-of-events/
	//	alert('Process_A_Front_End_Redirection_BODY');

	//	onreadystatechange is supported by IE (and not may others)
	if (typeof document.onreadystatechange != 'undefined')	{

		// alert('onreadystatechange isr being added');
		gNeedToTest_readyState = true;
		document.onreadystatechange = Process_A_Front_End_Redirection_onreadystatechange;
	}
	else if (gBrowserIs_Mozilla || gBrowserIs_Firefox)	{

		// mozilla supports this DOMContentLoaded event which runs after the doc is loaded
		// alert('Mozilla or Firefox DOMContentLoaded');
		gNeedToTest_readyState = false;
		document.addEventListener("DOMContentLoaded", Process_A_Front_End_Redirection_onreadystatechange, null);
	}
	else	{

		//	We redirect immediately. Dataplain does
		//	not work well here, yet at least we can get the redirection running
		gNeedToTest_readyState = false;
		Process_A_Front_End_Redirection_onreadystatechange();
	}

	return;
}

function Process_A_Front_End_Redirection_onreadystatechange()
{
	//	NOTE: WAITING FOR THE READYSTATECHANGE THING INVOLVES A 2 to 4SEC DELAY !
	//	NOTE: WAITING FOR THE READYSTATECHANGE THING INVOLVES A 2 to 4SEC DELAY !
	//	NOTE: WAITING FOR THE READYSTATECHANGE THING INVOLVES A 2 to 4SEC DELAY !

	// alert('document.readyState = ' + document.readyState + ", gNeedToTest_readyState = " + gNeedToTest_readyState);

	//	if we are responding to a readstagechange event, we need to test
	//	the readystate flag to see if the document is loaded
	if ( gNeedToTest_readyState )	{
	
		var docIsLoaded = true;
	
		//	Mac sends "interactive" msg and windows sends "complete" msg\
		//	We test below if readyState is supported by this browser
		if (typeof document.readyState != 'undefined') {
			docIsLoaded = (gWeAreOnMacintosh ? (document.readyState == 'interactive') : (document.readyState == 'complete'));
		}
	
		//	if the doc is not yet completely loaded, then exit
		if ( !docIsLoaded ) { return; }
	}

	// used for debugging
	if (gDebuggingCookies)           { alert('Process_A_Front_End_Redirection_onreadystatechange()');         }
	if (gRedirectToThisNewUrl == "") { alert('ERROR www.instrunet.com Process_A_Front_End_Redirection_BODY'); }

	// replace this url w/ new url. This supports the BACK button.
	// same as: window.open(gRedirectToThisNewUrl, '_self', '', true); 
	Redirect_to_another_url( gRedirectToThisNewUrl );

	//	NOT USED: we will redirect in 300mSec, to give search engines/dataplain time
	//	to see this page
	// window.setTimeout('Process_A_Front_End_Redirection_AFTER_onreadystatechange()', 300); 

	return;
}

function Process_A_Front_End_Redirection_AFTER_onreadystatechange()
{
	//	not used
	return;
}

function Redirect_to_another_url( newUrl )
{
	//	this does not run on jscript 1.0 (1.1 is ok),
	//	yet ie >=4 has jscript >= 1.1. If one does not have
	//	jscript 1.1,
	window.location.replace( newUrl );
}


// ============================
//	Print_Link_To_CONTACT_Form()	--	Print link to contact form in browser
//	Get_Contact_Form_Parameters()	--  gets params stored in the url to the contact form
//
//	ContactForm url: 	.../sendMsgPage.html?5=ContactType;ToEmailName;ToEmailWebsite

function Print_Link_To_CONTACT_Form(contact_form_href, email_addr_name, email_addr_website, support_type_text)
{
	// alert('PrintContact() in');

	var support_type = support_type_text.toLowerCase(); 

	if      (support_type.indexOf("sale") != -1) 	{  support_code="sale"; }
	else if (support_type.indexOf("supp") != -1) 	{  support_code="supp"; }
	else if (support_type.indexOf("engi") != -1)	{  support_code="supp"; }
	else if (support_type.indexOf("cust") != -1) 	{  support_code="cust"; }
	else if (support_type.indexOf("serv") != -1) 	{  support_code="cust"; }
	else if (support_type.indexOf("repa") != -1) 	{  support_code="repa"; }
	else										 	{  support_code="supp"; }

	var send_msg_form = 'sendMsgPage.html';

	var at_symbol_href 			= contact_form_href.replace(send_msg_form, 'pics/goldAtUnderlineSymbol.png');
	var underscore_symbol_href 	= contact_form_href.replace(send_msg_form, 'pics/goldUnderscoreUnderlineSymbol.png');

	var at_code 				= '<img src=\"' + at_symbol_href 			+ '\" width=\"10\" height=\"14\" STYLE=\"border-width: 0px; margin-bottom:-2px;\">';
	var underscore_code 		= '<img src=\"' + underscore_symbol_href 	+ '\" width=\"10\" height=\"14\" STYLE=\"border-width: 0px; margin-bottom:-2px;\">';

	var temp1 = ReplaceMultipleInstancesOfAString(email_addr_name, ' ', '');
	email_addr_name = temp1; 

	var temp2 = ReplaceMultipleInstancesOfAString(email_addr_website, ' ', '');
	email_addr_website = temp2;

	var href_text = contact_form_href + '?5=' + support_code + gContact_sepChar + email_addr_name + gContact_sepChar + email_addr_website;
	
	var email_addr_website_view = email_addr_website;

	var email_addr_name_noUnderScore = ReplaceMultipleInstancesOfAString(email_addr_name, '_', underscore_code); 

	var display_text = email_addr_name_noUnderScore + at_code + email_addr_website_view;

	var html_text = '<A HREF=\"' + href_text + '\">' + display_text + '<\/A>';

	// alert('Contact HTML Code: ' + html_text);

	document.write( html_text );

	return;
}

// ============================
//	inet_interrogate_situation_before_loading()
//
//	This is excuted in the head, before the page loads and before
//	the on load event. This is useful at calculating vars that
//	determine how to print the body (thats why we run this in the
//	head).  WHEN THIS CODE EXECUTES, THE BODY text may not have loaded
//	yet, therefore we cannot operate ON object id's or things that have
//	not yet been loaded.
//	
//	parameters tacked to the end of url (e.g. "index.html?1=x,2=y,3=z")
//  parameter 3    if this = "c,", we show "Contact Us" and EmailUs button; otherwise we don't
//  parameter 8    if this = "p, we show usa prices; otherwise we don't
//  parameter 4    if this != "", then we search this text for a distributor name
//  parameter 9    XYZZZ, if X=c contact is on, if Y = p prices are on, ZZZ = 1st 3 letters of disti

function inet_interrogate_situation_before_loading()
{ 
	var valueOfSavedCookie = "";
	var testStr = "";

	// alert("begin inet_interrogate_situation_before_loading");

	//	if we are not loading this page, and are instead redirecting
	//	to another page, then don't get involved in initializing
	//	cookie state and other variables in here (we'll do that later)
	if (gWeAreRedirectingToPriceListPage) { return; }

	// get url to this page
	gThisPage_URL = "";
    if (location) { if (location.href)	{ gThisPage_URL = location.href.toLowerCase(); } } 
	
    //	get name of browser
    var agt = navigator.userAgent.toLowerCase();

	//	determine if we are on a mac or a windows computer
	gWeAreOnMacintosh = (agt.indexOf("mac") != -1);

	//	determine if we are loading a file from www.gwinst.com or not
	gCurrentFileIsFrom_WwwGwinstCom = (gThisPage_URL.indexOf("gwinst.com") != -1);

	//	determine if we are loading a file from www.instrunet.com or not
	gCurrentFileIsFrom_WwwInstrunetCom = (gThisPage_URL.indexOf("instrunet.com") != -1);

	//	true if current file is from gwinst.com or instrunet.com server on internet
	gCurrentFileIsFrom_InernetServer = ((gCurrentFileIsFrom_WwwGwinstCom == true)  ||  (gCurrentFileIsFrom_WwwInstrunetCom == true));

	//	true means we will try to track w/ google analytics and conversion
	gWeAreTryingToTrackWithGoogle = gCurrentFileIsFrom_InernetServer;

 	//	determine base url if on internet, e.g. "gwinst.com" or "instruNet.com"
	if (gCurrentFileIsFrom_WwwGwinstCom) { gBaseUrl_IfOnInternet_short = 'gwinst.com';    }
	else 								 { gBaseUrl_IfOnInternet_short = 'instrunet.com'; }

    gBaseUrl_IfOnInternet 		= 'www.' + gBaseUrl_IfOnInternet_short;		//	e.g. "www.gwinst.com" or "www.instruNet.com"
    gBaseUrl_IfOnInternet_full 	= 'http:\/\/' + gBaseUrl_IfOnInternet;		//	e.g. "http://www.gwinst.com" or "http://www.instruNet.com"

 	//	determine base url if on internet, e.g. "gwinst.com" or "instruNet.com"
	if (gCurrentFileIsFrom_WwwGwinstCom) 		  	{ gFavicon_URL = 'http://www.gwinst.com/images/favicon/favicon_gwi.ico';  }
	else if (gCurrentFileIsFrom_WwwInstrunetCom)  	{ gFavicon_URL = 'http://www.instrunet.com/images/favicon/favicon_inet.ico';  }
	else											{ gFavicon_URL = "";  }

	//	============================================================================
	//	Calculate browser
	//
    // If you want to allow spoofing, take out the tests for opera and webtv.
	//
	//	netscape pc/mac
	//
	//	mozzila firefox mac/pc
	//		- Mozilla browsers don’t support onreadystatechange, so the results won’t mean much on that platform. 
	//
	//	apple safari mac
	//
	//	ref: http://1-800-volunteer.org/1800Vol/admin/js/util.js;

	if      (agt.indexOf('safari') != -1) 										{ gBrowserIs_Safari = true; }
    else if (agt.indexOf('netscape')!=-1) 										{ gBrowserIs_Netscape  = true; }
	else if ((navigator.appName == 'Microsoft Internet Explorer') || ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1))) 
																				{ gBrowserIs_IE  = true; }
	else if (agt.indexOf("firefox") != -1) 										{ gBrowserIs_Firefox = true; }
	else if (navigator.product == 'Gecko' && navigator.appName == 'Netscape') 	{ gBrowserIs_Mozilla = true; }	

	//	============================================================================
	//	calc if we just came from the store.gwinst.com website.

	if (document.referrer.length >= 1) { 
		gThisPage_IsFromLinkFrom_store_gwinst_com = (document.referrer.toLowerCase().indexOf('store.gwinst.com') >= 0);
	}

	//	============================================================================
	//	Calc if we are running off a local hard disk or from the internet

	if (gThisPage_URL != "") {
		if (gThisPage_URL.substring(0, 4) == "http") {
     		gCurrentFileIsFrom_LocalHardDiskAndNotInternet = false;
			if (gDebuggingAlertsOn) { alert("we are on internet"); }
		}
	}

	//	============================================================================
	//	Calc url components (e.g. http, file path) from current page url 

	if (gThisPage_URL != "")	{

		var http_index = 0;

		if (gCurrentFileIsFrom_LocalHardDiskAndNotInternet)	{		//	if current file is from local hard disk...

			//	remove preceeding stuff (e.g. http, file path) from current page url 
			if ((http_index = gThisPage_URL.indexOf(gNameOf_GswLocalHardDiskDir)) >= 0)	{ 
				gEnclosingFolderThisPage = gNameOf_GswLocalHardDiskDir; 
				gCurrentFile_IsFrom_GswDevelopmentLocalHardDisk = true; 
			}
			else if ((http_index = gThisPage_URL.indexOf(gNameOf_GswLocalHardDiskDir_2)) >= 0)	{ 
				gEnclosingFolderThisPage = gNameOf_GswLocalHardDiskDir_2; 
				gCurrentFile_IsFrom_GswDevelopmentLocalHardDisk = true; 
			}
			else if ((http_index = gThisPage_URL.indexOf(gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd)) >= 0)	{ 
				gEnclosingFolderThisPage = gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd; 
				gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd = true; 
			}
			else if ((http_index = gThisPage_URL.indexOf(gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd_2)) >= 0)	{ 
				gEnclosingFolderThisPage = gNameOf_instruNetWebsiteInstalledOnEndUserLocalHd_2; 
				gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd = true; 
			}
		}
		else {														//	else current file is from internet
			if ((web_position = gThisPage_URL.indexOf('\/\/')) >= 0) {
				if ((dot_com_position = gThisPage_URL.indexOf('.com')) >= 0) {
					//	e.g. www.instrunet.com,	www.gwinst.com
					gEnclosingFolderThisPage = gThisPage_URL.substring(web_position+1, dot_com_position+4);
				}
			}
		}

		//	url of page, starting at top level, e.g. "www.instrunet.com/index.html" or "instruNet_website_local_ORG_FILES/index.html" is website homepage
		gStartChar_thisPage = gThisPage_URL.indexOf(gEnclosingFolderThisPage);
		gUrlOfThisPageStartingFromTopLevel = gThisPage_URL.substring(gStartChar_thisPage, gThisPage_URL.length);

		//	url of page, under top level, e.g. "index.html" or "index.html" is website homepage
		gTopChar_thisPage = gStartChar_thisPage + gEnclosingFolderThisPage.length + 1;
		gUrlOfThisPageStartingFromTopLevel = gThisPage_URL.substring(gTopChar_thisPage, gThisPage_URL.length);

		gThisPageIsWebsiteHomePage = (gUrlOfThisPageStartingFromTopLevel.indexOf('index.html') == 0);
	
		//	e.g. "http://www.gwinst.com/..." or "http://www.instruNet.com/..."
		gUrlToThisPageOnInternet = gBaseUrl_IfOnInternet_full + '\/' + gUrlOfThisPageStartingFromTopLevel;  
	}

	//	============================================================================
	//	debugging
															if ( gDebuggingAlertsOn ) { 
												
																testStr  = 'gThisPage_URL = ' 						+ gThisPage_URL 						+ '\r\n\r\n';
																testStr += 'gUrlOfThisPageStartingFromTopLevel = ' 	+ gUrlOfThisPageStartingFromTopLevel 	+ '\r\n\r\n';
																testStr += 'gUrlToThisPageOnInternet = ' 			+ gUrlToThisPageOnInternet 				+ '\r\n\r\n';
											
																alert(testStr);
															}

	//	============================================================================
	//	calc if we can use cookies

	if ( window.navigator.cookieEnabled ) { gWeCanUseCookies = true; }

	if (gDebuggingCookies) { alert('document.cookie = ' + document.cookie); }

	//	============================================================================
	//	Run this routine when load page to turn off the left navigation items
	//	See if we should show the special buttons

	if (gWeCanUseCookies) {

		if (gDebuggingAlertsOn) { alert("we can use cookies"); }
		gOurCookies = get_cookie( sCookie_name );
		if (gDebuggingAlertsOn || gDebuggingCookies) { alert('Saved gOurCookies = ' + gOurCookies + ', this page gThisPage_URL = ' + gThisPage_URL ); }

		//	============================
		//	if the cookie is empty, assume we are just starting
		//	our browser session (we are on session page #1) and need to 
		//	look at url suffix and document referer (url of previous page
		//	before hitting our website) to see what we should show

		if ((gOurCookies == "") || (gOurCookies == null)) {

			//	init
			var gPrintReferrerNameIntoWindowForTesting = false;
			var ref = "";
			var we_got_here_from_search_engine = false;
			var we_got_here_from_link_on_disti_website = false;
			var there_is_a_favored_disti_that_handles_users_country = false;
			var disti_that_handles_visitors_country = "";
			var visitor_came_from_link_from_this_distributors_website = "";
			var visitorWants_ShowContactMenu = false;
			var vistorWants_ShowStoreBtns = false;
			var user_got_here_by_typing_instrunet_keyword_into_search_engine_and_then_clicked_on_instrunet_item = false;

			//	interogate ?x=y params at end of url
  			visitorWants_ShowContactMenu	= (GetParameter_PassParamsToJavaScript(gThisPage_URL, 3) == 'c');
   			vistorWants_ShowStoreBtns  		= (GetParameter_PassParamsToJavaScript(gThisPage_URL, 8) == 'p');
   			gP4          			 		=  GetParameter_PassParamsToJavaScript(gThisPage_URL, 4);
   			gP9          			 		=  GetParameter_PassParamsToJavaScript(gThisPage_URL, 9);
   			gFirstPage_gclid         		=  GetParameter_PassParamsToJavaScript(gThisPage_URL, 'gclid');  // google adWords id tag

			//	if someone enterred the website w/o the ?... suffix params, and
			//	we are redirecting to another page; then use the ?...suffix params
			//	on the target redirection page if they exist
			if (gRedirect__ShowContactMenu)  			{ visitorWants_ShowContactMenu = true; }
			if (gRedirect__ShowStoreBtns) 				{ vistorWants_ShowStoreBtns = true; }
			if ((gP4 == "") && (gRedirect__P4 != "")) 	{ gP4 = gRedirect__P4; }
			if ((gP9 == "") && (gRedirect__P9 != "")) 	{ gP9 = gRedirect__P9; }

			//	if we have a param #9 in the url...
			if (gP9 != "") {  

				//	if X in "?9=XYZZZ" tell us to turn on the contact us...
				if (gP9.substring(0, 1).toLowerCase() == 'c') { visitorWants_ShowContactMenu = true; } 

				//	if Y in "?9=XYZZZ" tell us to turn on the prices..
				if (gP9.substring(1, 2).toLowerCase() == 'p') { vistorWants_ShowStoreBtns = true; } 

				//	see if there is a 3 char disti name in the url (i.e. "?9=XYZZZ" where ZZZ is the 3char code); 
				//	and if so, we look for that as well in our search for a disti
				g3CharDistiNameInUrl = gP9.substring(2, 5).toLowerCase(); 
			}

			//	if there is no 3char disti name in p9 then look for this in p4
			if ((g3CharDistiNameInUrl == "") && (gP4 != ""))	{
				g3CharDistiNameInUrl = gP4.substring(0, 3).toLowerCase(); 
			}

			if (gDebuggingAlertsOn) { alert('gFirstPage_ShowContactMenu = ' + gFirstPage_ShowContactMenu + ', gFirstPage_ShowStoreBtns = ' + gFirstPage_ShowStoreBtns + ', gP4 = ' + gP4 + ', gP9 = ' + gP9 + ', gFirstPage_gclid = ' + gFirstPage_gclid ); }

			//	get referring website (i.e. url of website before hitting this website)
			if (document.referrer) { 
				if (document.referrer != "") { 
					ref = document.referrer.toLowerCase(); 
					gFirstPage_DocReferrer = ref;
				} 
			}

			//	try to determine primary interest of viewer (e.g. thermocouple,
			//	strain gage, thermistor). We first look at referrer, and
			//	if we don't see it here, we look at the current url
			//	e.g. (thermocouple.html)
			gFirstPage_PrimaryInterest = determine_interest( gFirstPage_DocReferrer );
			if (gFirstPage_PrimaryInterest == "") {
				gFirstPage_PrimaryInterest = determine_interest( gThisPage_URL );
			}

			//	get url of 1st page that is loaded for the session we remove preceeding stuff (e.g. http, file path)
			gFirstPage_FirstUrlOfSession_StartFromTop = gUrlOfThisPageStartingFromTopLevel;

			//	if there is no referring website and we have a p4 param, then
			//	scan the p4 param for a disti name
			if ((ref == "") && (gP4 != ""))  { ref = gP4.toLowerCase(); }
		
			//	Calculate Referrer Country and get 2 letter code, e.g. "uk" is england
			gFirstPage_Country = Calculate_Referrer_Country();
		
			var first_url_is_inet_website 	= (gThisPage_URL.toLowerCase().indexOf('instrunet.com') >= 0);
			var first_url_is_gwinst_website = (gThisPage_URL.toLowerCase().indexOf('gwinst.com') 	>= 0);
						
			//	=============================
			//	'gFirstPage_Search' is set to 3 letter code indicating search engine that got us here (e.g. "goo" means google).
			//	It is set to "" if we did not get here from search engine.

			gFirstPage_Search = Calculate_Search_Engine_Referrer( ref );
	
			we_got_here_from_search_engine = (gFirstPage_Search != "");
						
			//	=============================
			//	If we got here from a search engine, then we calculate the 
			//	keywords that user typed into search engine to get us here.
			//	e.g. if user typed "strain gage recorder" to get here, we calculate that text.

			if ( we_got_here_from_search_engine == true)	{

				gFirstPage_SearchTerm = Calculate_Search_Term_That_Got_Us_Here( gFirstPage_Search );

				user_got_here_by_typing_instrunet_keyword_into_search_engine_and_then_clicked_on_instrunet_item = (gFirstPage_SearchTerm == "instrunet") && first_url_is_inet_website;
				
				gFirstPage_SearchTerm_Is_WwwGwinstCom = (gFirstPage_SearchTerm == "www_gwinst_com");	//	true if search term is "www.gwinst.com", helps w/ testing
			}

			// alert("gFirstPage_Search = " + gFirstPage_Search + "\rgFirstPage_SearchTerm = " + gFirstPage_SearchTerm + "\rgFirstPage_FirstUrlOfSession_StartFromTop =" + gFirstPage_FirstUrlOfSession_StartFromTop + "\ruser_got_here_by_typing_instrunet = " + String(user_got_here_by_typing_instrunet_keyword_into_search_engine_and_then_clicked_on_instrunet_item) );

			// ============================
			//	If we got here via a link from a distributor website (e.g. referrer = "omega.com...")
			//	or someone is coming from a country that has an exclusive distributor, then this routine
			//	identifies that distributor (3 leter code) and name and places that info into
			//	variables "gDisti_code" and "gDisti_name".

			visitor_came_from_link_from_this_distributors_website = Calculate_Referring_Distributor_If_We_Got_Here_Via_Link_From_There_Website( ref );
			
			we_got_here_from_link_on_disti_website = (visitor_came_from_link_from_this_distributors_website.length > 0);
			
			// ============================
			//	Get 3 letter code of distributor (returned string) given 2 letter country code
			//	for the country that is managed by that distributor assuming that they are
			//	our 1st choice for customer to buy from.
			
			disti_that_handles_visitors_country = Calculate_Distributor_Given_2Letter_Country_Code( gFirstPage_Country );

			there_is_a_favored_disti_that_handles_users_country = (disti_that_handles_visitors_country.length > 0);

			// ============================
			//	Debugging
															//	debugging
															if ( gDebuggingAlertsOn ) { 
												
																testStr  = 'FIRST PAGE.\r\n\r\n';
																testStr += 'gFirstPage_SearchTerm = ' 						+ gFirstPage_SearchTerm 					+ '\r\n\r\n';
																testStr += 'ref = ' 										+ ref 										+ '\r\n\r\n';
																testStr += 'we_got_here_from_link_on_disti_website = ' 		+ we_got_here_from_link_on_disti_website	+ '\r\n\r\n'; 
																testStr += 'gFirstPage_Country = ' 							+ gFirstPage_Country 						+ '\r\n\r\n'; 
																testStr += 'disti_that_handles_visitors_country = ' 		+ disti_that_handles_visitors_country 		+ '\r\n\r\n'; 
																testStr += 'there_is_a_favored_disti_that_handles = ' 		+ there_is_a_favored_disti_that_handles_users_country + '\r\n\r\n';
																testStr += 'gSys = ' 										+ gSys 										+ '\r\n\r\n'; 
																testStr += 'gUsr = ' 										+ gUsr 										+ '\r\n\r\n'; 
																testStr += 'gLang = ' 										+ gLang 									+ '\r\n\r\n';

																alert(testStr);
															}

			//	=============================
			//	=============================
			//	=============================
			//	We now figure out what to show
			//	=============================
			//	=============================
			//	=============================

			//	If we are on local hard disk then all company names are not shown

			if ( 	gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd 
				|| 	user_got_here_by_typing_instrunet_keyword_into_search_engine_and_then_clicked_on_instrunet_item ) {
			
				gFirstPage_ShowContactMenu 		= false;  
				gFirstPage_ShowStoreBtns 		= false;
				gFirstPage_ShowGwinstHeader 	= false;
				gFirstPage_Referrer 			= "";
				gFirstPage_ReferrerDisplayedName= "";
			}
			else if ( gThisPage_IsFromLinkFrom_store_gwinst_com ) {
			
				gFirstPage_ShowContactMenu 		= true;  
				gFirstPage_ShowStoreBtns 		= true;
				gFirstPage_ShowGwinstHeader 	= true;
				gFirstPage_Referrer 			= "";
				gFirstPage_ReferrerDisplayedName= "";
			}
			else if ( we_got_here_from_link_on_disti_website ) {

				gFirstPage_ShowContactMenu 		= false;  
				gFirstPage_ShowStoreBtns 		= false;
				gFirstPage_ShowGwinstHeader 	= gCurrentFileIsFrom_WwwGwinstCom;
				gFirstPage_Referrer 			= visitor_came_from_link_from_this_distributors_website;
				gFirstPage_ReferrerDisplayedName= Get_Full_Name_Of_Distributor_Given_3Letter_CountryCode( visitor_came_from_link_from_this_distributors_website );
			}
			else if ( there_is_a_favored_disti_that_handles_users_country ) {

				gFirstPage_ShowContactMenu 		= false;  
				gFirstPage_ShowStoreBtns 		= false;
				gFirstPage_ShowGwinstHeader 	= true;
				gFirstPage_Referrer 			= disti_that_handles_visitors_country;
				gFirstPage_ReferrerDisplayedName= Get_Full_Name_Of_Distributor_Given_3Letter_CountryCode( disti_that_handles_visitors_country );
			}
						
			//	If the first url is "instruNet#128" or "instruNet#168" or "instruNet.com/contact"
			//	and we have not yet identified disti, then we show gwi logo and gwi disti contact info

			else if (End_User_Is_Looking_For_Contact_Info( gFirstPage_FirstUrlOfSession_StartFromTop ) || (g3CharDistiNameInUrl == 'gwi')) {

				gFirstPage_ShowContactMenu 		= true;  
				gFirstPage_ShowStoreBtns 		= true;
				gFirstPage_ShowGwinstHeader 	= true;
				gFirstPage_Referrer 			= "";
				gFirstPage_ReferrerDisplayedName= "";
			}

			//	If we got here via a search engine, then we show gwi company and store
			//	provided the search term is not "instrunet" (since disti might get mad)

			else if ( we_got_here_from_search_engine )	{

				//	if search term is "instrunet", then 'user_got_here_by_typing_instrunet_keyword_into_search_engine_and_then_clicked_on_instrunet_item' 
				//	will be true and will caught above and we do not show any company names and do not show store.
				//	Otherwise, we show gw instruments company and gwinst store.

				gFirstPage_ShowContactMenu 		= true;  
				gFirstPage_ShowStoreBtns 		= true; 
				gFirstPage_ShowGwinstHeader 	= true; 
				gFirstPage_Referrer 			= "";
				gFirstPage_ReferrerDisplayedName= "";
			}

			//	else we are coming here directly (i.e. user typed url or coming in via bookmark)
			//	and we show gwi company info if on www.gwinst.com url; yet not if on www.instrunet.com url. 

			else  {

				gFirstPage_ShowContactMenu 		= gCurrentFileIsFrom_WwwGwinstCom;  
				gFirstPage_ShowStoreBtns 		= gCurrentFileIsFrom_WwwGwinstCom;
				gFirstPage_ShowGwinstHeader 	= gCurrentFileIsFrom_WwwGwinstCom;
				gFirstPage_Referrer 			= "";
				gFirstPage_ReferrerDisplayedName= "";
			}

			//	============================
			//	============================
			//	============================
			//	If the URL contains special parameters at the end that turn on/off stuff, we honor that now.
			//	This overrides the above stuff since it is explicitly stated in url via p4 and p9 parameters.
			
			if ( gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd != true) {

 				if (visitorWants_ShowContactMenu == true) { gFirstPage_ShowContactMenu = true; }

 				if (vistorWants_ShowStoreBtns == true)    { gFirstPage_ShowStoreBtns = true; }
			}

			//	============================
			//	============================
			//	============================
	
			//	calculate cookie value
			var cookie_text = "";

			cookie_text += (gFirstPage_ShowContactMenu  ? 'c' : 'x');
			cookie_text += (gFirstPage_ShowStoreBtns 	? 'p' : 'x');
			cookie_text += (gFirstPage_ShowGwinstHeader ? 'g' : 'x');

			cookie_text += ('__1__' + gFirstPage_PrimaryInterest);
			cookie_text += ('__2__' + gFirstPage_ReferrerDisplayedName);
			cookie_text += ('__3__' + gFirstPage_Referrer);
			cookie_text += ('__4__' + gFirstPage_DocReferrer);
			cookie_text += ('__5__' + gFirstPage_FirstUrlOfSession_StartFromTop);
			cookie_text += ('__6__' + gFirstPage_Country);
			cookie_text += ('__7__' + gFirstPage_Search);				//	search engine that got us here, e.g. 'goo' means google
			cookie_text += ('__8__' + gFirstPage_gclid);				//	google adWords id term
			cookie_text += ('__9__' + gFirstPage_SearchTerm);			//	search term that got us here

			//	convert '/' chars to '-' to make it easier for cookie processor
			{
				var cookie_text_cleaned = ReplaceText(cookie_text, '\/', '-');
				cookie_text = cookie_text_cleaned;
			}

			//	save the cookie; and tell it to expire when browser closes
			setCookie(sCookie_name, cookie_text, 0);
																		//	debugging
																		gNumTimesCreatedCookie += 1;
																		if ( gDebuggingAlertsOn || gDebuggingCookies ) { 
																			valueOfSavedCookie = get_cookie( sCookie_name );
																			alert('we now saved this cookie. valueOfSavedCookie =' + valueOfSavedCookie + ', document.cookie = ' + document.cookie + ',  gNumTimesCreatedCookie = ' + gNumTimesCreatedCookie); 
																		}
	    }
		
		// ============================-
		//	else we are on page # >=2 of our session and we look at the
		//	the cookie that was settup on page #1 of user's session, which
		//	contains info about how the user got here and what we should show

		else	{

			var lengthOf = gOurCookies.length;
			if (lengthOf > 0)	{

				gFirstPage_ShowContactMenu     	= (gOurCookies.substring(0, 1) == 'c');
				gFirstPage_ShowStoreBtns    	= (gOurCookies.substring(1, 2) == 'p');
				gFirstPage_ShowGwinstHeader    	= (gOurCookies.substring(2, 3) == 'g');

				var one_offset   			=  gOurCookies.indexOf('__1__', 0);
				var two_offset   			=  gOurCookies.indexOf('__2__', one_offset);
				var three_offset 			=  gOurCookies.indexOf('__3__', two_offset);
				var four_offset  			=  gOurCookies.indexOf('__4__', three_offset);
				var five_offset  			=  gOurCookies.indexOf('__5__', four_offset);
				var six_offset   			=  gOurCookies.indexOf('__6__', five_offset);
				var seven_offset   			=  gOurCookies.indexOf('__7__', six_offset);
				var eight_offset   			=  gOurCookies.indexOf('__8__', seven_offset);
				var nine_offset   			=  gOurCookies.indexOf('__9__', eight_offset);

															//	calculate parameters that characterize the session
				if (one_offset > 1)   {  gFirstPage_PrimaryInterest 				= gOurCookies.substring(one_offset + 5,   two_offset);   }
				if (two_offset > 1)	  {  gFirstPage_ReferrerDisplayedName   		= gOurCookies.substring(two_offset + 5,   three_offset); }
				if (three_offset > 1) {  gFirstPage_Referrer           	 			= gOurCookies.substring(three_offset + 5, four_offset);  }
				if (four_offset > 1)  {  gFirstPage_DocReferrer       				= gOurCookies.substring(four_offset + 5,  five_offset);  }
				if (five_offset > 1)  {  gFirstPage_FirstUrlOfSession_StartFromTop	= gOurCookies.substring(five_offset + 5,  six_offset);   }
				if (six_offset > 1)   {  gFirstPage_Country      					= gOurCookies.substring(six_offset + 5,   seven_offset); }
				if (seven_offset > 1) {  gFirstPage_Search      					= gOurCookies.substring(seven_offset + 5, eight_offset); }
				if (eight_offset > 1) {  gFirstPage_gclid      						= gOurCookies.substring(eight_offset + 5, nine_offset);  }
				if (nine_offset > 1)  {  gFirstPage_SearchTerm      				= gOurCookies.substring(nine_offset + 5,  lengthOf);     }

															//	If the this url is "instruNet#128" or "instruNet#168" or "instruNet.com/contact"
															//	and contactUs was OFF, then we turn it on for this page (only), so that folks can do the contact
				if ( End_User_Is_Looking_For_Contact_Info( gThisPage_URL ) )  { gFirstPage_ShowContactMenu = true; } 
  
															//	debugging
															if ( gDebuggingAlertsOn || gDebuggingCookies ) { 
												
																valueOfSavedCookie = get_cookie(sCookie_name);

																testStr  = 'We just loaded cookie.\r\n\r\n';
																testStr += 'valueOfSavedCookie =' 			+ valueOfSavedCookie 					+ '\r\n\r\n';
																testStr += 'document.cookie = ' 			+ document.cookie 						+ '\r\n\r\n'; 
																testStr += 'gFirstPage_DocReferrer =' 		+ gFirstPage_DocReferrer 				+ '\r\n\r\n'; 
																testStr += 'gFirstPage_FirstUrlOfSession_StartFromTop =' + gFirstPage_FirstUrlOfSession_StartFromTop + '\r\n\r\n'; 
																testStr += 'gFirstPage_PrimaryInterest = ' 	+ gFirstPage_PrimaryInterest 			+ ',  ';
																testStr += 'gFirstPage_ReferrerDisplayedName = ' + gFirstPage_ReferrerDisplayedName + ',  ';
																testStr += 'gFirstPage_Referrer = ' 		+ gFirstPage_Referrer 					+ ',  ';
																testStr += 'gFirstPage_Country = ' 			+ gFirstPage_Country 					+ ',  ';
																testStr += 'gFirstPage_Search = ' 			+ gFirstPage_Search 					+ ',  ';
																testStr += 'gFirstPage_gclid = ' 			+ gFirstPage_gclid 						+ ',  ';
																testStr += 'gFirstPage_ShowContactMenu = ' 	+ String(gFirstPage_ShowContactMenu) 	+ ',  ';
																testStr += 'gFirstPage_ShowStoreBtns = ' 	+ String(gFirstPage_ShowStoreBtns) 		+ ',  ';
																testStr += 'gFirstPage_ShowGwinstHeader = ' + String(gFirstPage_ShowGwinstHeader) 	+ ',  ';

																alert(testStr);
															}
			}
		}
	}	

	//	============================================================================
	//	If the current file is from local hard disk, then we shut down ALL references to ALL companies and gwi store.

	if ( ! gCurrentFileIsFrom_InernetServer  ||  gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd) {

		gFirstPage_ShowContactMenu 		= false;  
		gFirstPage_ShowStoreBtns 		= false;
		gFirstPage_ShowGwinstHeader 	= false;
		gFirstPage_Referrer 			= "";
		gFirstPage_ReferrerDisplayedName= "";
	}

	//	============================================================================
	//	exit

	return;
}


// ============================
//	Calculate how we got here. You call this ONLY on the 1st page of the session. We look at the
//	referrer and if we see a search engine, we know we got here from a search engine. 
//	We return 3 letter code indicating search engine that got us here (e.g. "goo" means google).
//	We return "" if we did not get here from search engine.

function Calculate_Search_Engine_Referrer( ref_caller )
{
	if (gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd) { return ""; }

	var ref = ref_caller.toLowerCase();

		 if (ref.indexOf("search.yahoo")   >= 0) { return "yah"; }
	else if (ref.indexOf(".google.")       >= 0) { return "goo"; }
	else if (ref.indexOf(".bing.")  	   >= 0) { return "bin"; }
	else if (ref.indexOf(".altavista.")    >= 0) { return "alt"; }
	else if (ref.indexOf(".dogpile.")      >= 0) { return "dog"; }
	else if (ref.indexOf("dmoz.")          >= 0) { return "dmz"; }
	else if (ref.indexOf("search.msn")     >= 0) { return "msn"; }
	else if (ref.indexOf("guide.apple")    >= 0) { return "app"; }
	
	return "";
}

// ============================
//	If we got here from a search engine, then this calculates the
//	search keyword that go us here (e.g. if you type "strain gage" into google to get here
//	then this would then return "strain gage"). search_engine_3_letter_code is
//	type of search engine that got us here (e.g. "goo" is google).
//	We return '_' instead of space (' ') characters.

function Calculate_Search_Term_That_Got_Us_Here( search_engine_3_letter_code )
{
	var search_term = "";
	var start_key = "";
	var end_key = "&";

	//	============================
	//	init

	if (gCurrentFile_IsFrom_instruNetWebsiteInstalledOnEndUserLocalHd) { return ""; }

	else if (search_engine_3_letter_code == "") { return ""; }

	else if (document.referrer == "") { return ""; }

	var ref = document.referrer.toLowerCase() + end_key;

	//	============================
	//	google search, 	e.g. www.google.com...q=instrunet+strain+gauge&...
	//	bing search,	e.g. www.bing.com...q=instrunet+strain+gauge&...
	//	yahoo search, 	e.g. yahoo...p=instrunet+strain+gauge&...	

	if (search_engine_3_letter_code == "goo") { start_key = 'q='; }

	else if (search_engine_3_letter_code == "bin") { start_key = 'q='; }

	else if (search_engine_3_letter_code == "yah") { start_key = 'p='; }

	//	============================
	//	Calc search term. We return "_" intead of space character (" ").

	if (start_key == "") { return; }

	var temp1 	= Get_Text_Between_Two_Keys(			ref, start_key, end_key);
	var temp2 	= ReplaceMultipleInstancesOfAString(	temp1, 	' ', 	'_');
	var temp3 	= ReplaceMultipleInstancesOfAString(	temp2, 	'+', 	'_');
	var temp4 	= ReplaceMultipleInstancesOfAString(	temp3, 	'.', 	'_');
	search_term = ReplaceMultipleInstancesOfAString(	temp4, 	'%20', 	'_');

	//	============================
	//	exit

	// alert( 'search_term = ' + search_term + '\r\rREFERRER = ' + ref );

	return search_term;
}


// ============================
//	Given string str, we calculate text between k1 and k2

function Get_Text_Between_Two_Keys( str, k1, k2 )
{
	if ((str == "") || (k1 == "") || (k2 == "")) { return ""; }
	
	var start_index = Number( str.indexOf(k1) );

	if (start_index < 0)  { return ""; }

	var later_part_of_string = str.substring(start_index + k1.length, str.length);

	var stop_index = Number( later_part_of_string.indexOf(k2) );

	if (stop_index < 0)  { return ""; }

	var middle_part = later_part_of_string.substring(0, stop_index);

	return middle_part;
}

// ============================
//	If we got here via a link from a distributor website (e.g. referrer = "omega.com...")
//	or someone is coming from a country that has an exclusive distributor, then this routine
//	identifies that distributor (3 leter code) and name and places that info into
//	variables "gDisti_code" and "gDisti_name".

function Calculate_Referring_Distributor_If_We_Got_Here_Via_Link_From_There_Website( ref_caller )
{				
	var ref = ref_caller.toLowerCase();
	var gTestReferrerCode = false;

//	============================
//	INITIALIZE

	if ((gCurrentFileIsFrom_InernetServer != true) || gCurrentFileIsFrom_LocalHardDiskAndNotInternet) { return ""; }

//	=========		
//	OMEGA

	else if ((ref.indexOf("omega.com") >= 0)   || (g3CharDistiNameInUrl == "ome") || gTestReferrerCode) { return "ome"; }  // www.omega.com   (usa)
	else if ((ref.indexOf("omega.co.uk") >= 0) || (g3CharDistiNameInUrl == "omk") || gTestReferrerCode) { return "omk"; }  // www.omega.co.uk (UK)
	else if ((ref.indexOf("omega.de") >= 0)    || (g3CharDistiNameInUrl == "omd") || gTestReferrerCode) { return "omd"; }  // www.omega.co.uk (GERMANY)

//	=========		
//	USA

	else if ((ref.indexOf("cyberres") >= 0) || (g3CharDistiNameInUrl == "cyb")) 					{ return "cyb"; }
	else if ((ref.indexOf("elotek") >= 0)   || (g3CharDistiNameInUrl == "eok")) 					{ return "eok"; }
	else if ((ref.indexOf("instrumentsys.com") >= 0) || (g3CharDistiNameInUrl == "isy")) 			{ return "isy"; }

//	=========		
//	Australia

	else if ((ref.indexOf("scitech") >= 0) || (g3CharDistiNameInUrl == "sci"))  					{ return "sci"; } 

//	=========		
//	Belguim

	else if ((ref.indexOf("peekel") >= 0)        || (g3CharDistiNameInUrl == "pee")) 				{ return "pee"; }

//	=========		
//	Canada

	else if ((ref.indexOf("dycor") >= 0) || (g3CharDistiNameInUrl == "dyc"))  						{ return "dyc"; }

//	=========		
//	Denmark

	else if ((ref.indexOf("ntt") >= 0) || (g3CharDistiNameInUrl == "ntt"))  						{ return "ntt"; }

//	=========		
//	Finland

	else if ((ref.indexOf("elkome") >= 0) || (g3CharDistiNameInUrl == "elk"))  						{ return "elk"; }

//	=========		
//	France

	else if ((ref.indexOf("mdelect") >= 0) || (g3CharDistiNameInUrl == "mde"))  					{ return "mde"; }

//	=========		
//	Germany

	else if ((ref.indexOf("geitmann") >= 0) || (g3CharDistiNameInUrl == "gei"))  					{ return "gei"; }
	else if ((ref.indexOf("measx") >= 0)    || (g3CharDistiNameInUrl == "mea"))  					{ return "mea"; }
	else if ((ref.indexOf("additive") >= 0) || (g3CharDistiNameInUrl == "add"))  					{ return "add"; }

//	=========		
//	Great Britian

	//	www.measurementsystems.co.uk is same website as www.measys.com 
	else if ((ref.indexOf("measys") >= 0) || (ref.indexOf("measurementsystems") >= 0) || (gP4 == "msy") || (g3CharDistiNameInUrl == "msy")) { return "msy"; } 

//	=========		
//	India

	else if ((ref.indexOf("aimil") >= 0) || (g3CharDistiNameInUrl == "aim"))  						{ return "aim"; }

//	=========		
//	Ireland

//	=========		
//	Israel

	else if ((ref.indexOf("instrumetrics.com") >= 0) || (g3CharDistiNameInUrl == "itt")) 			{ return "itt"; }

//	=========		
//	Italy

	else if ((ref.indexOf("instrumentationdevices.it") >= 0) || (g3CharDistiNameInUrl == "inz")) 	{ return "inz"; }
	else if ((ref.indexOf("analysa") >= 0)  				 || (g3CharDistiNameInUrl == "ana"))  	{ return "ana"; }

//	=========		
//	Japan

	else if ((ref.indexOf("toyo") >= 0) || (g3CharDistiNameInUrl == "toy"))  						{ return "toy"; }

//	=========		
//	Korea

	else if ((ref.indexOf("koreatechmeas") >= 0) || (ref.indexOf("ktme") >= 0) || (gP4 == "kor")) 	{ return "kor"; }

//	=========		
//	Malaysia

	else if ((ref.indexOf(".optocom.com") >= 0) || (g3CharDistiNameInUrl == "opt")) 				{ return "opt"; }

//	=========		
//	Netherlands

	else if ((ref.indexOf("pimzos") >= 0)        || (g3CharDistiNameInUrl == "pim")) 				{ return "pim"; }
	else if ((ref.indexOf("fieldworks.nl") >= 0) || (g3CharDistiNameInUrl == "fie")) 				{ return "fie"; }

//	=========		
//	Norway

//	=========		
//	Switzerland

//	=========		
//	Sweden

	else if ((ref.indexOf("savenhitech") >= 0) || (gP4 == "sav")) 									{ return "sav"; }
	else if ((ref.indexOf("systemtech") >= 0)  || (gP4 == "ste")) 									{ return "ste"; }

//	=========		
//	Tiawan

	else if ((ref.indexOf("memstec") >= 0) || (g3CharDistiNameInUrl == "mem")) 						{ return "mem"; }
	else if ((ref.indexOf("sanlien") >= 0) || (g3CharDistiNameInUrl == "san")) 						{ return "san"; }

//	=========		
//	etc

	return "";
}



// ============================
//	Get filename of grahic to place in upper right corner (logo) 
//	given 3 letter disti code (_3_letter_disti_code). Some companies
//  have a grafic gif file that we use as the header. Whereas
//	others are just regular text. If the below fuction does not
//  have a graphic for a company, then it returns "" null string and 
//	then the caller will defer to regular text.

function Get_DistiLogo_InUpperRightCorner_Given_3Letter_CountryCode( _3_letter_disti_code )
{
	var disti =_3_letter_disti_code.toLowerCase();
	
	if ((gCurrentFileIsFrom_InernetServer != true) || gCurrentFileIsFrom_LocalHardDiskAndNotInternet) { return ""; }

	else if (disti == "ome")  { return "omega_logo_rt_350w_38h.gif"; } 		//	Omega (USA)	
	else if (disti == "omk")  { return "omega_uk_logo_rt_350w_38h.gif"; } 	//	Omega (UK)
	else if (disti == "omd")  { return "omega_de_logo_rt_350w_38h.gif"; } 	//	Omega (GERMANY)

	return "";
}

// ============================
//	Get full name of distributor (returned string) given 3 letter disti code (_3_letter_disti_code).

function Get_Full_Name_Of_Distributor_Given_3Letter_CountryCode( _3_letter_disti_code )
{
	var disti =_3_letter_disti_code.toLowerCase();
	
	if ((gCurrentFileIsFrom_InernetServer != true) || gCurrentFileIsFrom_LocalHardDiskAndNotInternet) { return ""; }

	else if (disti == "msy")  { return "www.measys.com"; } 		//	www.measurementsystems.co.uk is same website as www.measys.com 

	else if (disti == "ome")  { return "www.omega.com"; } 		//	Omega (USA)
	else if (disti == "omk")  { return "www.omega.co.uk"; }  	//	Omega (UK)
	else if (disti == "omd")  { return "www.omega.de"; } 		//	Omega (GERMANY)

	else if (disti == "cyb")  { return "www.cyberresearch.com";}//	cyber  (USA) 
	else if (disti == "eok")  { return "www.elotek.com";}		//	elotek (USA) 
	else if (disti == "isy")  { return "www.InstrumentSys.com";}//	instrumentsys (USA) 

	else if (disti == "sci")  { return "www.scitech.com.au"; } 	//	australia

	else if (disti == "pee")  { return "www.peekel.nl"; } 		//	belgium

	else if (disti == "dyc")  { return "www.dycor.com"; } 		//	canada

	else if (disti == "ntt")  { return "www.ntt.dk"; } 			//	denmark

	else if (disti == "elk")  { return "www.elkome.fi"; } 		//	finland, elkhome (was novotech)
	
	else if (disti == "mde")  { return "www.mdelectronic.fr"; } //	france

	else if (disti == "gei")  { return "www.geitmann.de"; } 	//	germany
	else if (disti == "mea")  { return "www.measx.com"; } 	 	//	germany
	else if (disti == "add")  { return "shop.additive-net.de"; }//	germany

	else if (disti == "aim")  { return "www.aimil.com"; } 		//	india

																//	Ireland

	else if (disti == "itt")  { return "www.instrumetrics.com";}//	Israel

																//	italy
	else if (disti == "inz")  { return "www.InstrumentationDevices.it"; } 
	else if (disti == "ana")  { return "www.analysa.it"; } 

	else if (disti == "toy")  { return "www.toyo.co.jp"; } 		//	japan

	else if (disti == "kor")  { return "www.koreatechmeas.com";}//	korea 

	else if (disti == "opt")  { return "www.optocom.com.my"; } 	//	malaysia

	else if (disti == "pim")  { return "www.pimzos.nl"; } 		//	netherlands
	else if (disti == "fie")  { return "www.fieldworks.nl"; } 

	else if (disti == "sav")  { return "www.savenhitech.se"; } 	//	sweden
	else if (disti == "ste")  { return "www.systemtech.se"; } 

	else if (disti == "mem")  { return "www.memstec.com.tw"; } 	//	taiwan
	else if (disti == "san")  { return "www.sanlien.com.tw"; } 

	return "";
}

// ============================
//	Get 3 letter code of distributor (returned string) given 2 letter country code
//	for the country that is managed by that distributor assuming that they are
//	our 1st choice for customer to buy from.

function Calculate_Distributor_Given_2Letter_Country_Code( _2_letter_country_code )
{
	var country =_2_letter_country_code.toLowerCase();

	if ((gCurrentFileIsFrom_InernetServer != true) || gCurrentFileIsFrom_LocalHardDiskAndNotInternet) { return ""; }

	else if (country == "au") { return "sci"; }		//	australia, scitech

	else if (country == "dk") { return "ntt"; }		//	denmark, ntt.dk

	else if (country == "fi") { return "elk"; }		//	finland, elkhome (was novotech)

	else if (country == "fr") { return "mde"; }		//	france, md electronics

	else if (country == "de") { return "gei"; }		//	germany, geitman
																
													//	Ireland

	else if (country == "il") { return "itt"; }		//	Israel, instrumetrics.com

	else if (country == "it") { return "inz"; }		//	italy, instrumentation devices

	else if (country == "jp") { return "toy"; }		//	japan, toyo

	else if (country == "kr") { return "kor"; }		//	korea, koreatechmeas

	else if (country == "my") { return "opt"; }		//	Malaysia, optocom

	else if (country == "nl") { return "pim"; }		//	Netherlands, pimzos

	else if (country == "se") { return "ste"; }		//	Sweden, systemtech

	else if (country == "tw") { return "mem"; }		//	Tiawan, memstec

	else if (country == "uk") { return "msy"; }		//	UK (england), www.measurementsystems.co.uk is same website as www.measys.com 

	return "";
}


// ============================
//	Calculate Referrer Country using the userLanguage selected on user computer.
//	We convert to 2 letter internet country code (e.g. uk is england). We convert to "nn" if Not Known.
//	We only handle the big countries.
//	Language Codes: http://msdn.microsoft.com/en-us/library/ms533052(VS.85).aspx
//	Country Codes: http://ftp.ics.uci.edu/pub/websoft/wwwstat/country-codes.txt
//	Converting IP address to country is more difficult since it involves 36K long database, ref: search "ip2country" in google.

function Calculate_Referrer_Country()
{
	// ============================
	//	look at referer language on computer

	var c = "";

	if (window.navigator.systemLanguage) {						//	The language used by OS, e.s. "en-us"
		gSys = window.navigator.systemLanguage.toString().toLowerCase();	
	}

	if (window.navigator.userLanguage) {						//	The language used by BROWSER, e.g. "en-us". 
		gUsr = window.navigator.userLanguage.toString().toLowerCase();		
	}

	// ============================
	//	Figure out if we are to look at userLanguage (browser) or systemLanguage (OS).
	
	if 		((gUsr == "") && (gSys == "")) { return "nn"; }		//	not known

	else if ((gUsr != "") && (gSys == "")) { gLang = gUsr; }	//	refer to userLanguage

	else if ((gUsr == "") && (gSys != "")) { gLang = gSys; }	//	refer to systemLanguage

	else {														//	else we have both userLanguage and systemLanguage

		if (gUsr == gSys) { gLang = gUsr; }						//	if they are the same, then use one of them

		else if (gUsr == "en-us") { gLang = gSys; }	 			//	if userLanguage is english, then refer to systemLanguage for something possibly different	

		else if (gSys == "en-us") { gLang = gUsr; }	  			//	if systemLanguage is english, then refer to userLanguage for something possibly different			

		else { gLang = gUsr; }									//	else use the userLanguage 
	}

	// ============================
	//	calc country code

	if (gLang == "") 			{ c = "nn"; }	//	not known

	else if (gLang == "en-us") 	{ c = "us"; }	//	usa
	else if (gLang == "en") 	{ c = "us"; }	//	usa

	else if (gLang == "en-au") 	{ c = "au"; }	//	australia

	else if (gLang == "en-gb") 	{ c = "uk"; }	//	United Kingdom
	else if (gLang == "en-ie") 	{ c = "ie"; }	//	Ireland

	else if (gLang == "en-ca") 	{ c = "ca"; }	//	Canada - English
	else if (gLang == "fr-ca") 	{ c = "ca"; }	//	Canada - French

	else if (gLang == "zh-tw") 	{ c = "tw"; }	//	Taiwan
	else if (gLang == "zh-cn") 	{ c = "cn"; }	//	Chinese (PRC) 
	else if (gLang == "zh-hk") 	{ c = "hk"; }	//	Hong Kong SAR
	else if (gLang == "zh-sg") 	{ c = "sg"; }	//	Singapore
	else if (gLang == "vi") 	{ c = "vn"; }	//	Vietnamese 
	else if (gLang == "ja") 	{ c = "jp"; }	//	Japanese
	else if (gLang == "ko") 	{ c = "kr"; }	//	Korean, south
	else if (gLang == "ms") 	{ c = "my"; }	//	Malaysia

	else if (gLang == "cs")    	{ c = "cz"; }	//	Czech
	else if (gLang == "da")    	{ c = "dk"; }	//	Denmark = Danish
	else if (gLang == "nl")    	{ c = "nl"; }	//	Netherlands = Holland - Dutch Langage(Standard) 
	
	else if (gLang == "sv") 	{ c = "se"; }	//	Sweeden - Swedish Langauge 
 	else if (gLang == "fi") 	{ c = "fi"; }	//	Finland - Finnish language
	else if (gLang == "no") 	{ c = "no"; }	//	Norwegian

	else if (gLang == "nl-be") 	{ c = "be"; }	//	Belgium - Dutch language
	else if (gLang == "fr-be") 	{ c = "be"; }	//	Belgium - French 

	else if (gLang == "fr-ch") 	{ c = "ch"; }	//	Switzerland - French
	else if (gLang == "de-ch") 	{ c = "ch"; }	//	Switzerland - German

	else if (gLang == "fr-lu") 	{ c = "lu"; }	//	Luxembourg - French  
	else if (gLang == "de-lu") 	{ c = "lu"; }	//	Luxembourg - German 

	else if (gLang == "fr") 	{ c = "fr"; }	//	French (Standard)  

 	else if (gLang == "de")   	{ c = "de"; }	//	German   

	else if (gLang == "de-at") 	{ c = "at"; }	//	Austria - German
	else if (gLang == "pl") 	{ c = "pl"; }	//	Poland - Polish

	else if (gLang == "il")   	{ c = "il"; }	//	Israel

	else if (gLang == "it")   	{ c = "it"; }	//	Italian (Standard)
	else if (gLang == "it-ch") 	{ c = "it"; }	//	Italian (Switzerland) 

	else if (gLang == "es") 	{ c = "es"; }	//	Spain - Spanish
	else if (gLang == "es-mx") 	{ c = "mx"; }	//	Mexico - Spanish
	else if (gLang == "pt-br") 	{ c = "br"; }	//	Brazil

	else if (gLang == "ru") 	{ c = "ru"; }	//	Russian
	else if (gLang == "uk") 	{ c = "ua"; }	//	Ukrainian

												//	India - they use english

	else						{ c = "nn"; }	//	not known

	if (c.length > 2) 			{ c = "nn"; }	//	not known

	return c;
}


// ============================
//	If the current url is "instruNet#128" or "instruNet#168" or "instruNet.com/contact"
//	then we assume the user is looking for contact info.

function End_User_Is_Looking_For_Contact_Info( url_of_current_page )
{
	var url = url_of_current_page.toLowerCase();
		
	//	look at url, e.g. ?9=cxgwi has 0th char set to 'c' which means contact should be on
	var param_9_has_c_field_set_indicating_contactOn 
		= (GetParameter_PassParamsToJavaScript(url, 9).substring(0, 1) == 'c');

	var end_user_is_looking_for_contact_info 
		= 	(	(url.indexOf('instrunet.com#128') 		>= 0) 	
		||		(url.indexOf('instrunet.com#168') 		>= 0) 
		||		(url.indexOf('instrunet.com/#128') 		>= 0) 
		||		(url.indexOf('instrunet.com/#168') 		>= 0) 
		||		(url.indexOf('instrunet.com/contact') 	>= 0)
		||		( param_9_has_c_field_set_indicating_contactOn ) );

	return end_user_is_looking_for_contact_info;
}

// ============================
//	inet_OnLoad()
//
//	Called by Onload event, which means BODY file has already been loaded 
//	(and printed via jscript document.write() code) and objects (e.g. list of
//	A links, items with ID's) exists at this time.
function inet_OnLoad()
{
	// ============================
	//	Go to ALL 'A' link objects (50 to 130 of them) and append
	//	"?9=XYZZZ" to them so that if someone copies a URL to
	//	they will get back the x/y/zz state (contactus/prices/disti)
	
	//	 This is buggy on local hd w/ # anchors and buggy on internet; we we permanently turn it OFF
	//	 This is buggy on local hd w/ # anchors and buggy on internet; we we permanently turn it OFF
	//	 This is buggy on local hd w/ # anchors and buggy on internet; we we permanently turn it OFF

													//	always off
													if ( gTackSummaryToUrl ) {
													
														//	if changing all A link search fields is NOT disabled manually ...
														if ( ! gDonChangeSearchOnAll_A_Links )	{
												
															//	if we have '?9=XYZZZ' info...
															if (gP9_SessionSummary != "") {
												
																//	if this page has A links...
																if (document.links != null)	{
												
																	//	Get list of all A link objects in this page.
																	//	Since each menu item is an A link, this is 50 to 150 objects.
																	var a_links = document.links;
																	if (a_links != null) {
												
																		// alert('coll.length = ' + coll.length);
																		for (i=0; i < a_links.length; i++) 	{
																			var href_target = a_links[i].href.toLowerCase();
																			if (href_target != "")	{
													
																				//	if this is a tag that connects to this web site
																				if ((href_target.indexOf('javascript:') <= -1)	 &&
																					(href_target.indexOf('http') <= -1)	 		 &&
																					(href_target.indexOf('mailto') <= -1)	 	 &&	
																					(href_target.indexOf('ftp:') <= -1)			 &&
																					(href_target.substring(0, 1) != '#')		 &&
																					(href_target != '#'))	{
														
																					//	add '?9=XYZZZ' suffix if it does not already have a suffix
																					if (a_links[i].search == "")	{
												
																						a_links[i].search = gP9_SessionSummary;	
																						//	this works in testing: ssoftware/iw/tutorial/index.html?9=xxome#eyw
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}

	return;
}

// ============================
// After Load Relative Reference to other files, determine href to download/, contact/, images/ & homepage

function After_load_relative_ref_to_other_files()
{
	if (document.getElementById) { 					//	IE >= v5, NS >= v6

		if ((element = document.getElementById( 'home_page_ref' )) != "") { 

			gHome_page_ref 			= element.href.toLowerCase();  
			gTop_level_ref 			= gHome_page_ref.replace('index.html', '');
			gContact_page_ref 		= gHome_page_ref.replace('index.html', 'contact\/index.html');
			gDownload_Folder_ref 	= gHome_page_ref.replace('index.html', 'download\/');  
			gImages_Folder_ref		= gHome_page_ref.replace('index.html', 'images\/');  
			gImages_Menu_Folder_ref	= gHome_page_ref.replace('index.html', 'images\/menu\/'); 
			gProducts_Folder_ref 	= gHome_page_ref.replace('index.html', 'products\/');  
			gProductsIndexPage_ref 	= gProducts_Folder_ref + 'index.html'; 
			gProgramming_Folder_ref = gHome_page_ref.replace('index.html', 'programming\/');  
			gReference_Folder_ref   = gHome_page_ref.replace('index.html', 'reference\/');  
			gSoftware_Folder_ref    = gHome_page_ref.replace('index.html', 'software\/');  
			gDataAcq_Folder_ref     = gHome_page_ref.replace('index.html', 'data_acquisition\/');  
		}

		if ((element = document.getElementById( 'data_acq_ref' )) != "") { 
			gDataAcq_Folder_ref 	= element.href.toLowerCase().replace('index.html', '');  
		}

		if ((element = document.getElementById( 'software_ref' )) != "") { 
			gSoftware_Folder_ref 	= element.href.toLowerCase().replace('index.html', '');  
		}

		if ((element = document.getElementById( 'p_index_ref' )) != "") { 
			g_p_Folder_ref 			= element.href.toLowerCase().replace('index.html', '');  
		}
	}
}

// ============================
//	Print instruNet description leftNav area

function Print_instruNetDescription_LeftNav_HtmlCode()
{
	var t = "";

	t += '<table width=\"175\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
	t += '<tr><td width=\"165\"><div id=\"p7TMnav\">';

 	t += '<div>';
			
		t += '<a href="#" onclick="P7_TMenu(this);return false">instruNet Products</a>';
	
		//	var gPre  = 'div a href='
		//	var gPost = 'a div' 
		t += gPre + gProducts_Folder_ref   + 'index.html\">Summary' 					+ gPost;
		t += gPre + g_p_Folder_ref 		  + 'index.html\">List of Products' 		+ gPost;
		t += gPre + gProductsIndexPage_ref + '#sensors\">Compatible Sensors' 		+ gPost;
		t += gPre + gProductsIndexPage_ref + '#cr\">Compatible Computers' 			+ gPost;
		t += gPre + gProductsIndexPage_ref + '#i4xx_cards\">i4xx Cards' 				+ gPost;
		t += gPre + gProductsIndexPage_ref + '#cardcage\">i40x Card Cage' 			+ gPost;
		t += gPre + gProductsIndexPage_ref + '#i2x0_summary\">i2x0 DSP Cards' 		+ gPost;
		t += gPre + gProductsIndexPage_ref + '#network\">instruNet Network' 			+ gPost;
		t += gPre + gProductsIndexPage_ref + '#devices\">instruNet Devices' 			+ gPost;
		t += gPre + gProductsIndexPage_ref + '#software\">Software' 					+ gPost;
		
	t += '<\/div>';

 	t += '<div>';
			
		t += '<a href="#" onclick="P7_TMenu(this);return false">i4xx Cards</a>';

		t += gPre + g_p_Folder_ref + 'i4xx_auto/i420.html\">i420 10x Vin'			+ gPost;
		t += gPre + g_p_Folder_ref + 'i4xx_auto/i423.html\">i423 6x Vin'				+ gPost;
		t += gPre + g_p_Folder_ref + 'i4xx_auto/i430.html\">i430 a/d &amp; 10x Vin'	+ gPost;
		t += gPre + g_p_Folder_ref + 'i4xx_auto/i460.html\">i460 28x Dio'			+ gPost;

	t += '<\/div>';

 	t += '<div>';
			
		t += '<a href="#" onclick="P7_TMenu(this);return false">System Design</a>';

		t += gPre + gProducts_Folder_ref 	+ 'faq.html\">Configuring Your InstruNet System'	+ gPost;
		t += gPre + gDataAcq_Folder_ref  	+ 'index.html\">Compatible Sensors and Controls'	+ gPost;
		t += gPre + gSoftware_Folder_ref 	+ 'index.html\">Application Software' 				+ gPost;
		t += gPre + gProgramming_Folder_ref  + 'index.html\">Programming in C or Visual Basic' 	+ gPost;
		t += gPre + gProducts_Folder_ref 	+ 'batteries.html">Powering from Batteries' 		+ gPost;

	t += '<\/div>';

	t += '<\/div><\/td><\/tr>';

	t += '<tr><td width=\"10\">&nbsp;<\/td><\/tr>';

	t += '<\/table>';   

	document.write( t );
	t = "";

	//	update twisties as needed, and then show entire left nav area (set display to show)
	Set_Up_Left_Nav_Area_Right_After_Loading_It();
}



// ============================
//	Print Product List leftNav area

function Print_ProductList_LeftNav_HtmlCode()
{
	var t = "";

	t += '<table width=\"175\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
	t += '<tr><td width=\"165\"><div id=\"p7TMnav\">';

	t += gPre + g_p_Folder_ref + 'index.html\">     List of Products' 				+ gPost;
	t += gPre + g_p_Folder_ref + 'i100/index.html\">i100 Device' 					+ gPost;
	t += gPre + g_p_Folder_ref + 'i240/index.html\">i240 USB Controller' 			+ gPost;
	t += gPre + g_p_Folder_ref + 'i230/index.html\">i230 PCMCIA Controller' 			+ gPost;
	t += gPre + g_p_Folder_ref + 'i200/index.html\">i200 PCI Controller' 			+ gPost;
	t += gPre + g_p_Folder_ref + 'i312/index.html\">i312 Power Supply' 				+ gPost;
	t += gPre + g_p_Folder_ref + 'i330/index.html\">i330 Isolator' 					+ gPost;
	t += gPre + g_p_Folder_ref + 'i400/index.html\">i400 Card Cage' 					+ gPost;
	t += gPre + g_p_Folder_ref + 'i410/index.html\">i410 Interface' 					+ gPost;

	t += gPre + g_p_Folder_ref + 'i4xx_auto/i420.html\">i420 20x Vin' 				+ gPost;
	t += gPre + g_p_Folder_ref + 'i4xx_auto/i423.html\">i423 6x Vin &amp; Filter'	+ gPost;
	t += gPre + g_p_Folder_ref + 'i4xx_auto/i430.html\">i430 A/D, 16x Vin, Vout' 	+ gPost;
	t += gPre + g_p_Folder_ref + 'i4xx_auto/i460.html\">i460 28x Dio' 				+ gPost;
	
	t += gPre + g_p_Folder_ref + 'i510/index.html\">i510 Wiring Box' 				+ gPost;
	t += gPre + g_p_Folder_ref + 'i530/index.html\">i530 Bracket' 					+ gPost;
	t += gPre + g_p_Folder_ref + 'resistor/index.html\">Precision Resistors' 		+ gPost;

	t += '<\/div><\/td><\/tr>';
	t += '<tr><td width=\"10\">&nbsp;<\/td><\/tr>';
	t += '<\/table>';   

	document.write( t );
	t = "";

	//	update twisties as needed, and then show entire left nav area (set display to show)
	Set_Up_Left_Nav_Area_Right_After_Loading_It();
}

// ============================
//	TOP MENUBAR (not leftNav) items 

function Print_MenuBar_Item_htmlCode()
{
	var t= "";

	//	=========
	//	HOME

	t += Calc_MenuBar_Item_htmlCode	('p7TBtrig10', '300', 'p7TBim10', '0',  '52',  'menu_home.gif',     'menu 1', gHome_page_ref);
	document.write( t );
	t = "";

	//	=========
	//	PRODUCTS

	t += Calc_MenuBar_Item_htmlCode('p7TBtrig20', '300', 'p7TBim20', '52', '82', 'menu_products.gif', 'menu 2', 'javascript:;');

	t += Calc_Menu_Item_PullDown_PRE('p7TBsub20', '400', '52', '203');
	
	t += Calc_Menu_Item_Choice( 203, cp_top, 'Product Family Overview', 	gProducts_Folder_ref + 'index.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Product List', 			g_p_Folder_ref 		 + 'index.html');

	t += Calc_Menu_Item_Choice( 203, cp_mid, 'i4xx Cards', 				gProducts_Folder_ref + 'index.html#i4xx_cards');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'i4xx Card Cage', 			g_p_Folder_ref 		 + 'i400/index.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'i240 USB Controller', 		g_p_Folder_ref 		 + 'i240/index.html');

	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Analog Input', 			gDataAcq_Folder_ref + 'a_to_d/voltage_measurement.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Analog Output', 			gDataAcq_Folder_ref + 'd_to_a/voltage_output.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Digital Input', 			gDataAcq_Folder_ref + 'digital_input/ttl_voltage.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Digital Output', 			gDataAcq_Folder_ref + 'digital_output/ttl_voltage.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Isolated On/Off Switch', 	gDataAcq_Folder_ref + 'isolated_digital_output/spst_signal_switch.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Resistance Measurement', 	gDataAcq_Folder_ref + 'resistance/measurement.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Force Measurement', 		gDataAcq_Folder_ref + 'force/strain_gage.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Temperature Measurement', 	gDataAcq_Folder_ref + 'temperature/rtd.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Position Measurement', 	gDataAcq_Folder_ref + 'position/potentiometer.html');
	t += Calc_Menu_Item_Choice( 203, cp_mid, 'Counter/Timer', 			gDataAcq_Folder_ref + 'counter_timer/event_count.html');
	t += Calc_Menu_Item_Choice( 203, cp_bot, 'Analog Low Pass Filters', 	gDataAcq_Folder_ref + 'analog_filter/anti_aliasing_low_pass_filter.html');
	
	t += Calc_Menu_Item_PullDown_POST();
	document.write( t );
	t = "";

	//	=========
	//	SOFTWARE

	t += Calc_MenuBar_Item_htmlCode('p7TBtrig30', '300', 'p7TBim30', '134', '83', 'menu_software.gif', 'menu 3', 'javascript:;');

	t += Calc_Menu_Item_PullDown_PRE('p7TBsub30', '400', '134', '222');

	t += Calc_Menu_Item_Choice( 222, cp_top, 'InstruNet World (iW)', 		gSoftware_Folder_ref + 'iw/index.html');
	t += Calc_Menu_Item_Choice( 222, cp_mid,'InstruNet World Plus (iW+)',	gSoftware_Folder_ref + 'iw+/index.html');
	t += Calc_Menu_Item_Choice( 222, cp_mid, 'Direct to Excel', 			gSoftware_Folder_ref + 'dtexcel/index.html"');
	t += Calc_Menu_Item_Choice( 222, cp_mid, 'LabView', 					gSoftware_Folder_ref + 'labview/index.html');
	t += Calc_Menu_Item_Choice( 222, cp_mid, 'DasyLab', 					gSoftware_Folder_ref + 'dasylab/index.html');
	t += Calc_Menu_Item_Choice( 222, cp_mid, 'Macintosh SuperScope II', 	gTop_level_ref 		 + 'macsftwr/html/ss2_summary.html');
	t += Calc_Menu_Item_Choice( 222, cp_mid, 'Macintosh SoundScope', 		gTop_level_ref 		 + 'macsftwr/html/sos_summary.html');
	t += Calc_Menu_Item_Choice( 222, cp_bot, 'Programming in C or Basic',	gProgramming_Folder_ref + 'index.html');

	t += Calc_Menu_Item_PullDown_POST();
	document.write( t );
	t = "";

	//	=========
	//	REFERENCE

	t += Calc_MenuBar_Item_htmlCode('p7TBtrig40', '300', 'p7TBim40', '217', '85', 'menu_ref.gif', 'menu 4', 'javascript:;');

	t += Calc_Menu_Item_PullDown_PRE('p7TBsub40', '400', '217', '230');

	t += Calc_Menu_Item_Choice( 230, cp_top, 'Product List', 							g_p_Folder_ref 			+ 'index.html');
	t += Calc_Menu_Item_Choice( 230, cp_mid, 'Application Software', 					gSoftware_Folder_ref 	+ 'index.html');
	t += Calc_Menu_Item_Choice( 230, cp_mid, 'Programming in C or Visual Basic', 		gProgramming_Folder_ref + 'index.html');
	t += Calc_Menu_Item_Choice( 230, cp_mid, 'Compatible Sensors and Controls', 		gDataAcq_Folder_ref 	+ 'index.html');
	t += Calc_Menu_Item_Choice( 230, cp_bot, 'Advanced Techniques', 					gReference_Folder_ref   + 'at/index.html');

	t += Calc_Menu_Item_PullDown_POST();
	document.write( t );
	t = "";

	//	=========
	//	GETTING STARTED

	t += Calc_MenuBar_Item_htmlCode('p7TBtrig50', '300', 'p7TBim50', '302', '129', 'menu_started.gif', 'menu 5', 'javascript:;');

	t += Calc_Menu_Item_PullDown_PRE('p7TBsub50', '400', '255', '230');

	t += Calc_Menu_Item_Choice( 255, cp_top, 'Installation', 							gTop_level_ref 		 + 'installation/index.html');
	t += Calc_Menu_Item_Choice( 255, cp_mid, 'instruNet World Tutorial', 				gSoftware_Folder_ref + 'iw/tutorial/index.html');
	t += Calc_Menu_Item_Choice( 255, cp_mid, 'Connecting to Sensors and Controls', 		gDataAcq_Folder_ref  + 'howtoconnect.html');
	t += Calc_Menu_Item_Choice( 255, cp_mid, 'Setting Up a Digitization', 				gSoftware_Folder_ref + 'iw/index.html#suad');
	t += Calc_Menu_Item_Choice( 255, cp_mid, 'Working with Files', 						gSoftware_Folder_ref + 'iw/index.html#wwf2');
	t += Calc_Menu_Item_Choice( 255, cp_mid, 'Working with Digital Filters', 			gSoftware_Folder_ref + 'iw/tutorial/index.html#wwf');
	t += Calc_Menu_Item_Choice( 255, cp_bot, 'Troubleshooting', 						gTop_level_ref 		 + 'trouble/index.html');

	t += Calc_Menu_Item_PullDown_POST();
	document.write( t );
	t = "";

	//	=========
	//	exit

}

// ============================

function Calc_MenuBar_Item_htmlCode(div_name, div_z_index, img_name, img_left, img_width, img_gif_file, alt_text, target_path_and_filename)
{
	var t = "";

	if (Number( img_left ) > Number(gPage_body_width)) { return; }

	t += '<div id=\"' + div_name + '\" style=\"position:absolute; left:' + String(img_left) + 'px; top: 50px; width:' + String(img_width) + 'px; z-index:' + String(div_z_index) + '; visibility: visible\">';
	
		t += '<a href=\"' + target_path_and_filename + '" onmouseover=\"P7_trigMM2(\'' + img_name + '\')\">';

			t += '<img src=\"' + gImages_Menu_Folder_ref + img_gif_file + '\" alt=\"' + alt_text + '\" name=\"' + img_name + '\" id=\"' + img_name + '\" width=\"' + String(img_width) + '\" height=\"20\" border=\"0\">';

		t += '<\/a>';

	t += '<\/div>';

	return t;
}

// ============================

function Calc_Menu_Item_PullDown_PRE(pullDown_name, z_index, pullDown_left, pullDown_width)
{
	var t = "";

	t += '<div id=\"' + pullDown_name + '\" class=\"p7tbsub\" style=\"position:absolute; left: ' + String(pullDown_left) + 'px; top: 70px; width: ' + String(pullDown_width) + 'px; z-index: ' + String(z_index) + '; visibility: hidden\">';
	
	t += '<table width=\"' + String(pullDown_width) + '\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';

	return t;
}

// ============================

function Calc_Menu_Item_PullDown_POST()
{
	var t = "";

	t += '<\/table><\/div>';

	return t;
}

 // ============================
//	Calc menubar choice

function Calc_Menu_Item_Choice(pullDown_width, cp_position, item_name, href_path_and_filename)
{
	var t = "",  widthStr = "", colorStr = "", classStr = "";

	if ((Number( cp_position ) == Number(cp_top)) || 
		(Number( cp_position ) == Number(cp_bot))) 	{ widthStr =  ' width=\"' + pullDown_width + '\" '; }

	if (Number( cp_position ) == Number(cp_bot)) 	{ colorStr = ' bgcolor=\"#E6DFCE\" '; }

	if (Number( cp_position ) == Number(cp_bot)) 	{ classStr = ' class=\"p7menuNOBOTT\" '; }
	else 											{ classStr = ' class=\"p7menuBOTT\" '; }

	t += '<tr><td ' + widthStr +  colorStr + classStr + '><a href=\"' + href_path_and_filename + '\">' + item_name + '<\/a><\/td><\/tr>';

	return t;
}

// ============================
//	Print Download/contact/Search top menu items 

function Print_Download_And_Search_Btns()
{
	var t = "";
	var pCode_thisPage = "";
	var catCode_thisPage = "";
	var a_link_html = "";

	if ((gDownload_Folder_ref == "") || (gImages_Folder_ref == "")) { return; }

	// ==================================
	//	"Download" top menu button

	t += Calc_MenuBar_Item_htmlCode('p7TBtrig60', '300', 'p7TBim60', '431', '88',  'menu_download.gif', 'menu 6', gDownload_Folder_ref + 'index.html');

	// ==================================
	//	"ContactUs" top menu button

	if (gFirstPage_ShowContactMenu && (gContact_page_ref != "")) {
		t += Calc_MenuBar_Item_htmlCode('p7TBtrig70', '300', 'p7TBim70', '519', '96', 'menu_contact.gif', 'menu 7', gContact_page_ref);
	}

	// ==================================
	//	When one moves mouse away from pull down menu that has dropped down, this code causes it 
	//	to disappear (370 height, lower z index than pull down menus).

	t += '<div id=\"P7TabH\" style=\"position:absolute; left: 0px; top: 0px; z-index: 200; visibility: hidden\">';
		t += '<a href=\"javascript:;\" onmouseover=\"P7_trigMM2()\">';
		t += '<img src=\"' + gImages_Folder_ref + 'shim.gif\" alt=\"\" width=\"98%\" height=\"370\" border=\"0\"></a>';
	t += '</div>'; 

	// ==================================
	//	See if we have room for search field, and if so, put it in

	var filler_before_search_field_LEFT = 519;

	var search_button_width = 48;
	var search_button_left = Number(gPage_body_width) - search_button_width;
	var window_right_edge = gPage_body_width;

	var search_field_width = 105;
	var search_field_left = Number(search_button_left) - search_field_width;

	var button_to_right_edge = 8;

	if (search_field_left > filler_before_search_field_LEFT) { 
		
		<!-- Google ThisSite Search -->  
		t += '<form method=\"get\" action=\"http://www.google.com/search\">';

			t += '<input type=\"text\"	 name=\"q\"  maxlength=\"254\" value=\"\" ';  
			t += '       style=\"font-family:Arial, Helvetica, sans-serif; font-size:10px; ';   
			t += '       position:absolute; line-height:100%; left: ' + String(search_field_left) + 'px;  top:50px; height:14px; width: ' + String(search_field_width) + 'px; ';   
			t += '       padding-top:3px; padding-bottom:0px; z-index:120; margin:0px; border:1px;\">';  
			
			t += '<input type=\"image\" ';  						
			t += '       src=\"' + gImages_Folder_ref + 'menu/menu_searchbtn.png\"  alt=\"Search\" ';  
			t += '       style=\"position:absolute;  left:' + String(search_button_left) + 'px;  top:49px; height:20px; width: ' + String(search_button_width) + 'px;  z-index:120; \"> ';
			
			//	search "instrunet.com" or "gwinst.com"
			t += '<input type=\"hidden\"  name=\"sitesearch\" value=\"' + gBaseUrl_IfOnInternet_short + '\">';  

		t += '</form>';

		filler_before_search_field_width = search_field_left -  filler_before_search_field_LEFT;
	}
	else {
		filler_before_search_field_width = Number(gPage_body_width) - filler_before_search_field_LEFT;
	}

	// ==================================
	//	Filler Before Search Field, and also puts border line under the search field

	t += '<div 	id=\"Layer1\"   style=\"position:absolute; ';
 	t +=	'       	left:'  + String(filler_before_search_field_LEFT)  + 'px;';
 	t +=	'       	width:' + String(filler_before_search_field_width) + 'px;';
 	t +=	'       	clip:rect(auto ' + String(gPage_body_width - filler_before_search_field_LEFT) +  'px auto auto); ';
	t +=	'      		top:50px; height:20px; z-index:100; visibility: visible;\">'; 
		
		t += '<img   src=\"' + gImages_Folder_ref + 'menu/menu_filler_600w_20h.png\" ';
		t += '		width=\"600\" height=\"20\">'; 
		
	t += '</div>';

	// ==================================
	//	Add store buttons if we are on www.gwinst.com (as opposed to generic www.instrunet.com)

	if ( gFirstPage_ShowStoreBtns ) {
		
		// ==================================
		//	BUY IT button is added if HEAD contains javascript pCode string w/ pCode:
		//
		//	Add the following code to .html page to turn BUY IT button on:
		//		<script language="JavaScript" type="text/JavaScript">var gPcode='iNet-240';</script>
		//		<script language="JavaScript" type="text/JavaScript">var gCatCode='6';</script>

		pCode_thisPage   = Get_ProductCode_ForThisPage();
		catCode_thisPage = Get_CategoryCode_ForThisPage();

		if ((pCode_thisPage != "") || (catCode_thisPage != "")) {
		
			var BuyIt_ButtonHtml = Calculate__IMAGE__BUY_IT_html( pCode_thisPage, catCode_thisPage );

			var topCoord = (gThisPage_URL.indexOf("i4xx_auto") != -1) ? "130" : "100";

			t += '<div 	id=\"BuyItButton\"  style=\"position:absolute; ';
			t +=	'       	left:'  + String(search_button_left - 40)  + 'px;';
			t +=	'      		top:' + topCoord + 'px; z-index:100; visibility: visible;\">'; 
				
				t += BuyIt_ButtonHtml;	//	<a href="www.gwinst.com"><image buy_it_button_16h_57w.png></a>
				
			t += '</div>';
		}

		// ==================================
		//	Add store button "My Account", http://www.gwinst.com/myaccount.asp

		t += '<div 	class=\"header_btn\"  style=\"left:' + String(window_right_edge - (66 + button_to_right_edge))  + 'px; top:5px; \">';
			//	<a href=total_url + options_added_to_a_link + trackOutboundLink >;
			t += Calc_A_Link_Hmtl('myaccount', (g_gwiStore_url + '/myaccount.asp'), 'class=\"image_link\"');
				t += '<img src=\"' + gImages_Folder_ref + 'buttons/btn_myaccount_66w_10h.gif\" border=\"0\" width=\"66\" height=\"10\">'; 
			t += '</a>';
		t += '</div>';

		// ==================================
		//	Add store button "View Cart", http://www.gwinst.com/shoppingcart.asp

		t += '<div 	class=\"header_btn\"  style=\"left:' + String(window_right_edge - (57 + button_to_right_edge))  + 'px; top:20px; \">'; 		
			t += Calc_A_Link_Hmtl('shoppingcart', (g_gwiStore_url + '/shoppingcart.asp'), 'class=\"image_link\"');
				t += '<img src=\"' + gImages_Folder_ref + 'buttons/btn_viewcart_57w_10h.gif\" border=\"0\" width=\"57\" height=\"10\">'; 
			t += '</a>';
		t += '</div>';

		// ==================================
		//	Add store button "Help", http://www.gwinst.com/help.asp

		var btn_help_left 		= window_right_edge - (26 + button_to_right_edge);
		var btn_spacer_left 	= btn_help_left 	- (7 + 8);
		var btn_products_left 	= btn_spacer_left 	- (49 + 8);

		t += '<div 	class=\"header_btn\"  style=\"left:' + String(btn_help_left) + 'px; top:35px; \">'; 		
			t += Calc_A_Link_Hmtl('help', (g_gwiStore_url + '/help.asp'), 'class=\"image_link\"');
				t += '<img src=\"' + gImages_Folder_ref + 'buttons/btn_help_26w_11h.gif\" border=\"0\" width=\"26\" height=\"11\">'; 
			t += '</a>';
		t += '</div>';
	
		// ==================================
		//	Add spacer

		t += '<div 	class=\"header_btn\"  style=\"left:'  + String(btn_spacer_left)  + 'px; top:34px; \">'; 		
			t += '<img src=\"' + gImages_Folder_ref + 'buttons/btn_spacer_7w_12h.gif\" border=\"0\" width=\"7\" height=\"12\">'; 
		t += '</div>';

		// ==================================
		//	Add store button "Products", http://www.gwinst.com/p/index.html

		t += '<div 	class=\"header_btn\"  style=\"left:'  + String(btn_products_left)  + 'px; top:35px; \">'; 		
			t += '<a class=\"image_link\" href=\"' + gTop_level_ref + 'p/index.html\">';
				t += '<img  src=\"' + gImages_Folder_ref + 'buttons/btn_products_49w_10h.gif\" border=\"0\" width=\"49\" height=\"10\">'; 
			t += '</a>';
		t += '</div>';

	}

	// ==================================
	//	write text to browser

	document.write( t );
}


// ============================
//	Print Top Picture table row (page header picture, referrer name)

function Print_top_picture_table_row( center_text, right_text_if_referrer_not_shown )
{
	var t = "";
	var header_filename = (gFirstPage_ShowGwinstHeader ? 'headers/header_gwiStore_50h_1200w.png' : 'headers/header_50h_1200w.png');

	<!-- cell  -->  
	t += '<tr><td  height=\"' + String( gHeight_of_header_px ) + '\"';
	t +=      	 'align=\"right\"  valign=\"bottom\"';
	t +=      	 'width=\"' + String(Number(gPage_body_width) - 15) +  '\"  class\="turnoffwhenprinting\"> ';

		<!-- calc offset from right edge -->
		if (center_text == "") { center_text = '&nbsp;'; }
		var hPix_per_char = 10;
		var centerText_width_pix = Number(center_text.length) * hPix_per_char;
		var offset_from_right_edge = ( Number(gPage_body_width) / 2 ) - (centerText_width_pix / 2);

		<!-- Base/Center/Right STYLE, width:150px;   -->
		var header_text_style_code_base   = ' style=\"  z-index:150;  visibility:visible; ';
		var header_text_style_code_center = header_text_style_code_base + ' position:absolute;  top:28px;  left: ' + String(offset_from_right_edge) + 'px;  width: ' + String(centerText_width_pix+10) + 'px; \" ';
		var header_text_style_code_right  = header_text_style_code_base + ' position:relative;  top:' + String( 43 - Number(gHeight_of_header_px))  + 'px;  \" ';
	
		<!-- Center CONTENT (e.g. "Model i423"), alert('t='+t); -->
		t += '<span class=\"header_center_text\" ' + header_text_style_code_center + ' style=\" \" >' + center_text + '<\/span>';		

		<!-- Right CONTENT (e.g. Referrer Name, "DATASHEET") -->
		if (gCurrentFileIsFrom_LocalHardDiskAndNotInternet && (gCurrentFile_IsFrom_GswDevelopmentLocalHardDisk == false)) {
			;
		}
		else if (gFirstPage_ShowStoreBtns) {
			;	//	store buttons will hit text so we do not show text here
		}
		else if (gFirstPage_ReferrerDisplayedName != "") {     

			//	get filename of logo graphic (350 x 38) from disti that wants it in upper right corner
			var distiLogo_InUpperRightCorne_filename = Get_DistiLogo_InUpperRightCorner_Given_3Letter_CountryCode( gFirstPage_Referrer );

			//	omega or omega.co.uk corp
			if ( distiLogo_InUpperRightCorne_filename != "" ) {

				var img_width  = 350;
				var img_height = 38;
				var img_left   = Number(gPage_body_width) - Number(img_width) - 2; 
				var web_url    = "http://" + Get_Full_Name_Of_Distributor_Given_3Letter_CountryCode( gFirstPage_Referrer );
			
				t += '<div style=\"position:absolute; left:' + String(img_left) + 'px; top: 10px; width:' + String(img_width) + 'px; z-index: 300; visibility: visible\">';
					t += '<a href=\"' + web_url + '\" >';
						t += '<img src=\"' + gImages_Folder_ref + 'headers/disti_logo/' + distiLogo_InUpperRightCorne_filename + '\" width=\"' + String(img_width) + '\" height=\"' + String(img_height) + '\" border=\"0\">';
					t += '<\/a>';
				t += '<\/div>';	
			}	

			//	else show company name if there is no logo graphic
			else {
				t += '<A ' + header_text_style_code_right + ' href=\"http:\/\/' + gFirstPage_ReferrerDisplayedName + '\"><span class=\"gwi_logo\">' + gFirstPage_ReferrerDisplayedName + '<\/span><\/A>';
			}
		} 
		else if (right_text_if_referrer_not_shown != "") {  
			t += '<span class=\"header_right_text\" ' + header_text_style_code_right + '>' + right_text_if_referrer_not_shown + '<\/span>';
		}

		<!-- click on instruNet logo in upper left corner to go to home page -->
		if (gThisPageIsWebsiteHomePage != true) {
			t += '<map name=\"header_image_map\"><area shape=\"rect\" coords=\"6,5,165,45\" href=\"' +  gHome_page_ref + '\"></map>';
		}

		<!-- Header Image-->
		t += '<img style=\"position:absolute; border-width:0px; left:0px; top:0px; z-index:140; visibility: visible; ';
		t += '     clip:rect(auto ' + String(Number(gPage_body_width)+0) +  'px auto auto); \"  usemap=\"#header_image_map\" '; 
		t += '     src=\"' + gImages_Folder_ref + header_filename + '\" name=\"header\" height=\"50\" width=\"1200\" id=\"header\"> ';
		 
	<!-- cell -->  
	t += '</td></tr>'; 

	document.write( t );  
}

// ============================
//	Print footer and tracker at bottom of page

function Print_Footer_And_Tracker_At_Bottom_Of_Page( doc )
{
	if (gDebuggingAlerts_Function_InOut_On) { alert('footer() in'); }

	Set_Up_Left_Nav_Area_Right_After_Loading_It();

	Print_Footer();

	Track_iNet_Page_If_On_Internet(doc);

	if (gDebuggingAlerts_Function_InOut_On) { alert('footer() out'); }
}

// ============================
//	Print footer

function Print_Footer()
{
	var t = "";
	var emailLink = "";
	var emailBody = "";
	var width_code = ' width = \"' + String( gPage_body_width ) +  '\" ';
	var pipingStr  = ' <span class=\"footerPiping\">|<\/span> ';

	//	calc footer text
	t += '<div style=\"z-index:500; \" >';

		t += '<table ' + width_code + ' cellpadding=\"0\"  cellspacing=\"0\"  bgcolor=\"#FFFFFF\"  class=\"turnoffwhenprinting\">';
	
			t += '  <tr class=\"smaller_text_and_line_space\"><td width=\"10\">&nbsp;<\/td><\/tr>';
		
			t += '  <tr><td><HR align=\"center\"' + width_code + 'size=\"1\" style=\"border-color:#786565\"><\/td><\/tr>';

			t += '  <tr><td><div align=\"center\" ' + width_code + ' ><span class=\"footerText\">';
		
				if ((gHome_page_ref != "") && (gThisPageIsWebsiteHomePage != true)) {
					t += '<a href=\"' + gHome_page_ref + '\">HOME<\/a>' + pipingStr;
				}
		
				//if ((gFirstPage_ShowContactMenu) && (gContact_page_ref != "")) {
				if (gFirstPage_ShowContactMenu && (gContact_page_ref != "")) {

					t += '<a href=\"' + gContact_page_ref + '\">CONTACT US<\/a>' + pipingStr;
				}

				if (gFirstPage_ShowStoreBtns == true) {

					var a_link_html = Calc_A_Link_Hmtl('store', g_gwiStore_url, "");

					t += a_link_html + 'STORE<\/a>' + pipingStr;
				}

				emailBody = 'Take a look at this page I found:%0d%0a%0d%0a' + gUrlToThisPageOnInternet + '%0d%0a%0d%0a';
		
				emailLink = Calc_EmailTo_link('', 'instruNet data acquisition', emailBody, 'EMAIL THIS PAGE');
		
				t += emailLink +  ' <span class=\"footerPiping\">|<\/span> ';
		
				t += '<a href=\"#\" onclick=\"window.print();return false;\">PRINT THIS PAGE<\/a>';
		
				if (Number(gPage_body_width) > 700) { 
					t += pipingStr;
					t += 'COPYRIGHT gwi 2010'; 
				}
		
			t += '  <\/span><\/div><\/td><\/tr>';

			t += '  <tr><td><HR align=\"center\" ' + width_code + ' size=\"1\" style=\"border-color:#786565\"><\/td><\/tr>';

		t += '<\/table>';

	t += '<\/div> ';

	//alert(t);

	document.write(t);
}

// ============================
//	Print email link to browser

function Calc_EmailTo_link(emailAddr, subjectText_wSpaces, bodyText_wSpaces, linkText)
{
	var bodyText = ReplaceMultipleInstancesOfAString(bodyText_wSpaces, ' ', '%20');

	var subjectText = ReplaceMultipleInstancesOfAString(subjectText_wSpaces, ' ', '%20');

	var t = ' <A CLASS=\"contact\" HREF=\"mailto:' + emailAddr;

	if (gWeAreOnMacintosh)  { t += '\?subject\=' + subjectText + '\?body\='     + bodyText;  }
	else if (gBrowserIs_IE) { t += '\?subject\=' + subjectText + '&' + 'body\=' + bodyText;  }
	else 					{ t += '\?body\='    + bodyText; }

	t += '\">' + linkText + '<\/A>';

	return t;
}

function Print_EmailTo_link(emailAddr, subjectText_wSpaces, bodyText_wSpaces, linkText)
{
	var t = Calc_EmailTo_link(emailAddr, subjectText_wSpaces, bodyText_wSpaces, linkText);

	document.write( t );
}

// ============================
// 	If HTML pages want a BUY IT button on their page, that goes to
//	store.gwinst.com, then they need to create a jScript 'gPcode'
//	variable in their HEAD and set it to the product code (e.g. 'iNet-240').
function Get_ProductCode_ForThisPage()
{	
	var null_string = "";
	var exists = false;

	try { exists = (gPcode != undefined); }

	catch(e) { exists = false; }

	if ( exists != true ) { return null_string; }

	else if (gPcode.toString().Length < 2) { return null_string; }

	else { return gPcode; }
}

// ============================

function Get_CategoryCode_ForThisPage()
{	
	var null_string = "";
	var exists = false;

	try { exists = (gCatCode != undefined); }

	catch(e) { exists = false; }

	if (exists != true) { return null_string; }

	else if (gCatCode.toString().Length < 1) { return null_string; }

	else { return gCatCode; }
}


// ============================
// 	Input 'sourceStr' and it finds every occurance of 'searchSegment' and then 
// 	replaces them with 'replaceSegment' and then returns result ('destStr'). 

function ReplaceMultipleInstancesOfAString(sourceStr, searchSegment, replaceSegment)
{
	var indexOf_lastFind = 0;
	var numOfItemsFound = 0;
	var destStr = sourceStr;
	var new_string = "";
	var right_of_found = "";
	var left_of_found  = "";
	var show_result_in_alert = false;

	do  {

		indexOf_lastFind = destStr.indexOf(searchSegment, indexOf_lastFind);
	
		if (indexOf_lastFind > -1){

			if (indexOf_lastFind > 0) 	{ left_of_found = destStr.substring(0, indexOf_lastFind); } 
			else 						{ left_of_found = ""; }

			right_of_found = destStr.substring(indexOf_lastFind, destStr.length );

			new_string = left_of_found + right_of_found.replace(searchSegment, replaceSegment);

			destStr = new_string;

			indexOf_lastFind += 1;

			//	make sure we do not stay in here forever
			numOfItemsFound += 1;
			if (numOfItemsFound > 40) {
				show_result_in_alert = true;
				indexOf_lastFind = -1; // exit
			}
		}
		else {
			indexOf_lastFind = -1; // exit
		}


	} while (indexOf_lastFind != -1);

	//	debugging
	if ( show_result_in_alert ) {
		alert('Over 40 items found in SearchAndReplace, searchSegment=' + searchSegment + ', replaceSegment=' + replaceSegment);
		alert('sourceStr=' + sourceStr + ', destStr=' + destStr);
	}

	return destStr;
}

// ============================
// Get value of cookie

function get_cookie(NameOfCookie) {

  var arg = NameOfCookie + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  var null_string = "";

  while (i < clen) {

    var j = i + alen;

    if (document.cookie.substring(i, j) == arg)
      	return getCookieVal (j);
    
	i = document.cookie.indexOf(" ", i) + 1;

    if (i == 0) break; 
  }

  return null_string;
}

//	get the value of the cookie given the location within the cookie string
function getCookieVal (offset) {

  var endstr = document.cookie.indexOf (";", offset);

  if (endstr == -1)
    endstr = document.cookie.length;

  return unescape(document.cookie.substring(offset, endstr));
}

//	store the cookie
function setCookie(NameOfCookie, value, expire_mSecs) 
{
	var ExpireDate = new Date ();

	var expireDate_mSecs = (expire_mSecs == 0) ? 0 : (ExpireDate.getTime() + expire_mSecs);

	SetCookie_LongMethod(NameOfCookie, value, expireDate_mSecs, sCookie_path, sCookie_domain);
}

//	delete the cookie
function delCookie(NameOfCookie) {
	SetCookie_LongMethod(NameOfCookie, "", 1, sCookie_path, sCookie_domain);
}


//	save the cookie
function SetCookie_LongMethod(NameOfCookie, value, expires, path, domain )
{
  if ((expires!=null) && (expires!=0)) {  FixCookieDate(expires);  }

  var full_cookie_string = "";

  full_cookie_string = NameOfCookie + "=" + escape(value) +
    (  ((expires==null) || (expires==0)) ? "" : ("; expires=" + expires.toGMTString()) ) +
    (  ((path==null)    || (path==""))   ? "" : ("; path=" + path)		) +
    (  ((domain==null)  || (domain=="")) ? "" : ("; domain=" + domain)  );

  // alert('full_cookie_string = ' + full_cookie_string);

  document.cookie = full_cookie_string;
}

function FixCookieDate (date) {

	var base = new Date(0);
	var skew = base.getTime();	 // dawn of (Unix) time - should be 0
	
	if (skew > 0) { 				// Except on the Mac - ahead of its time
		date.setTime (date.getTime() - skew);
	}
}

  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
function ReplaceText(s, t, u) 
{
	var i = s.indexOf(t);
	var r = "";
	
	if (i == -1) return s;
	
	r += s.substring(0,i) + u;
	
	if ( i + t.length < s.length) {
		r += ReplaceText(s.substring(i + t.length, s.length), t, u);
	}

	return r;
}

 
// ============================
// 	recovers parameters separated by commas, and prefixed with an ID number. e.g. (?1=x, 2=y)
//	3	contact us on/off
//	4	p4 redirect
//	5	contact form parameters
//	8	show prices
//	9	p9 redirect
//
function GetParameter_PassParamsToJavaScript(passParamsToJavaScript_string, index)
{
  passParamsToJavaScript_string += ', ';

  var searchString = String((String(index)+'='));

  var index_Str = String(index);

  var searchPrefixLength = index_Str.length + 1;

  var locationOf_searchString = Number(passParamsToJavaScript_string.indexOf(searchString));

  if (locationOf_searchString <= -1) { return ""; }

  var start_index = Number(searchPrefixLength + locationOf_searchString);	

  var stop_index  = Number( Number(passParamsToJavaScript_string.indexOf(",", start_index)));	

  if (start_index <= 1) { return ""; }

  if (stop_index < start_index)  { stop_index = passParamsToJavaScript_string.length; }

  parameterText = passParamsToJavaScript_string.substring(start_index, stop_index);

  return parameterText;
}

// ============================
// Runs the Website tracker if we are on the internet
function Track_iNet_Page_If_On_Internet(doc)
{
	if ((doc.location.href == "") || (gWeAreTryingToTrackWithGoogle != true)) { return; }

	//	============================
	//	Tell dataplain to track this page

	Dataplain_TrackThisPage();

	//	============================
	//	Used google analytics to track this page, if page is
	//	served from internet www.gwinst.com or www.instrunet.com server.

	GoogleAnalytics_TrackThisPage();
}

// ============================
// 	Tell dataplain to track this page

function Dataplain_TrackThisPage()
{
	if (gWeAreTryingToTrackWithGoogle != true) { return; }

	var t = "";

	//	============================
	//	We calculate a string that indicates how we got here (e.g.
	//	google adWords, free search engine, click from omega website);
	//	and pass back to dataplain as userId (same as userName).
 
	var sessionID = Calculate_Session_ID_String();

	//	============================
	//	data dataplain tracking (both for www.instrunet.com and www.gwinst.com)

	t += '<script language=\"javascript\" src=\"http:\/\/www.dataplain.com\/stats-js.cgi?host=dp&user=gweinreb&userid=' + sessionID + '\"> <\/script> ';
	t += '<noscript> <img src=\"http:\/\/www.dataplain.com\/stats-image.cgi?host=dp&user=gweinreb\" height=\"1\" width=\"1\" border=\"0\"> <\/noscript>';

	//	============================
	//	debugging

	if (gDebuggingAlertsOn) { alert(t); }
	
	document.writeln(t);
}

// ============================
// Tell google analytics to track this page, if page is
//	served from internet www.gwinst.com or www.instrunet.com server.
//	
//	REF: 	google analytics help
//			http://www.google.com/support/analytics/

function GoogleAnalytics_TrackThisPage()
{
	if (gGoogleAnalytics_JavascriptFileLoadedOk != true) { return; }

	var UaCode  = ((gCurrentFileIsFrom_WwwGwinstCom == true) ? "UA-15550480-1" : "UA-15550480-2");
	var webSite = ((gCurrentFileIsFrom_WwwGwinstCom == true) ? ".gwinst.com"   : ".instrunet.com");

	//	run functions inside of google analytics "ga.js" file; which was
	//	previously loaded by GoogleAnalytics_LoadJavascript().

	try {

		gPageTracker = _gat._getTracker( UaCode );
		gPageTracker._setDomainName( webSite );
		gPageTracker._trackPageview();
		gPageTracker_InitializedOk = true;

	} catch (err) {
		//
	};

	//	============================
	//	Add "user defined value" to adWords listing (for this session).  This is a term that shows up in google analytics 
	//	under "user defined value" (adwords, reporting, kewords, set popup to "user defined value")

	if (gPageTracker_InitializedOk == true) {

		//	We calculate a string that indicates how we got here (e.g.
		//	google adWords, free search engine, click from omega website);
		//	and tack this onto end of action term; and pass to google analytics
		//	as actionTerm and UserDefinedValue.

		var sessionID = Calculate_Session_ID_String();

		try { gPageTracker._setVar( sessionID ); } 
		catch(err) { };
	}

	//	============================
	//	google analytics reference code

	//		www.gwinst.com
	//
	//		<script type="text/javascript">
	//		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	//		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	//		</scr ipt>
	//		<script type="text/javascript">
	//		try {
	//		var pageTracker = _gat._getTracker("UA-15550480-1");
	//		pageTracker._setDomainName(".gwinst.com");
	//		pageTracker._trackPageview();
	//		} catch(err) {}</scr ipt>

	//		www.instrunet.com
	//
	//		<script type="text/javascript">
	//		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	//		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	//		</scri pt>
	//		<script type="text/javascript">
	//		try {
	//		var pageTracker = _gat._getTracker("UA-15550480-2");
	//		pageTracker._trackPageview();
	//		} catch(err) {}</scri pt>
}


// ============================
// 	Load and run google analytics javascript file (www.google-analytics.com/ga.js).
//	This is done before the </body> tag, per google documentation.

function GoogleAnalytics_LoadJavascript()
{
	if (gWeAreTryingToTrackWithGoogle != true) { return; }

	//	============================
	//	load google analytics javascript

	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

	var writeData = "<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'> <\/script>";

	var writeData_un = unescape( writeData );

	try {

		//	<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></scr ipt>
		document.writeln( writeData_un );
	
		gGoogleAnalytics_JavascriptFileLoadedOk = true;
	
	} catch (err) {
		//
	};
}

// ============================
//  Record outbound link by google analytics
//	
//	REF: 	How do I manually track clicks on outbound links?Print 
//			http://www.google.com/support/analytics/bin/answer.py?answer=55527&cbid=qjud6a77ri8b&src=cb&lev=index

function GoogleAnalytics_RecordOutboundLink( category, action_term_caller, target_url) 
{ 

	//	============================
	//	If google pagetracker did not run ok (at bottom of </body>) then exit

	if ( gPageTracker_InitializedOk != true) { return; }

	//	============================
	//	If someone is pressing the "buy" button and jumping to
	//	store.gwinst.com, then we track this as a google 
	//	"conversion" with with a value of 1. This shows up in the
	//	adWords report.

	if  ((action_term_caller.indexOf("buy")   != -1)  || 	  
		 (action_term_caller.indexOf("store") != -1)) {

		Track_Google_Conversion___buy();
	}

	//	============================
	//	We calculate a string that indicates how we got here (e.g.
	//	google adWords, free search engine, click from omega website);
	//	and tack this onto end of action term; and pass to google analytics
	//	as actionTerm and UserDefinedValue.
 
	var sessionID = Calculate_Session_ID_String();

	var action_term = action_term_caller.toLowerCase() + '_' + sessionID;

	// alert("action_term = " + action_term + ", sessionID = " + sessionID );

	//	============================
	//	Track outbound link on google analytics.  This is a term that shows up in google analytics 
	//	(adwords, reporting, content, event tracking, actions). For details, see documentation at Calc_A_Link_Hmtl().

	try {   

	 	gPageTracker._trackEvent(category, action_term); 

		var new_location = 'document.location = \"' + target_url + '\"';
   
		// alert("new_location =     " + new_location);

		setTimeout(new_location, 100);

	} catch(err) {
		//
	};
}

// ============================
//  Calc outbound A link html code, which is tracked by google analytics.
//
//	For detals, see "Track outbound links via Google Analytics"
//	http://www.google.com/support/analytics/bin/answer.py?answer=55527&cbid=qjud6a77ri8b&src=cb&lev=index
//
//	action_term: 
//			This is a term that shows up in google analytics (adwords, reporting, content, event tracking, actions)
//			Typical terms are: myaccount, shoppingcard, help, store, buy_iNet-240
//			REF: https://adwords.google.com/analytics/reporting/event_actions?id=31023082&pdr=20100301-20100331&cmp=average#lts=1270151369959
			
function Calc_A_Link_Hmtl(action_term, target_url, options_added_to_a_link)
{
	var html_code = "";
	var trackOutboundLink = "";

	if ( gWeAreTryingToTrackWithGoogle == true ) { 
		trackOutboundLink = 'onClick=\"GoogleAnalytics_RecordOutboundLink(\'Outbound Links\', \'' + action_term + '\', \'' + target_url + '\');return false;\"';
	}

	html_code = '<a href=\"' + target_url + '\" ' + options_added_to_a_link + ' ' + trackOutboundLink + ' >';
			
	//alert("html_code =     " + html_code);

	return html_code;
}

// ============================
//	This is used to track the clicking of the "buy" button
//	and record it in google as a "conversion". This clicking is 
//	done at www.gwinst.com or www.instrunet.com and used to jump 
//	to store.gwinst.com. 
//
//	"buy" conversion:	var google_conversion_id    = 1020638164;
//						var google_conversion_label = "D5beCIj9wAEQ1OfW5gM";
//
//	gwi acount for adWords conversion tracking
//	https://adwords.google.com/o/ConversionTracking/Manager?__c=2902842064&__u=4233475774#awct.3161736.cod
//	
//	JavaScript onClick Google AdWords Conversion Tracking
//	http://blog.vkistudios.com/index.cfm/2008/12/16/JavaScript-onClick-Google-AdWords-Conversion-Tracking

function Track_Google_Conversion___buy()
{
	if (gWeAreTryingToTrackWithGoogle != true) { return; }

	try {   

		var image = new Image(1,1);

		//	'1020638164' and 'D5beCIj9wAEQ1OfW5gM' are fixed id's provided by google adWords conversion tracking feature
		image.src = "http://www.googleadservices.com/pagead/conversion/1020638164/?value=1&amp;label=D5beCIj9wAEQ1OfW5gM&amp;guid=ON&amp;script=0";

		gTrack_Google_Conversion___buy__ok = true;

		//alert("gTrack_Google_Conversion___buy__ok");

	} catch(err) {
		//
	};
}

// ============================
// 	For each session, we create a string that indicates how
//	we got here and we feed this back to dataplain (as userId = userName)
//	and to google analytics (as ActionTerm and userDefinedValue). This is stored
//	w/ the cookied (actually, the parts that make it up are stored w/ cookied),
//	so it stays the same as one moves from page to page. It refects how
//	one got to the 1st page of their session (e.g. direct url to gwinst.com or
//	instrunet.com via bookmark, link from distributor website, free search engine,
//	paid google adWords).

function Calculate_Session_ID_String()
{
	var id = "";

	//	============================
	//	If someone comes from google adWords then they will enter with
	//	a URL like www.gwinst.com/data_acquisition/force/strain_gage.html?gclid=CPzqqJr45aACFQ8eDQodGHyzIQ.
	//	The thing at the end is the 'gclid' (google adwords visitor id). If this exists (visitor
	//	came from adwords adv) then we add this to the "action_term".
 
	if ( gFirstPage_gclid != "") {

		if (id != "") { id += '_'; }

		id = 'GCL-' + gFirstPage_gclid;
	}

	//	============================
	//	Search engine, e.g. "goo" refers to google
	
	else if (gFirstPage_Search != "") {

		if (id != "") { id += '_'; }

		id += 'ENG-' + gFirstPage_Search;
	}

	//	============================
	//	Keyword typed into search engine that go us here
	
	if (gFirstPage_SearchTerm != "") {

		if (id != "") { id += '_'; }

		id += 'SEA-' + gFirstPage_SearchTerm;
	}

	//	============================
	//	Referrer, e.g. "ome" refers to omega. This is what appears in
	//	upper right corner. This is set to "gwi" if we show
	//	"gw instruments" in header. This is set to "" (nil) if going
	//	to instrunet website.

	if (gFirstPage_Referrer != "") {

		if (id != "") { id += '_'; }

		id += 'REF-' + gFirstPage_Referrer;
	}

	//	============================
	//	If someone goes direct to instruNet (not gwinst) and there
	//	is not search engine, then the id will be "" when you hit this area
	//	of the code, and we respond by calling this "DirectToInstrunet" 
	//	(not gwinst.com, no search referrer)

	if (id == "") { id += 'DirectToInstrunet'; }

	//	============================
	//	debugging

	//alert("id = " + id + "\rgFirstPage_Search = " + gFirstPage_Search + "\rgFirstPage_SearchTerm = " + gFirstPage_SearchTerm + "\rgFirstPage_Referrer = " + gFirstPage_Referrer );

	return id;
}

// ============================
//  Reloads the window if Nav4 resized
//
//	gsw comment Feb09: I never saw this run on IE.
function MM_reloadPage(init) {  

  	if (init==true) with (navigator) {

		if ((appName=="Netscape") && (parseInt(appVersion)==4)) {

    		document.MM_pgW=innerWidth; 
			document.MM_pgH=innerHeight; 
			onresize=MM_reloadPage; 
		} 
	} 
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {
		location.reload();
		// alert('MM_reloadPage() location.reload();');
	}
}

// ============================

function print_price(priceText)
{
	// this function is not longer used
}

// ============================
//  If suffix is #128 or #168, we redirect to another url
function redirect_to_another_url_if_suffix_tells_us_to_do_that()
{
   var searchNumber = 0;
	if (location.hash) {
	   if ((location.hash.length > 1) && (location.hash.length <= 5) && (location.search.length == 0)) {
            start = Number(location.hash.indexOf("#"));
            if (start == 0)  {
               searchNumber = Number(location.hash.substring(start + 1, location.hash.length));
            }
        }	
	}

	var internet_url = 'http:\/\/www.gwinst.com\/';	//	we go to gwinst site with contact and prices
	var gTestingOnLocalHardDisk = false;
	if (gTestingOnLocalHardDisk) { internet_url = ""; }

	var redirect_url = "";

	if (searchNumber == 128) { redirect_url = internet_url + 'p\/index.html\?3=c,4=gwi,8=p'; }
	if (searchNumber == 168) { redirect_url = internet_url + 'download\/files\/inet_an168.pdf'; }

	//	if we are redirecting to another page (i.e. we are not to load this one)
	if (redirect_url != "")	{

		gWeAreRedirectingToPriceListPage = true;

		Redirect_to_another_url( redirect_url );
		// alert( 'redirect_url = ' + redirect_url);

		return true;
	}

	return false;
}

// ============================
//  determine the end user's primary interest

var interest_tc    = 'thermocouple';
var interest_therm = 'thermistor';
var interest_sg    = 'strain';
var interest_rtd   = 'rtd';
var interest_quadr = 'quadrature';
var interest_lv    = 'labview';
var interest_dasy  = 'dasylab';
var interest_loadc = 'load cell';

function determine_interest( desc_string )
{
	var interest = "";

	if (desc_string == null) { return interest; }

	if (desc_string == "") { return interest; }

	var desc_lc = desc_string.toLowerCase();

	var desc = ReplaceText(desc_lc, '-', ' ');

	if      (desc.indexOf(interest_tc) >= 0) 	{ interest = interest_tc; }

	else if (desc.indexOf(interest_therm) >= 0) { interest = interest_therm; }

	else if (desc.indexOf(interest_sg) >= 0) 	{ interest = interest_sg; }

	else if (desc.indexOf(interest_rtd) >= 0) 	{ interest = interest_rtd; }

	else if (desc.indexOf(interest_quadr) >= 0) { interest = interest_quadr; }

	else if (desc.indexOf(interest_lv) >= 0) 	{ interest = interest_lv; }

	else if (desc.indexOf(interest_dasy) >= 0) 	{ interest = interest_dasy; }

	else if ((desc.indexOf(interest_loadc) >= 0) || (desc.indexOf('loadcell') >= 0))  { interest = interest_loadc; }

	return interest;
}


// ============================
//	Loads price fields in the ProductList html page (list of all products)
//	if gFirstPage_ShowStoreBtns is true

function Load_Prices()
{ 
	if (gFirstPage_ShowStoreBtns != true) { return; }

	if (document.getElementById == null) { return; }

	SetFieldWithBuyIt("iNet-555" );				//	start system, usa
	SetFieldWithBuyIt("iNet-555.eu" );			//	start system, europe

	SetFieldWithBuyIt("iNet-100");
	SetFieldWithBuyIt("iNet-100b" );
	SetFieldWithBuyIt("iNet-100hc" );

	SetFieldWithBuyIt("iNet-240" );
	SetFieldWithBuyIt("iNet-240P" );

	SetFieldWithBuyIt("iNet-200" );
	SetFieldWithBuyIt("iNet-200P" );

	SetFieldWithBuyIt("iNet-230" );				//	PRICE INCREASED from $290 to $390, Dec 1, 2009
	SetFieldWithBuyIt("iNet-230P" );

	SetFieldWithBuyIt("iNet-330" );				//	PRICE INCREASED from $290 to $390, Dec 1, 2009

	SetFieldWithBuyIt("iNet-312.8" );			//  PRICE INCREASED from $70 to $90, Dec 1, 2009
	SetFieldWithBuyIt("iNet-312.8eu" );			//  PRICE INCREASED from $70 to $90, Dec 1, 2009

	SetFieldWithBuyIt("iNet-340" );				//	din rail for i100

	SetFieldWithBuyIt("iNet-350" );				//  part # "iNet-iWplus.." and part # "iNet-350" are the same
	
	// discontinued: SetField("i34s", 75);
	// discontinued: SetField("i34w3f", 25);

	SetFieldWithBuyIt("iNet-db25-3ft" );		//  part # changed from "iNet-Cable.." to "iNet-Db25.." Jan 2010 
	SetFieldWithBuyIt("iNet-db25-10ft" );
	SetFieldWithBuyIt("iNet-db25-25ft" );
	SetFieldWithBuyIt("iNet-db25-50ft" );
	SetFieldWithBuyIt("iNet-db25-100ft" );
	
	SetFieldWithBuyIt("iNet-r-33" );
	SetFieldWithBuyIt("iNet-r-120" );	
	SetFieldWithBuyIt("iNet-r-350" );
	SetFieldWithBuyIt("iNet-r-1k" );
	SetFieldWithBuyIt("iNet-r-3300" );
	SetFieldWithBuyIt("iNet-r-10k" );
	SetFieldWithBuyIt("iNet-r-33k" );

	SetFieldWithBuyIt("iNet-400" );
	SetFieldWithBuyIt("iNet-410" );
	SetFieldWithBuyIt("iNet-420" );
	SetFieldWithBuyIt("iNet-423" );
	SetFieldWithBuyIt("iNet-430" );
	SetFieldWithBuyIt("iNet-460" );
											
	SetFieldWithBuyIt("iNet-hd44mf-3m" );
											
	SetFieldWithBuyIt("iNet-510" )    	<!-- i510 wiring box -->	
	SetFieldWithBuyIt("iNet-530" );		<!-- i4xx din rail mounting kit --> 
}

// ============================
//	Sets field with BuyIt button

function SetFieldWithBuyIt( inet_product_code )
{
	var UrlProductCode = "";
	
	if ( document.getElementById ) {

		var element = document.getElementById( inet_product_code );
		
		if ((element == null) || (element == "")) { alert('ERROR: field not found: ' + fieldName_str); }
		
		element.innerHTML = Calculate_BUY_IT_html( inet_product_code, "" );
	}
}

// ============================
//	Calculate BuyIt Html

function Calculate_BUY_IT_html( inet_product_code, inet_category_code )
{
	return Calculate_BUY_IT_html_LOW_LEVEL(inet_product_code, inet_category_code, '<span class=\"redColor\">Buy It!</span>', "");
}

// ============================
//	image with rollover
//	ref: http://www.howtocreate.co.uk/tutorials/jsexamples/testingRoll.html
//
//	If you pass 'inet_product_code' (i.e net part number, e.g. 'iNet-240'), then
//	pressing button causes a jump to that product.
//
//	else if you pass 'inet_category_code' (i.e. gwinst store category code, e.g. 28 means i4xx cards),
//	then it will show a list of those products. For list of categories, see http://store.gwinst.com//cindex.asp 

function Calculate__IMAGE__BUY_IT_html( inet_product_code, inet_category_code)
{
	var file_regular 	= gImages_Folder_ref + 'buttons/buy_it_button_28h_70w.png';
	var file_hover 		= gImages_Folder_ref + 'buttons/buy_it_button_28h_70w_HOVER.png';

	var img_regular 	= new Image(); 
	img_regular.src 	= file_regular;

	var img_hover 		= new Image(); 
	img_hover.src 		= file_hover;

	var a_link_hover = 'onmouseover=\"document.images[\'buyBtn\'].src = \'' +  file_hover   + '\'  \" ';
	a_link_hover 	+= 'onmouseout =\"document.images[\'buyBtn\'].src = \'' +  file_regular + '\'  \" ';

	var buyItButton = '<img src=\"' + file_regular  + '\" name=\"buyBtn\" width=\"70\" height=\"27\" border=\"0\">';
	//alert('buyItButton=' + buyItButton + '\r\n\r\n   a_link_hover=' + a_link_hover);

	var_div_a_img_code = Calculate_BUY_IT_html_LOW_LEVEL(inet_product_code, inet_category_code, buyItButton, a_link_hover);
	//alert('var_div_a_img_code = ' + var_div_a_img_code);

	return var_div_a_img_code;
}

// ============================

function Calculate_BUY_IT_html_LOW_LEVEL( inet_product_code, inet_category_code, buyItButton_Html, options_added_to_a_link )
{
	var BUY_IT_html    = "";
	var UrlProductCode = "";
	var UrlSuffix 	   = "";
	var trackOutboundLink = "";
	var action_term    = "out";
	var price_html_code= "";

	//	====================
	//	Calc URL to get to store

	if (inet_product_code != "") {		
		UrlProductCode  = Convert_ProductCode_to_UrlProductCode( inet_product_code  );
		UrlSuffix 		= '/ProductDetails.asp?ProductCode=' + UrlProductCode; 
	}
	else if (inet_category_code != "") {	
		UrlSuffix 		= '/SearchResults.asp?Cat=' + String(inet_category_code); 
	}
	else { 
		alert("why nul cat and product codes?"); 
	}

	var total_url = g_gwiStore_url + UrlSuffix;

	//	====================
	//	Calc action term to send to google analytics and dataplain

	//	See documentation at Calc_A_Link_Hmtl() for details on 'action_term'
	if (inet_product_code != "") 			{ action_term = ReplaceMultipleInstancesOfAString('buy_' + inet_product_code.toLowerCase(), 'net-', ''); } 
	else if (inet_category_code != "") 		{ action_term = 'store_cat_' + inet_category_code.toLowerCase(); } 
	// alert('action_term = ' + action_term);
	
	//	====================
	//	Calc price to to put under button (optional)

	var price_usd = Convert_ProductCode_to_UsaListPrice( inet_product_code  );

	if (price_usd != "") {
		price_html_code = '<br><span class=\"redColor\">&nbsp;&nbsp;&nbsp;&nbsp;' + price_usd + '<\/span>';
	}

	//	====================
	//	Calc <a> link code

	//	calc "<a href=total_url + options_added_to_a_link + trackOutboundLink >"
	var a_link_html = Calc_A_Link_Hmtl(action_term, total_url, options_added_to_a_link)
	
	//	====================
	//	Calc buy it button code

	BUY_IT_html = 	'<div class=\"turnoffwhenprinting\">';
	BUY_IT_html += 		a_link_html;
	BUY_IT_html += 			buyItButton_Html;
	BUY_IT_html += 		'</a>';
	BUY_IT_html += 		price_html_code;
	BUY_IT_html += 	'</div>';

	return BUY_IT_html;
}

// ============================
//	Convert "iNet-555.eu" to "inet%2D555%2Eeu".

function Convert_ProductCode_to_UrlProductCode( inet_product_code  )
{
	var URL_product_code = inet_product_code.toLowerCase();

	var temp1 = ReplaceMultipleInstancesOfAString(URL_product_code, '-', '%2D');

	var temp2 = ReplaceMultipleInstancesOfAString(temp1, '.', '%2E');

	return temp2;
}

// ============================
//	Convert productCode (e.g. "iNet-555.eu") to usa list price.

function Convert_ProductCode_to_UsaListPrice( inet_product_code  )
{
	var pCode = inet_product_code.toLowerCase();

	if (pCode == "inet-555-xx") { return "$990"; }

	return "";
}


// ============================
//	Sets field with $ value

function SetField(fieldName_str, price_usd)
{
	if (document.getElementById){

		var element = document.getElementById( fieldName_str );
	
		if ((element == null) || (element == "")) { alert('ERROR: field not found: ' + fieldName_str); }
	
		element.innerHTML  = '$' + String(price_usd );
	}
}


//	======================================-
//	======================================-
//	Before and after printing window, these will run
//
//	Setting Page Options dialog requires activeX, and runs into security
//
//		http://www.codingforums.com/archive/index.php/t-36037.html
//		http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=7354&action=new
//		http://msdn.microsoft.com/en-us/library/ms976105.aspx
//		http://www.meadroid.com/scriptx/serverside.asp
//		
//	======================================-
//	======================================-

var originalTitle;

function beforeprint() {

	originalTitle = document.title;
	document.title = ""; // hide title since the webpage already has this
}

function afterprint() {

	document.title = originalTitle;
}

// ============================
//	When the left nav area is 1st loaded (div id=p7TMnav), it
//	is "display:none", which means the elements are loaded into
//	memory yet are not displayed. Then, this below routine runs and
//	shows them, and also adjusts the twisties as needed.

function Set_Up_Left_Nav_Area_Right_After_Loading_It()
{
	//	=========-
	//	Hide entire left nav area while we work on it

	var lefNavArea = null;  
	if (document.getElementById) { 
		lefNavArea = document.getElementById('p7TMnav');
		if (lefNavArea) { 
			lefNavArea.style.display='none'; 
		}
	}

	//	=========-
	//	Close left nav areas (i.e. twisties) that might be expanded after loading them

	P7_setTMenu();

	//	=========-
	//	The body has been loaded and printed, and now we run the 
	//	left nav initialization routines. The below routines do nothing
	//	if element 'p7TMnav' is not found (i.e. this works even if you do not
	//	have a left nav area).

	P7_TMclass(); 
	P7_TMopen();

	//	=========-
	//	We now show entire left nav area, since it should be set up now

	if (lefNavArea) { 
		lefNavArea.style.display='block'; 
	}
}


//	======================================-
//	======================================-
//	LEFT NAVIGATION -- jScript CODE COPIED FROM FILE p7tmscripts.js (menubar) ON FEB 2009
//	Reference: "tree magic 1" at www dot projectseven dot com
//	======================================-
//	======================================-

//	When someone clicks on a left nav area, this is run to open it's twisty
//	v2.5 by Project Seven Development(PVII)
function P7_TMenu(b,og) { 
 
	var i, s, c, k, j, tN, hh;

	if (document.getElementById){
 
		if (b.parentNode && b.parentNode.childNodes)	{ tN = b.parentNode.childNodes; } 
		else 											{ return; }
	
		 for (i=0;i<tN.length;i++) {
	
			if (tN[i].tagName=="DIV") {
	
				s=tN[i].style.display;
	
				hh=(s=="block")?"none":"block";
	
				if (og==1) {
					hh="block";
				}
	
				tN[i].style.display=hh;
			}
		}
	
		c=b.firstChild;
	
		if(c.data){
	
			k=c.data;
			j=k.charAt(0);
	
			if (j=='+') {
				k='-'+k.substring(1,k.length);
			}
			else if (j=='-') {
				k='+'+k.substring(1,k.length);
			}
	
			c.data=k;
		}
	
		if (b.className=='p7plusmark') {
			b.className='p7minusmark';
		}
		else if (b.className=='p7minusmark') { 
			b.className='p7plusmark';
		}
	}
}

//	======================================-

function P7_setTMenu(){ //v2.5 by Project Seven Development(PVII)

	var i,d='',h='<style type=\"text/css\">';
	
	//	============================
	//	bail out if working with opera

	if(document.getElementById) {
 
		var tA=navigator.userAgent.toLowerCase();

		if (window.opera){
 		
			if (tA.indexOf("opera 5")>-1 || tA.indexOf("opera 6")>-1){
				return;
		}
	}

	//	============================
	//	turn off displaying 'p7TMnav div div', 'p7TMnav div div div', ...

 	for(i=1;i<20;i++){
	
		d+='div ';

		// 'none' means that the thing is NOT rendered, 'block' means display as block element
		h+="\n#p7TMnav div "+d+"{display:none;}";	
	}

 	document.write(h+"\n</style>");}
}

//	======================================

function P7_TMopen()	{ //v2.5 by Project Seven Development(PVII)

	var i,x,d,hr,ha,ef,a,ag;

	if (document.getElementById){

		d=document.getElementById('p7TMnav');

 		if(d){ 
		
			hr=window.location.href;
			ha=d.getElementsByTagName("A");

			if (ha&&ha.length){

 				for(i=0;i<ha.length;i++){

					if(ha[i].href){

						if(hr.indexOf(ha[i].href)>-1){

 							ha[i].className="p7currentmark";

							a=ha[i].parentNode.parentNode;

							while(a){

 								if(a.firstChild && a.firstChild.tagName=="A"){

									if (a.firstChild.onclick){

 										ag=a.firstChild.onclick.toString();

										if(ag&&ag.indexOf("P7_TMenu")>-1){

 											P7_TMenu(a.firstChild,1);
										}
									}
								}

								a=a.parentNode;
							}
						}
					}
				}
			}
		}
	}
}

//	======================================
//	As of Feb09, no one calls this routine.

function P7_TMall(a){ //v2.5 by Project Seven Development(PVII)

 	var i,x,ha,s,tN;

	if (document.getElementById){	

		ha=document.getElementsByTagName("A");

 		for (i=0;i<ha.length;i++){

			if (ha[i].onclick){

				ag=ha[i].onclick.toString();

 				if (ag&&ag.indexOf("P7_TMenu")>-1){

					if (ha[i].parentNode && ha[i].parentNode.childNodes)	{ tN=ha[i].parentNode.childNodes; } 
					else 													{ break; }

					for (x=0;x<tN.length;x++){

 						if (tN[x].tagName=="DIV"){
		
							s=tN[x].style.display;

							if (a==0&&s!='block')		{ P7_TMenu(ha[i]); }
							else if (a==1&&s=='block')	{ P7_TMenu(ha[i]); }

							break;
						}
					}
				}
			}
		}
	}
}


//	======================================

function P7_TMclass(){ //v2.5 by Project Seven Development(PVII)

 	var i,x,d,tN,ag;

	if (document.getElementById){

		d=document.getElementById('p7TMnav');

		 if(d){

			tN=d.getElementsByTagName("A");
	
			if(tN&&tN.length){
		
				for(i=0;i<tN.length;i++){

 					ag=(tN[i].onclick)?tN[i].onclick.toString():false;

					if(ag&&ag.indexOf("P7_TMenu")>-1){

 						tN[i].className='p7plusmark';
					}
					else{
						tN[i].className='p7defmark';
					}
				}
			}
		}
	}
}

//	======================================
//	======================================
//	TOP MENUBAR -- jScript CODE COPIED FROM FILE mm2scripts.js (menubar) ON FEB 2009
//	Reference: "menu magic 2" at www dot projectseven dot com
//	======================================
//	======================================

function MM_findObj(n, d) { //v4.01

  var p,i,x;  

	if(!d) {
		d=document;
	}

	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}

  	if(!(x=d[n])&&d.all) {
		x=d.all[n]; 
	}

	for (i=0;!x&&i<d.forms.length;i++) {
		x=d.forms[i][n];
	}

  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
		x=MM_findObj(n,d.layers[i].document);
	}

  	if(!x && d.getElementById) {
		x=d.getElementById(n); 
	}

	return x;
}

//MenuMagic II scripts by PVII
//www.projectseven.com
//Copyright(c) 2002, All Rights Reserved
//
function P7_setMM2(){ //v2.0 by PVII

 //set the image over and down name convention
 	document.p7TabOver="_over";
 	document.p7TabDown="_down";

 	var dt=false;

	if(document.getElementsByTagName) {
		dt=true;
	}

	if(document.P7TabBar) { return; }

 	var i,k=-1,g,x,gg,tl,ts,ti,tm,tt,tsn,tu,el;

	var args=P7_setMM2.arguments;

 	P7TabProp=new Array();

	for(i=0;i<args.length;i++){
		P7TabProp[i]=args[i];
	}
 
	P7TabIM=new Array();
	P7TabSB=new Array();

	if(dt) 	{ tm=document.getElementsByTagName("IMG"); }
	else	{ tm=document.images;}

	tm=document.images;		// gsw 3/2009 -- is this redundant wrt above line of code?

	tt=new Array();
	tt=tt.concat(tm);

 	if(document.layers){

		for(i=0;i<document.layers.length;i++){

			ti=document.layers[i].document.images;
 
			if (ti) {
				tt=tt.concat(ti);
			}

			for(x=0;x<document.layers[i].document.layers.length;x++){

 				ti=document.layers[i].document.layers[x].document.images;

				if (ti) {
					tt=tt.concat(ti);
				}
			}
		}

		tm=tt;
	}

 	for(i=0;i<tm.length;i++){

		tl=tm[i].name; 

		if(dt&&!tl){
			tl=tm[i].id;
		}
	
		if(tl.indexOf("p7TBim")==0){

			ts=tl.replace("p7TBim","");

			tsn="p7TBsub"+ts;k++;

			P7TabIM[k]=tl;

			if((g=MM_findObj(tsn))!=null){

				P7TabSB[k]=tsn;
 
				gg=(document.layers)?g:g.style;
		
				gg.visibility="hidden";
			}
			else {
				P7TabSB[k]='N';
			}
		}
	}

 	document.P7_TBswapd=new Array();
	document.P7_TBswapo=new Array();

	for(i=0;i<P7TabIM.length;i++){

 		g=MM_findObj(P7TabIM[i]);
		gg=g.src;
		g.p7TBim=g.src;
		tu=gg.lastIndexOf(".");
 		g.p7TBimo=gg.substring(0,tu)+document.p7TabOver+gg.substring(tu,gg.length);
 		g.p7TBimd=gg.substring(0,tu)+document.p7TabDown+gg.substring(tu,gg.length);
 
		if(P7TabProp[2]>1){
			document.P7_TBswapo[i]=new Image();
			document.P7_TBswapo[i].src=g.p7TBimo;
		}

		if(P7TabProp[2]>0){

			if(P7TabProp[2]==3){
	
				g.p7TBimd=g.p7TBimo;
			}

			document.P7_TBswapd[i]=new Image();
 			document.P7_TBswapd[i].src=g.p7TBimd;
		}
	}

	if((g=MM_findObj('P7TabH'))!=null){

		gg=(document.layers)?g:g.style;
 		gg.visibility="hidden";
	}

	if(dt&&P7TabProp[3]!='none'&&!window.opera){

 		g=document.getElementsByTagName("A");

		for(i=0;i<g.length;i++){

			if(g[i].hasChildNodes()){
		
				el=g[i].firstChild;
 
				while (el){

					if(el.nodeType==3){

						gg=el.nodeValue;
						if(P7TabProp[3]==gg.replace("\n","")){

 							g[i].className=P7TabProp[4];break;
						}
					}

					el=el.firstChild;
				}
			}
		}
	}

	document.P7TabBar=true;
}

function P7_trigMM2(bu){ //v2.0 by PVII
 
	if(!document.P7TabBar){ return; }

	var i,g,d,dB=-1,tF=false,sF=false;

 	for(i=0;i<P7TabSB.length;i++){
		
		sF=false;

		if((g=MM_findObj(P7TabSB[i]))!=null){

			g=MM_findObj(P7TabSB[i]);

 			gg=(document.layers)?g:g.style;
			sF=true;
		}

		d=MM_findObj(P7TabIM[i]);

		if(P7TabIM[i]==P7TabProp[0]){

			dB=i;
		}

		if(P7TabIM[i]==bu){

			tF=true;
			if(sF){
				gg.visibility="visible";
			}

			if (P7TabProp[2]>0){

 				if(i==dB)					{ d.src=d.p7TBimd; } 
				else if (P7TabProp[2]>1)	{ d.src=d.p7TBimo; }
			}

			if ((g=MM_findObj('P7TabH'))!=null){

				gg=(document.layers)?g:g.style;
				gg.visibility="visible";
			}
		}
		else { 

			if(sF){
				gg.visibility="hidden";
			}

			if(P7TabProp[2]>0){
				d.src=d.p7TBim;
			}
		}
	}

	if( !tF ){

		if( dB>-1 ) {

			d=MM_findObj(P7TabIM[dB]);

			if((g=MM_findObj(P7TabSB[dB]))!=null&&P7TabProp[1]==0){

				gg=(document.layers)?g:g.style;
				gg.visibility="visible";
			}

			if(P7TabProp[2]>0){ 
				d.src=d.p7TBimd; 
			}
		}

		if((g=MM_findObj('P7TabH'))!=null){

			gg = (document.layers) ? g : g.style;
			gg.visibility="hidden";
		}
	}
}
