home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2002 April / GSSH42002.iso / EDITOREN / DS / gmax / gmax_help.exe / help / gmax.chm / acad.js < prev    next >
Text File  |  2001-08-23  |  5KB  |  169 lines

  1. // acad.js - JavaScript functions for Banff Help Files
  2. // 
  3. // v.0.11: 04may00 - fixed "display/collapse" all hidden text message so 
  4. //             it changes when clicked
  5. // v.0.10: 03may00 - adjusted the height of the Comments dialog
  6. // v.0.09: 26apr00 - added control of 'click4more' image in toggleLeadin
  7. //             added control of 'click4more' image in toggleProc
  8. //             deleted csJump function
  9. //             added localizable constants
  10. // v.0.08: 06apr00 - updated autoExpand so it really works!
  11. // v.0.07: 27mar00 - added doComments function
  12. // v.0.06: 22mar00 - added build_hhrun_object
  13. // v.0.05: 01mar00 - added extra "/" to jumpHTM
  14. // v.0.04: 29feb00 - updated jumpCHM
  15. // v.0.03: 09dec99 - added autoExpand
  16. // v.0.02: 08dec99 - added jumpHTM and jumpCHM
  17. // v.0.01: 30nov99 - the beginning
  18. //
  19. //===========================================================================
  20. // Constants:
  21.  
  22. var strclick4more   = "Click for more...";
  23. var strclick2hide   = "Click to hide...";
  24. var strcollapsetext = "Collapse all hidden text on this page.";
  25.  
  26. //===========================================================================
  27. // acOnload - placeholder for future functionality
  28. function acOnload() {
  29. //  autoExpand(0);
  30. }
  31.  
  32. function doComments() {
  33.   var stitle = document.title;
  34.   var surl   = location.href;
  35.   window.open("comments.htm#"+stitle,null,"height=450,width=450,resizable=yes,directories=no,location=no,menubar=no,status=no,toolbar=no" );
  36. }
  37.  
  38. // Jump to local non-compiled HTML file from a CHM
  39. // jumpHTM('drivers.htm');
  40. function jumpHTM(file) {
  41.   var path = location.pathname;
  42.   var i = path.lastIndexOf("\\");
  43.   var j = path.indexOf(":", 3);
  44.   path = path.substring(j+1,i+1);
  45.   location.href = "file:///" + path + file;
  46. }
  47.  
  48. // Jump to a local CHM file from a non-compiled HTML file
  49. // jumpCHM('acad_acr.chm::/acr_l30.html');
  50. function jumpCHM(file_topic) {
  51.   var path = location.pathname;
  52.   var i = path.lastIndexOf("\\");
  53.   path = path.substring(1,i+1);
  54.   location.href = "ms-its:" + path + file_topic;
  55. }
  56.  
  57. // Builds a ShortCut object to launch a CHM (with local path)
  58. // build_hhrun_object - 
  59. //
  60. function build_hhrun_object(file) {
  61.   var path = location.pathname;
  62.   var i = path.lastIndexOf("\\");
  63.   var j = path.indexOf(":", 3);
  64.   path = path.substring(j+1,i+1);
  65.   document.writeln("<OBJECT id=hhrun type='application/x-oleobject'");
  66.   document.writeln("  classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'");
  67.   document.writeln("  codebase='hhctrl.ocx#Version=4,73,8561,0'>");
  68.   document.writeln(" <PARAM name='Command' value='ShortCut'>");
  69.   document.writeln(" <PARAM name='Item1' value=',hh.exe," + path + file + "'>");
  70.   document.writeln(" <PARAM name='Window'  value='bogus.html'>");
  71.   document.writeln("</OBJECT>");
  72. }
  73.  
  74. function getpath() {
  75.   var path = location.pathname;
  76.   var i = path.lastIndexOf("\\");
  77.   var j = path.indexOf(":", 3);
  78.   path = path.substring(j+1,i+1);
  79.   return path;
  80. }
  81.  
  82. function MakeArray(n) {
  83.   this.length = n;
  84.   for (var i = 1; i <= n; i++) { 
  85.     this[i] = 0;
  86.   }
  87.   return this;
  88. }
  89.  
  90. function toggleLeadin() {
  91.   if( leadin.style.display == "" ) {
  92.     leadin.style.display = "none";
  93.     click4more.src = "chickletred.gif";
  94.     click4more.title = strclick4more;
  95.   }
  96.   else {
  97.     leadin.style.display="";
  98.     click4more.src = "chickletred2.gif";
  99.     click4more.title = strclick2hide;
  100.   }
  101. }
  102.  
  103. var lastspan = new MakeArray(5);
  104. var lastlink = new MakeArray(5);
  105. function togglespan( level, spanname, linkname ) {
  106.   if( spanname.style.display == "" ) {
  107.     spanname.style.display = "none";
  108.     lastspan[level] = 0;
  109.     lastlink[level] = 0;
  110.     if( linkname != null ) {
  111.       linkname.style.fontWeight = "";
  112.     }
  113.   }
  114.   else {
  115.     spanname.style.display="";
  116.     if( lastspan[level] != 0 ) { 
  117.       lastspan[level].style.display = "none"; 
  118.       lastlink[level].style.fontWeight = "";
  119.     }
  120.     lastspan[level] = spanname;
  121.     if( linkname != null ) {
  122.       lastlink[level] = linkname;
  123.       linkname.style.fontWeight = "bold";
  124.     }
  125.   }
  126. }
  127.  
  128. var allon = 0;
  129. //var showall1 = 0;
  130. function showAll() {
  131.   if( allon == 1 ) {
  132.     document.location.href = document.location.href;
  133.   }
  134.   else {
  135.     for ( i=0; i < document.all.length; i++ ) {
  136.       document.all.item(i).style.display = "";
  137.     }
  138.     allon = 1;
  139.     //if( showall1 != 0 ) {
  140.       document.all.showall1.innerText = strcollapsetext;
  141.     //  showall2.innerText = "";
  142.     //}
  143.   }
  144. }
  145.  
  146. function autoExpand( exp ) {
  147.   if( exp == 1 ) { showAll(); }
  148. }
  149.  
  150. function toggleproc( procname, imgname, anchor ){
  151.   var i = document.location.href.lastIndexOf("#");
  152.   var cur_href = "";
  153.   if( i > 0 ) { cur_href = document.location.href.substring(0,i); }
  154.   if( procname.style.display == "" ) {
  155.     procname.style.display = "none";
  156.     imgname.src = "right.gif";
  157.     procmore.title = strclick4more;
  158.   }
  159.   else {
  160.     procname.style.display="";
  161.     imgname.src = "down.gif";
  162.     procmore.title = strclick2hide;
  163.   }
  164. }
  165.  
  166.  
  167.  
  168.  
  169.