
<!-- hide scripts from silly old browsers

//This file contains functions used by online help.
//Note: Functions containing localizable text are stored in helploc.js.

/* Following collection of functions are used to display help in a frameset,
   with an index and/or toc in the left frame, and topics on the right. Ordinary html links can be 
   used to launch a frameset, but not to specify the topic file displayed within the frameset. 
   This means if you want to do context-sensitive links, scripting is needed. We currently support 
   two general approaches for doing this:

   The launchHelp() function is used for browser-based applications, where a browser launches the help window. 
   Thus one browser window spawns another: the function opens the help frameset in a new window, then displays the requested topic. 

   The loadHelp() function is used for non-browser-based applications, where the initial help call does
   not originate in a browser. The function is called *after* the browser window is opened, and loads 
   the requested topic in the current window. This function is typically called by a loadFrames() 
   function that is defined in the local script file for each product (localp.js). When an application 
   calls a topic, the loadFrames function creates a frameset and loads the requested topic.
*/


/* call help from a browser. This function replaces the deprecated launchHelp() function and loadHelp() functions */
function startHelp(topicpathname){
	helpWindow=window.open("", "helpWindow", "height=550px,width=750px,resizable,toolbar");	
	helpWindow.opener=self
	helpWindow.location.href=topicpathname
	helpWindow.focus();
}

/* The following function handles navigation frame events. The arguments are
   tested to make sure they exist, and then they are used to update the nav
   frame and/or the topic frame, as appropriate. This function replaces both
   loadTOC() and loadIndex() */
   
function navEvent(navsrc,topicsrc) {
	if ((typeof navsrc != 'undefined') && (navsrc != '')) {
		parent.navframe.location.replace(navsrc);
	}
	if ((typeof topicsrc != 'undefined') && (topicsrc != '')) {
		goTopic(topicsrc);
	}
}
	
/*display requested topic in topic frame. Links from index or toc use this function.*/ 
function goTopic(id){
	parent.topic.location.href=id;
}


/*
   Here's Clay's new function for making topic file "smart". Basically,
   each topic file should call this function on load. If the topic has been
   opened directly, the function will replace it with the appropriate frameset
   and reload the topic in a frame. (Of course, if the topic is opened in a frame
   it should just open normally.)
   
   Note: the filename to reload will need to be hard-coded into each topic file.
   This is because MSIE stupidly forgets document.URL and window.location.* if the OS
   launches an HTML file with the default browser. It doesn't seem to matter whether
   you load it with a regular filespec or with a "file:" URL.
*/

function loadFrames(filename) {
  html = "<frameset rows=\"*\" cols=\"250,*\"> \n" +
         "  <frame src=\"toc_top.htm\" name=\"navframe\" frameborder=0 scrolling=\"yes\">\n" +
         "  <frame src=\"blank.htm\" name=\"topic\" scrolling=\"AUTO\">\n" +
         "</frameset></HTML>\n";
  // resize and add new stuff
  self.resizeTo(700,550);
  document.write(html);
  document.close();
  topicvar = filename;
  loadHelpTopic();
}


/*
   This is a sister function to launchHelpTopic() that loads a
   help topic into an existing topic frame. The main difference is
   that this version is used in situation where there is no "opener"
   window, and topicvar is a variable of the current window. This will
   generally be true when this help is called from an application or
   launched independently, rather than called from a browser window.
 */
function loadHelpTopic() {
		if (self.topicvar) { //check for topicvar in the current window
			self.topic.location=self.topicvar;
		}
}



/* FOLLOWING FUNCTIONS ARE DEPRECATED AND REMAIN IN STYLESHEET 
ONLY TO SUPPORT CALLS TO EXISTING SMUGGLER HELP FILES. 
IF YOUR HELP FILE DOESN'T ALREADY USE THESE FUNCTIONS, DON'T USE THEM NOW
These functions should not be called by newer help files but are left in the script
because older help files use them (including many existing Smuggler templates */


/*launch help window and display file specified in locationpath parameter.
if locationpath points to a frameset, optional topicfile parameter specifies
the file to display in the topic frame. This must be done in two steps
cuz you can't update the topic frame until after frameset is loaded*/
/* DEPRECATED */
function launchHelp(locationpath, topicfile){
	if (topicfile) {
		lastslashpos = locationpath.lastIndexOf("/");
	      rootpath = locationpath.substr(0, lastslashpos + 1);
	      topicpathname =  rootpath + topicfile;
		startHelp(topicpathname);
	} else {
		startHelp(locationpath);
	}
}


/*after displaying a help frameset, checks whether file is displayed in a secondary window.
If yes, assume launchHelp() function was used and check value of topicvar to determine
what topic to display. If frameset was launched in main window, 
or if no topic was specified, do nothing*/
/* DEPRECATED */
function launchHelpTopic() {

	if (window.opener) {  //true only when frameset is launched in a secondary window 
			if (window.opener.topicvar != "notopic") { //if not topic specified, do nothing
				parent.topic.location=window.opener.topicvar
			}
	}
}


/* Here's a sister function for launchHelp(), which loads the help files in
the current window rather than opening a new one. 
if locationpath points to a frameset, optional topicfile parameter specifies
the file to display in the topic frame. This must be done in two steps
cuz you can't update the topic frame until after frameset is loaded*/
/* DEPRECATED */
function loadHelp(locationpath, topicfile){
	
 	 //if topic file was specified, save to global var that will persist after frameset is loaded
	if (topicfile) topicvar=topicfile
		else {topicvar = "notopic"}
    self.location = locationpath;
    self.resizeTo(700,550);
}

// This function pops up a little browser window containing the passed text--very
// useful for glossary and bibliography xrefs

function popup(title,text) {
  //pops up a mini window to display the text string passed

  if (typeof popupwin != "undefined") {
	popupwin.close();
  }
  popupwin = window.open("","popup","height=200,width=300,resizable");
  html = "<HTML>\n<HEAD>\n<TITLE>" + title + "</TITLE>\n" + 
	 "<link rel='stylesheet' href='tutorial.css' type='text/css' />\n</HEAD>\n" +
	 "<BODY onload='self.resizeBy(0,document.getElementsByTagName(\"DIV\")[0].offsetHeight-180);'>\n" +
	 "<DIV name='def' class='glossary-definition'>\n" + text + "\n</DIV>\n</BODY>\n</HTML>\n";
  popupwin.document.write(html);
  popupwin.document.close();
}



// end hiding scripts from silly old browswers -->
