fhlp.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: DOCS
  4. © Copyright IBM Corp. 1999, 2013.
  5. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. function fHlp( contextHelpFile )
  8. {
  9. var sCurrentTopic = "";
  10. var sDirTopics = "";
  11. var contentLocation = parent.content.location.href || '';
  12. var pathnameLocation = parent.content.location.pathname || '';
  13. var stringLocation = parent.content.location.hash || '';
  14. //crop off the hash symbol and get the topic section
  15. var topicSection = stringLocation.substring(1, stringLocation.length) || '';
  16. //determine the topic i.e. referenced HTML file
  17. sCurrentTopic = contentLocation.substring( contentLocation.lastIndexOf("/") + 1, contentLocation.length );
  18. //strip off the .html or extension and any link anchors (#)
  19. sCurrentTopic = sCurrentTopic.substring(0, sCurrentTopic.lastIndexOf(".") ) || '';
  20. //determine the full URL and remove any filename reference (strictly path)
  21. sDirTopics = contentLocation.substring(0, contentLocation.lastIndexOf('/') + 1) || '';
  22. if( contentLocation ) {
  23. var locationTarget = sDirTopics + contextHelpFile;
  24. if( sCurrentTopic )
  25. locationTarget = locationTarget + '?topic=' + sCurrentTopic;
  26. if( topicSection )
  27. locationTarget = locationTarget + '&section=' + topicSection;
  28. top.location.href = locationTarget;
  29. }
  30. }
  31. function findObj(n, d) {
  32. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  33. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  34. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  35. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  36. if(!x && document.getElementById) x=document.getElementById(n); return x;
  37. }
  38. function showHideTabs() {
  39. var i,p,v,obj,args=showHideTabs.arguments;
  40. for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
  41. if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
  42. obj.visibility=v; }
  43. }