
	function SearchKeyPress(searchtext,e)
		{
		var key;
		if(window.event)
			{
			key = window.event.keyCode;     //IE
			}
		else
			{
			key = e.which;     //firefox
			}
    	if(key == 13)
    		{
			search(searchtext);
			return false;
			}
		else
			{
			return true;
			}
		}


	function search(stext, sPageName)
		{
		//alert("text="+stext);
		//attempt to get the search text from the current document
		//var searchtext = document.getElementById("txtsearch").value
		//pass the search text to _search.htm

		if (sPageName == "" || sPageName == null)
			{
			//This is the global search
			var sSearchPage="_search.htm";
			}
		else
			{
			//If a pagename was passed then this is a child search
			var sSearchPage="_search_"+sPageName+".htm";
			}


		//if the fra_contents frame doesn't exist then display the search results on the current page
		if (document.getElementById("fra_contents") != null)
			{
			//window.open("_search.htm?searchTxt="+stext+sPageParm, "fra_contents");
			window.open(sSearchPage+"?searchTxt="+stext, "fra_contents");
			document.getElementById("fra_contents").style.display="";
			}
		else if (document.getElementById("basefrm") != null)
			{
			window.open(sSearchPage+"?searchTxt="+stext, "basefrm");
			}
		else
			{
			//location.href = "_search.htm?searchTxt="+stext+"&type=noframes"+sPageParm;
			location.href = sSearchPage+"?searchTxt="+stext+"&type=noframes";
			}
		
		}
	



	function DisplayIndex()
		{
		ShowIndex();
		}


	function ShowIndex()
		{
		//alert("displayindex");
		if (document.getElementById("fra_contents") != null)
			{
			window.open("_keywordindex.htm", "fra_contents");
			}
		else if (document.getElementById("basefrm") != null)
			{
			window.open("_keywordindex.htm", "basefrm");
			}
		else
			{
			location.href = "_keywordindex_noframes.htm";
			}
		}


	function ShowContents()
		{
		if (document.getElementById("fra_contents") != null)
			{
			window.open("contents.htm", "fra_contents");
			}
		else
			{
			location.href = "default.htm";
			}

		}




	
	function addtofav()
		{
		if (document.all)
			{
			//if there is a basefrm frame then get the URL from there, otherwise get the url for this page.
			if (document.getElementById("basefrm") == null)
				{
				//Get URL from basefrm frame
				var sFavURL=String(location.href);
				var sPageName = sFavURL.substr(sFavURL.lastIndexOf("/")+1)
				}
			else
				{
				//get URL from this page
				var sPageURL=String(window.basefrm.location);
				var sPageName = sPageURL.substr(sPageURL.lastIndexOf("/")+1)
				var sFavURL =  "http://" + location.hostname + location.pathname + "?" + sPageName
				}

			//Remove any parameters from the url (eg. page.aspx?search=X)
			if (sFavURL.toLowerCase().indexOf("?") != -1)
				{
				sFavURL=sFavURL.substr(0,sFavURL.lastIndexOf("?"))
				}

			//Remove any parameters from the pagename (eg. page.aspx?search=X)
			if (sPageName.toLowerCase().indexOf("?") != -1)
				{
				sPageName=sPageName.substr(0,sPageName.lastIndexOf("?"))
				}


			//remove any %20 codes (space codes)
			sPageName = sPageName.replace(/%20/g, " ");
			var sTitle=sPageName;
			window.external.AddFavorite(sFavURL,sTitle);

			}
		}
	


	function printpage()
		{
		//if the basefrm frame exists then print the contents
		if (document.getElementById("basefrm") != null)
			{
			printframe();
			}
		else
			{
			//If this is IE then print the cell containing the page HTML. If this is another browser then print the entire page.
			if (navigator.userAgent.toLowerCase().indexOf("ie") == -1)
				{
				//Current browser is not IE
				window.print();
				}
			else
				{
				//Current browser is IE
				print_noframes();
				}
			}
		}


	function printframe()
		{
		//print the basefrm frame
		window.frames['basefrm'].focus(); 
		window.frames['basefrm'].print();
		}


	function print_noframes()
		{
		var printIframe = document.createElement("IFRAME");
		document.body.appendChild(printIframe);
		var printDocument = printIframe.contentWindow.document;
		printDocument.designMode = "on";
		printDocument.open();
		var currentLocation = document.location.href;
		currentLocation = currentLocation.substring(0, currentLocation.lastIndexOf("/") + 1);
		var htmlcontent = document.getElementById("td_noframes_main")
		printDocument.write("<html><head></head><body>" + htmlcontent.innerHTML + "</body></html>");
		printDocument.close();

		try
			{
			if (document.all)
				{
				var oLink = printDocument.createElement("link");
				oLink.setAttribute("href", currentLocation + "pagestyles.css", 0);
				oLink.setAttribute("type", "text/css");
				oLink.setAttribute("rel", "stylesheet", 0);
				printDocument.getElementsByTagName("head")[0].appendChild(oLink);
				printDocument.execCommand("Print");
				}
			else
				{
				printDocument.body.innerHTML = "<link rel='stylesheet' type='text/css' href='" + currentLocation + "pagestyles.css'></link>" + printDocument.body.innerHTML;
				printIframe.contentWindow.print();
				}
			}
		catch(ex)
			{
			}
		document.body.removeChild(printIframe);
		}


	function showpageurl()
		{
		//if there is a basefrm frame then get the URL from there, otherwise get the url for this page.
		if (document.getElementById("basefrm") == null)
			{
			//get URL from this page
			var sPageURL=String(location.href);
			var sPageName = sPageURL.substr(sPageURL.lastIndexOf("/")+1)
			var sRelativeURL = "help/" + sPageName;
			}
		else
			{
			//Get URL from basefrm frame
			var sPageURL=String(window.basefrm.location.href);
			//Remove any parameters (eg. page.aspx?parm1=X)
			if (sPageURL.toLowerCase().indexOf("?") != -1)
				{
				sPageURL=sPageURL.substr(0,sPageURL.lastIndexOf("?"))
				}
			
			var sPageName = sPageURL.substr(sPageURL.lastIndexOf("/")+1)
			var sPageURL =  document.URL + "?" + sPageName;
			var sRelativeURL = "help/default.htm?" + sPageName;
			}

		var e=document.getElementById("divpageurl");
		
		//Get the page filename
		//var sPageURL=String(window.basefrm.location);
		//var sPageName = sPageURL.substr(sPageURL.lastIndexOf("/")+1)
		//Set the div innerHTML
		var sHTML = ""
		//sHTML = sHTML + "<font face=arial size=2>Page URL:<br><a href='" + document.URL+"?"+sPageName+"' target='_blank'>"+document.URL+"?"+sPageName+"</a>";
		sHTML = sHTML + "<font face=arial size=2>Page URL:<br><a href='" + sPageURL + "' target='_blank'>"+sPageURL+"</a>";
		//sHTML = sHTML + "<br><br>Relative URL: <font color=#D8D8D6>(assuming help system is in a sub folder named 'help')</font><br><font color=blue>help/default.htm?" + sPageName + "</font></font>";
		sHTML = sHTML + "<br><br>Relative URL: <font color=#D8D8D6>(assuming help system is in a sub folder named 'help')</font><br><font color=blue>" + sRelativeURL + "</font></font>";
		document.getElementById("divpageurl_content").innerHTML=sHTML;
		//e.innerHTML=document.URL+"?"+sPageName;
		//Position the div box below the link icon
		e.style.top=document.body.clientHeight/2-75;
		e.style.left=document.body.clientWidth/2-210;
		//show the div box
		e.style.display="";
		//e.focus();
		}



	function loadpage()
		{
		//if a page was passed in the url,load it now
		//alert("href = "+top.location.href);
		if (top.location.href.lastIndexOf("?") > 0)
			{
			//attempt to get the file name that was passed
			var sPage=top.location.href.substring(top.location.href.lastIndexOf("?")+1,top.location.href.length);
			//alert("last four chars = "+sPage.toLowerCase().substring(sPage.length-4, sPage.length));
			//if the prefix is .htm then load the page, otherwise don't do anything
			if (sPage.toLowerCase().substring(sPage.length-4, sPage.length) == ".htm")
				{
				var myframe=document.getElementById("basefrm");
				//if the 'basefrm' frame is not found then assume that this is a "no-frames" help system
				if (myframe == null)
					{
					location.href=sPage;
					}
				else
					{
					document.getElementById("basefrm").src=sPage;
					}
				}
			else if (sPage.toLowerCase() == "index")
				{
				ShowIndex();
				}

			}
		}


		function tabclick_contents(sSkinName)
			{
			//display the contents tab, and hide the search box
			document.getElementById("imgtabs").src="skinimages/"+sSkinName+"_tabs_contents.gif";
			document.getElementById("trSearchBox").style.display="none";
			document.getElementById("fra_contents").style.display="";
			ShowContents()
			}
			
		function tabclick_index(sSkinName)
			{
			//display the index tab, and hide the search box
			document.getElementById("imgtabs").src="skinimages/"+sSkinName+"_tabs_index.gif";
			document.getElementById("trSearchBox").style.display="none";
			document.getElementById("fra_contents").style.display="";
			ShowIndex()			
			}
			
		function tabclick_search(sSkinName)
			{
			//display the search tab
			document.getElementById("imgtabs").src="skinimages/"+sSkinName+"_tabs_search.gif";
			
			//show the search box
			document.getElementById("trSearchBox").style.display="";
			
			//Hide the contents window
			document.getElementById("fra_contents").style.display="none";
			}
			
		function previouspage()
			{
				onclick = history.back()
			}
			
		function nextpage()
			{
				onclick = history.forward()
			}

		function showhomepage(homepage)
			{
			if (document.getElementById("basefrm") != null)
				{
				window.open(homepage, "basefrm");
				}
			else
				{
				location.href = homepage;
				}
			}
			
		function browse()
			{
			if (document.getElementById("basefrm") != null)
				{
				window.open("contents.htm", "basefrm");
				}
			else
				{
				location.href = "contents.htm";
				}
			}

		function showaskpage()
			{
			if (document.getElementById("basefrm") != null)
				{
				window.open("ask.htm", "basefrm");
				}
			else
				{
				location.href = "ask.htm";
				}
			}


		function showoptions()
			{
			//if the options form is already displayed then hide it
			if (document.getElementById("tbloptions").style.display=="")
				{
				document.getElementById("tbloptions").style.display="none";
				}
			else
				{
				document.getElementById("tbloptions").style.display="";
				document.getElementById("tbloptions").focus();
				//position the options list below the options button
				document.getElementById("tbloptions").style.top=document.getElementById("imgoptions").offsetTop+document.getElementById("imgoptions").offsetHeight;
				document.getElementById("tbloptions").style.left=document.getElementById("imgoptions").offsetLeft+document.getElementById("imgoptions").offsetWidth-198;
				}
			}