if (parent==self)
{
var thisfile=rightFromSubStringToEndOfFullString(location.href, "/");
thisfile=thisfile.substring(0,thisfile.lastIndexOf("."));
var controlsource="";
//var activex=1;
var justinit=1;
var searchinit=1;
var tabloaded=0;
var searchTerm="";
var lastsearchTerm="";
var searchPhrase=false;
var synchReady=false;
var aReturn;
var lasttopic;
var thistopic;
document.write('<FRAMESET rows="100,100%"  frameborder=1>');
document.write('<frame MARGINWIDTH="0" MARGINHEIGHT="0" NAME="tab" NORESIZE SCROLLING="NO" SRC="hptab3.htm" FRAMEBORDER="0">');
document.write('<FRAMESET name="lowerhalf" id="lowerhalf" COLS="270,*" frameborder=1>');
document.write('<FRAME MARGINWIDTH="0" MARGINHEIGHT="0"  SRC="navframe-NOactx.html" id="navframe" name="navframe" scrolling=auto>');
document.write('<frame src="' + (location.search ? location.search.substring(1):thisfile) + '.htm" name="content"> scrolling=auto>');
document.write('</FRAMESET>');
document.write('</FRAMESET>');
var ref=document.referrer;
content.location=thisfile+".htm";
}
//}
//Returns everything right of the last instance of the subString to the end of the fullString 
function rightFromSubStringToEndOfFullString(fullString, subString) { 
if (fullString.lastIndexOf(subString) == -1) { 
return ""; 
} else { 
return fullString.substring(fullString.lastIndexOf(subString)+1, fullString.length); 
} 
} 


function imageInit(strname)
{
	var loaded = false;
	if (document.images)
 	{
		if(strname=='first')
		{
			gotopcontOFF = new Image();gotopcontOFF.src = "images/gotopcontOFF.gif";
    		nextcontOFF = new Image();nextcontOFF.src = "images/nextcontOFF.gif";
    		nextcontbotOFF = new Image();nextcontbotOFF.src = "images/nextcontOFF.gif";
    		gotopcontON = new Image();gotopcontON.src = "images/gotopcontON.gif";
   			nextcontON = new Image();nextcontON.src = "images/nextcontON.gif";
    		nextcontbotON = new Image();nextcontbotON.src = "images/nextcontON.gif";
		}
		if(strname=='middle')
		{
    		gotopcontOFF = new Image();gotopcontOFF.src = "images/gotopcontOFF.gif";
    		nextcontOFF = new Image();nextcontOFF.src = "images/nextcontOFF.gif";
    		nextcontbotOFF = new Image();nextcontbotOFF.src = "images/nextcontOFF.gif";
    		prevcontOFF = new Image();prevcontOFF.src = "images/prevcontOFF.gif";
    		prevcontbotOFF = new Image();prevcontbotOFF.src = "images/prevcontOFF.gif";
    		homecontOFF = new Image();homecontOFF.src = "images/homecontOFF.gif";
    		homecontbotOFF = new Image();homecontbotOFF.src = "images/homecontOFF.gif";
    		gotopcontON = new Image();gotopcontON.src = "images/gotopcontON.gif";
    		nextcontON = new Image();nextcontON.src = "images/nextcontON.gif";
    		nextcontbotON = new Image();nextcontbotON.src = "images/nextcontON.gif";
    		prevcontON = new Image();prevcontON.src = "images/prevcontON.gif";
    		prevcontbotON = new Image();prevcontbotON.src = "images/prevcontON.gif";
    		homecontON = new Image();homecontON.src = "images/homecontON.gif";
    		homecontbotON = new Image();homecontbotON.src = "images/homecontON.gif";
    	}
    	if(strname=='last')
    	{
    		gotopcontOFF = new Image();gotopcontOFF.src="images/gotopcontOFF.gif";
    		nextcontOFF = new Image();nextcontOFF.src="images/nextcontOFF.gif";
    		nextcontbotOFF = new Image();nextcontbotOFF.src="images/nextcontOFF.gif";
    		prevcontOFF = new Image();prevcontOFF.src="images/prevcontOFF.gif";
    		prevcontbotOFF = new Image();prevcontbotOFF.src="images/prevcontOFF.gif";
    		homecontOFF = new Image();homecontOFF.src="images/homecontOFF.gif";
    		homecontbotOFF = new Image();homecontbotOFF.src="images/homecontOFF.gif";
    		gotopcontON = new Image();gotopcontON.src="images/gotopcontON.gif";
    		nextcontON = new Image();nextcontON.src="images/nextcontON.gif";
    		nextcontbotON = new Image();nextcontbotON.src="images/nextcontON.gif";
    		prevcontON = new Image();prevcontON.src="images/prevcontON.gif";
    		prevcontbotON = new Image();prevcontbotON.src="images/prevcontON.gif";
    		homecontON = new Image();homecontON.src="images/homecontON.gif";
    		homecontbotON = new Image();homecontbotON.src="images/homecontON.gif";
    	}
    	if(strname=='sample')
		{
    		gobackcontOFF = new Image();gobackcontOFF.src = "images/gobackoff.gif";
     		gobackcontON = new Image();gobackcontON.src = "images/gobackon.gif";
    		gobackcontbotOFF = new Image();gobackcontbotOFF.src = "images/gobackoff.gif";
     		gobackcontbotON = new Image();gobackcontbotON.src = "images/gobackon.gif";
    		gotopcontOFF = new Image();gotopcontOFF.src = "images/gotopcontOFF.gif";
    		nextcontOFF = new Image();nextcontOFF.src = "images/nextcontOFF.gif";
    		nextcontbotOFF = new Image();nextcontbotOFF.src = "images/nextcontOFF.gif";
    		prevcontOFF = new Image();prevcontOFF.src = "images/prevcontOFF.gif";
    		prevcontbotOFF = new Image();prevcontbotOFF.src = "images/prevcontOFF.gif";
    		homecontOFF = new Image();homecontOFF.src = "images/homecontOFF.gif";
    		homecontbotOFF = new Image();homecontbotOFF.src = "images/homecontOFF.gif";
    		gotopcontON = new Image();gotopcontON.src = "images/gotopcontON.gif";
    		nextcontON = new Image();nextcontON.src = "images/nextcontON.gif";
    		nextcontbotON = new Image();nextcontbotON.src = "images/nextcontON.gif";
    		prevcontON = new Image();prevcontON.src = "images/prevcontON.gif";
    		prevcontbotON = new Image();prevcontbotON.src = "images/prevcontON.gif";
    		homecontON = new Image();homecontON.src = "images/homecontON.gif";
    		homecontbotON = new Image();homecontbotON.src = "images/homecontON.gif";  		
     		
    	}

	}
}
function navversion()
{
	var ua = window.navigator.userAgent;
	var netscape8 = ua.indexOf("Netscape/8")
	var opera8 = ua.indexOf("Opera/8")
	var an = navigator.appName;
	var av=navigator.appVersion;
	//var windows = av.indexOf("Windows");// windows, but NOT
	//var windows3x = ua.indexOf("Windows 3"); //windows 3.x
	//if (an=="Netscape" && windows > 0 && windows3x==-1) {
		//return(parseInt(av.substring(0,1)));}
	if(netscape8!=-1||opera8 !=-1)
		return(5);
	if (an=="Netscape") {
		return(parseInt(av.substring(0,1)));}
	// is other browser or Not windows  4.x or higher
	return(0);
}
function htmlsniff()
{
var x=0;
var y=navversion();
if(y<5 && y>0)
	alert("Your browser is too old to display some of the some of the content on this page.");
if(document.getElementById('testframe').innerHTML)
	x=1;
else
	alert("Your browser is too old to display some of the some of the content on this page.");
}
function imageLoad() {
    if (document.images) {
          return (loaded = true);
          }
} 
function rollOut(imgName) {
    if (document.images) {
        document[imgName].src = eval(imgName+"OFF.src");
    }
}
function rollIn(imgName) {
// window.alert(imgName); 
   //window.alert(self.parent.buttons.location); 
   if (document.images)// && (loaded == true)) commented out 2/12/07
   {
        document[imgName].src = eval(imgName+"ON.src");
    }
}
function frameOpener(strname)
{
	//alert(strname);
	var sample=strname.indexOf('sample');
	if(sample>=0)
		strname=strname.substring(0,sample);
	//alert(strname)
	//strQueryString = window.name;
	/*if (parent == self)
	{ 
		if (document.images)
			top.location.replace('indexfr.htm?'+strname);
		else
			window.location.href = 'indexfr.htm?'+strname;
		//self.parent.contentloaded=1;
	}*/
	if (parent != self)
	//else
	{
		//self.parent.contentloaded=1;
    	//self.parent.ThisContentTopic=strname+".htm";
    	self.parent.tab.topofTopic=strname+".htm";
 		//if (self.parent.activex==1 &&  self.parent.tabloaded==1 && self.parent.buttonsloaded==1)
			//self.parent.tab.Sync();
 //alert("foobar")
var TOC=new Array()
TOC[0]="hpwel.htm";
TOC[1]="priv.htm";
TOC[2]="cp.htm";
TOC[3]="news.htm";
TOC[4]="cmwel.htm";
TOC[5]="opwel.htm";
TOC[6]="gl99.htm";
TOC[7]="man.htm";
TOC[8]="co01.htm";
TOC[9]="ca01.htm";
TOC[10]="dict.htm";
TOC[11]="fi98.htm";
TOC[12]="fl05.htm";
TOC[13]="fa01.htm";
TOC[14]="fp99.htm";
TOC[15]="gr98.htm";
TOC[16]="add.htm";
TOC[17]="thes.htm";
TOC[18]="surf.htm";
TOC[19]="lu01.htm";
TOC[20]="pc03.htm";
TOC[21]="pa01.htm";
TOC[22]="ph01.htm";
TOC[23]="pl03.htm";
TOC[24]="pr03.htm";
TOC[25]="rh05.htm";
TOC[26]="so03.htm";
TOC[27]="spec.htm";
TOC[28]="te01.htm";
TOC[29]="req.htm";
TOC[30]="upcom.htm";
TOC[31]="oiwel.htm";
TOC[32]="liveordform.htm";
TOC[33]="ordform.htm";
TOC[34]="pdfordform.htm";
TOC[35]="cswel.htm";
TOC[36]="returns.htm";
var y=-1;
var x=0;
var thisone=strname+".htm";
if(top.thistopic!=null)
	top.lasttopic=top.thistopic;
top.thistopic=strname;
//alert(top.thistopic);
//self.parent.navframe.buttons.synch();
if (top.synchReady==true)
	top.navframe.buttons.synch();
 //top.lowerhalf.navframe.buttons.synch(); 	
for(x=0;x<=36; x++)
{
	if(thisone==TOC[x])
	y=x;
}
	self.parent.tab.topofTopic=TOC[y];
	if(y==0)
		self.parent.tab.prevTopic="";
	else
		self.parent.tab.prevTopic=TOC[y-1];
	if(y==36)
		self.parent.tab.nextTopic="";
	else
		self.parent.tab.nextTopic=TOC[y+1];
		
	if(sample>=0)
		self.parent.tab.topofTopic=strname+"sample.htm";
	else
		self.parent.tab.topofTopic=strname+".htm";
		//alert(self.parent.tab.topofTopic)
		//self.parent.tab.nextTopic="thes.htm";
		self.parent.document.title=document.title;
	}
	//window.alert("searchTerm="+top.searchTerm+" Mode="+top.searchPhrase+" Activetab="+self.parent.tab.activeTab);
	if (top.aReturn!=null)// && self.parent.tab.activeTab==2)
	{  	
		var i=0;
   				while (i<top.aReturn.length)
   				{
     				if (top.aReturn.item(i).href==top.content.location)
     				{
     					i=top.aReturn.length;
     					highlightSearchTerms(top.searchTerm, top.searchPhrase);
     				}
     				else
	     				i++;
     			}
     }
	
	highlightSearchTerms(top.searchTerm, top.searchPhrase);
	//alert(document.referrer);
	if (top.ref!="" && sample==-1) //don't highlight sample: messes up DHTML
		highlightGoogleSearchTerms(self.parent.ref);
	//testHighlightGoogleSearchTerms();
	
}
function viewpage(strname)
 	{
		window.open(strname,"GOO","height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
		//window.open("addscn.htm","GOO","height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
    	}
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag) 
{
  // the highlightStartTag and highlightEndTag parameters are optional
  if ((!highlightStartTag) || (!highlightEndTag)) {
    highlightStartTag = "<font name=hilite style='color:black; background-color:yellow;font-weight:bold'>";
    highlightEndTag = "</font>";
  }
  
  // find all occurences of the search term in the given text,
  // and add some "highlight" tags to them (we're not using a
  // regular expression search, because we want to filter out
  // matches that occur within HTML tags and script blocks, so
  // we have to do a little extra validation)
  var newText = "";
  var i = -1;
  var left="";
  var right="";
  var offset1='<a name="hijump';
  var offset2='" ></a>';
  var j=0;
	var rok=false;
  var lok=false;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
  /*var codes=new Array()
	for(j=0;j<=255; j++)
	{
	codes[j]=String(j);}*/

  while (bodyText.length > 0) {
    i = lcBodyText.indexOf(lcSearchTerm, i+1);
    if (i < 0) {
      newText += bodyText;
      bodyText = "";
    } else {
      // skip anything inside an HTML tag
      if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
        // skip anything inside a <script> block
        if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
        //try to make sure search term is a word vs. a substring
          if (i==0)
          	left="";
          else
          	left=bodyText.substr(i-1, 1);
          if (i + searchTerm.length>bodyText.length)
          	right="";
          else
          	right=bodyText.substr(i + searchTerm.length, 1);
          	//alert("left="+left+" right="+right);
          if (left==" "||left=="("||left=="["||left==","||left==";"||left==","|| left=="."||left==""||left==">"||left=="/"||left=="-"||left=='"')
          	lok=true;
          else
            lok=false;
		if (right==" "||right==")"||right=="]"||right==","||right==";"||right==","|| right=="."||right==""||right=="<"||right=="/"||right=="-"||right=='"'||10==right.charCodeAt(0)||13==right.charCodeAt(0))
          	rok=true;
        else
            rok=false;
/*            if (right=="")
            	right='""';
            if (right==" ")
            	right='" "';
            if (13==right.charCodeAt(0))
            	right='13';
            if (right.charCodeAt(0)>13)
            	right='>13';
            if (right.charCodeAt(0)<13)
            	right='<13';*/
           // alert("lok="+lok+" left="+left+" rok="+rok+" right="+right+" coderight="+codes[right.charCodeAt(0)]);
		  if (lok && rok)//probably a word, so highlight
          	//newText += bodyText.substring(0, i) + offset1+String(j++)+offset2+highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
          	newText += bodyText.substring(0, i) +highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
         else //don't highlight
          	newText += bodyText.substring(0, i) + bodyText.substr(i, searchTerm.length);
          bodyText = bodyText.substr(i + searchTerm.length);
          lcBodyText = bodyText.toLowerCase();
          i = -1;
        }
      }
    }
  }
  return newText;
}


/*
 * This is sort of a wrapper function to the doHighlight function.
 * It takes the searchText that you pass, optionally splits it into
 * separate words, and transforms the text on the current web page.
 * Only the "searchText" parameter is required; all other parameters
 * are optional and can be omitted.
 */
function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)
{
  // if the treatAsPhrase parameter is true, then we should search for 
  // the entire phrase that was entered; otherwise, we will split the
  // search string so that each word is searched for and highlighted
  // individually
  //window.alert(searchText);
 if (searchText=="") 
  	return false;
  if (treatAsPhrase) {
    searchArray = [searchText];
  } else {
    searchArray = searchText.split(" ");
  }
  if (!document.body || typeof(document.body.innerHTML) == "undefined") {
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i < searchArray.length; i++) {
    bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
  }

  document.body.innerHTML = bodyText;
  //window.alert("hi");
  return true;
}


/*
 * This displays a dialog box that allows a user to enter their own
 * search terms to highlight on the page, and then passes the search
 * text or phrase to the highlightSearchTerms function. All parameters
 * are optional.
 */
function searchPrompt(defaultText, treatAsPhrase, textColor, bgColor)
{
  // This function prompts the user for any words that should
  // be highlighted on this web page
  if (!defaultText) {
    defaultText = "";
  }
  
  // we can optionally use our own highlight tag values
  if ((!textColor) || (!bgColor)) {
    highlightStartTag = "";
    highlightEndTag = "";
  } else {
    highlightStartTag = "<font style='color:" + textColor + "; background-color:" + bgColor + ";'>";
    highlightEndTag = "</font>";
  }
  
  if (treatAsPhrase) {
    promptText = "Please enter the phrase you'd like to search for:";
  } else {
    promptText = "Please enter the words you'd like to search for, separated by spaces:";
  }
  
  searchText = prompt(promptText, defaultText);

  if (!searchText)  {
    alert("No search terms were entered. Exiting function.");
    return false;
  }
  
  return highlightSearchTerms(searchText, treatAsPhrase, true, highlightStartTag, highlightEndTag);
}


/*
 * This function takes a referer/referrer string and parses it
 * to determine if it contains any search terms. If it does, the
 * search terms are passed to the highlightSearchTerms function
 * so they can be highlighted on the current page.
 */
function highlightGoogleSearchTerms(referrer)
{
  // This function has only been very lightly tested against
  // typical Google search URLs. If you wanted the Google search
  // terms to be automatically highlighted on a page, you could
  // call the function in the onload event of your <body> tag, 
  // like this:
  //   <body onload='highlightGoogleSearchTerms(document.referrer);'>
  
  //var referrer = document.referrer;
  if (!referrer) {
    return false;
  }
  
  var queryPrefix = "q=";
  var startPos = referrer.toLowerCase().indexOf(queryPrefix);
  var quotePos = referrer.toLowerCase().indexOf('%22');
  if ((startPos < 0) || (startPos + queryPrefix.length == referrer.length)) {
    return false;
  }
  
  var endPos = referrer.indexOf("&", startPos);
  if (endPos < 0) {
    endPos = referrer.length;
  }
  
  var queryString = referrer.substring(startPos + queryPrefix.length, endPos);
  // fix the space characters
  queryString = queryString.replace(/%20/gi, " ");
  queryString = queryString.replace(/\+/gi, " ");
  queryString = queryString.replace(/%2f/gi, "/");
  // remove the quotes (if you're really creative, you could search for the
  // terms within the quotes as phrases, and everything else as single terms)
  queryString = queryString.replace(/%22/gi, "");
  queryString = queryString.replace(/\"/gi, "");
  if(quotePos<0)
  	return highlightSearchTerms(queryString, false);
  else
  	return highlightSearchTerms(queryString, true);
}


/*
 * This function is just an easy way to test the highlightGoogleSearchTerms
 * function.
 */
function testHighlightGoogleSearchTerms()
{
  var referrerString = "http://www.google.com/search?q=javascript%20highlight&start=0";
  referrerString = prompt("Test the following referrer string:", referrerString);
  return highlightGoogleSearchTerms(referrerString);
}
