| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 | 
							- /*
 
- Licensed Materials - Property of IBM
 
- IBM Cognos Products: DOCS
 
- © Copyright IBM Corp. 1999, 2013.
 
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 
- */
 
- function encodeJS(str) {
 
- 	var out = '';
 
- 	for(var i=0; i<str.length; i++) {
 
- 		var ch = str.charAt(i);
 
- 	    if(ch === '<') {
 
-              out += '\\x3c';
 
-          } else if(ch === '>') {
 
-              out += '\\x3e';
 
-          } else if(ch === "'") {
 
-              out += '\\x27'; 
 
-          } else if(ch === '"') {
 
-              out += '\\x22';                        
 
- 		 } else if(ch === '\\') {
 
- 			 out += '\\x5c';
 
-          } else {
 
-              out += ch;
 
-          }	
 
- 	}
 
- 	return out;                
 
- }
 
- function init(newVersion)
 
- {
 
- 	var query = parseHash(window.location.href); // read URL for topic/section info
 
- 	var sCurrentTopic = "";
 
- 	var sDirTopics = "";
 
- 	var sHelpIDtopic = "";
 
- 	// determine current helpID topic reference, and use over any other info
 
- 	if( query['helpid'] && (query['helpid'] != "") ) {
 
- 		// determine which file the helpid/topicalias is in
 
- 		sHelpIDtopic = checkHelpID(query['helpid']);
 
- 		sCurrentTopic = (sHelpIDtopic && (sHelpIDtopic!= "")) ? (sHelpIDtopic) : welcomeTopic; // welcomeTopic globally defined variable 
 
- 		sCurrentTopic += (query['helpid'] && (query['helpid'] != "")) ? ("#" + query['helpid']) : "";
 
- 	}
 
- 	else {
 
- 		// determine current topic and section html info
 
- 		sCurrentTopic = (query['topic'] && (query['topic'] != "")) ? (query['topic'] + ".html") : welcomeTopic; // welcomeTopic globally defined variable 
 
- 		sCurrentTopic += (query['section'] && (query['section'] != "")) ? ("#" + query['section']) : "";
 
- }
 
- 	// determine full path to html
 
- 	var sDirString = window.location.href.substring(0, window.location.href.indexOf('?') );
 
- 	var nPos = sDirString.lastIndexOf('/');
 
- 	sDirTopics = (nPos != -1) ? window.location.href.substring(0, nPos + 1) : "";
 
- 	sCurrentTopic = sDirTopics + sCurrentTopic;
 
- 	sCurrentTopic = encodeJS(sCurrentTopic);
 
- 	sTabs = sDirTopics + sTabs; // sTabs globally defined variable
 
- //commenting out the two lines below because of a change needed to allow our files to work properly in a secure environment
 
- if (!newVersion) {
 
- 	window.tab.location.href = sTabs;
 
- 	window.content.location.href = sCurrentTopic;
 
- }
 
- else {
 
- //return the result of the topic that was found so that the frame src attribute can be populated in the <bookname>.html and <bookname>_a.html files
 
- //sTabs has already been determined by the server and the variable in the template file replaced with the appropriate value for that book.
 
- 	return sCurrentTopic;
 
- }
 
- }
 
- function parseHash(s)
 
- {
 
- 	var query = new Array();
 
- 	var nPos = s.indexOf("?");
 
- 	if (nPos != -1)
 
- 	{
 
- 		s = s.substring(nPos + 1, s.length);
 
- 		var sPair = "";
 
- 		while (s != "")
 
- 		{
 
- 			nPos = s.indexOf("&");
 
- 			if (nPos == -1) { sPair = s; s = ""; }
 
- 			else {	sPair = s.substring(0, nPos); s = s.substring(nPos + 1, s.length); }
 
- 			nPos = sPair.indexOf("=");
 
- 			if (nPos != -1) query[sPair.substring(0, nPos)] = unescape(sPair.substring(nPos + 1, sPair.length));
 
- 		}
 
- 	}
 
- 	return query;
 
- }
 
 
  |