home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / Chip Temmuz 2004.iso / program / tam_surum / G-MAX / gmax12_tutorials / help / gmax_t.chm / acad.js next >
Encoding:
JavaScript  |  2002-10-17  |  5.1 KB  |  177 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.   var i = surl.indexOf("::");
  36.   if( i == -1 ) {
  37.     i = surl.lastIndexOf("/"); 
  38.     chmpath = surl.substring(0,i+1);
  39.   } else {
  40.     chmpath = surl.substring(0,i+3);
  41.   }
  42.   window.open(chmpath+"comments.htm#"+stitle+" ["+surl+"]",null,"height=450,width=450,resizable=yes,directories=no,location=no,menubar=no,status=no,toolbar=no" );
  43. }
  44.  
  45.  
  46. // Jump to local non-compiled HTML file from a CHM
  47. // jumpHTM('drivers.htm');
  48. function jumpHTM(file) {
  49.   var path = location.pathname;
  50.   var i = path.lastIndexOf("\\");
  51.   var j = path.indexOf(":", 3);
  52.   path = path.substring(j+1,i+1);
  53.   location.href = "file:///" + path + file;
  54. }
  55.  
  56. // Jump to a local CHM file from a non-compiled HTML file
  57. // jumpCHM('acad_acr.chm::/acr_l30.html');
  58. function jumpCHM(file_topic) {
  59.   var path = location.pathname;
  60.   var i = path.lastIndexOf("\\");
  61.   path = path.substring(1,i+1);
  62.   location.href = "ms-its:" + path + file_topic;
  63. }
  64.  
  65. // Builds a ShortCut object to launch a CHM (with local path)
  66. // build_hhrun_object - 
  67. //
  68. function build_hhrun_object(file) {
  69.   var path = location.pathname;
  70.   var i = path.lastIndexOf("\\");
  71.   var j = path.indexOf(":", 3);
  72.   path = path.substring(j+1,i+1);
  73.   document.writeln("<OBJECT id=hhrun type='application/x-oleobject'");
  74.   document.writeln("  classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'");
  75.   document.writeln("  codebase='hhctrl.ocx#Version=4,73,8561,0'>");
  76.   document.writeln(" <PARAM name='Command' value='ShortCut'>");
  77.   document.writeln(" <PARAM name='Item1' value=',hh.exe," + path + file + "'>");
  78.   document.writeln(" <PARAM name='Window'  value='bogus.html'>");
  79.   document.writeln("</OBJECT>");
  80. }
  81.  
  82. function getpath() {
  83.   var path = location.pathname;
  84.   var i = path.lastIndexOf("\\");
  85.   var j = path.indexOf(":", 3);
  86.   path = path.substring(j+1,i+1);
  87.   return path;
  88. }
  89.  
  90. function MakeArray(n) {
  91.   this.length = n;
  92.   for (var i = 1; i <= n; i++) { 
  93.     this[i] = 0;
  94.   }
  95.   return this;
  96. }
  97.  
  98. function toggleLeadin() {
  99.   if( leadin.style.display == "" ) {
  100.     leadin.style.display = "none";
  101.     click4more.src = "chickletred.gif";
  102.     click4more.title = strclick4more;
  103.   }
  104.   else {
  105.     leadin.style.display="";
  106.     click4more.src = "chickletred2.gif";
  107.     click4more.title = strclick2hide;
  108.   }
  109. }
  110.  
  111. var lastspan = new MakeArray(5);
  112. var lastlink = new MakeArray(5);
  113. function togglespan( level, spanname, linkname ) {
  114.   if( spanname.style.display == "" ) {
  115.     spanname.style.display = "none";
  116.     lastspan[level] = 0;
  117.     lastlink[level] = 0;
  118.     if( linkname != null ) {
  119.       linkname.style.fontWeight = "";
  120.     }
  121.   }
  122.   else {
  123.     spanname.style.display="";
  124.     if( lastspan[level] != 0 ) { 
  125.       lastspan[level].style.display = "none"; 
  126.       lastlink[level].style.fontWeight = "";
  127.     }
  128.     lastspan[level] = spanname;
  129.     if( linkname != null ) {
  130.       lastlink[level] = linkname;
  131.       linkname.style.fontWeight = "bold";
  132.     }
  133.   }
  134. }
  135.  
  136. var allon = 0;
  137. //var showall1 = 0;
  138. function showAll() {
  139.   if( allon == 1 ) {
  140.     document.location.href = document.location.href;
  141.   }
  142.   else {
  143.     for ( i=0; i < document.all.length; i++ ) {
  144.       document.all.item(i).style.display = "";
  145.     }
  146.     allon = 1;
  147.     //if( showall1 != 0 ) {
  148.       document.all.showall1.innerText = strcollapsetext;
  149.     //  showall2.innerText = "";
  150.     //}
  151.   }
  152. }
  153.  
  154. function autoExpand( exp ) {
  155.   if( exp == 1 ) { showAll(); }
  156. }
  157.  
  158. function toggleproc( procname, imgname, anchor ){
  159.   var i = document.location.href.lastIndexOf("#");
  160.   var cur_href = "";
  161.   if( i > 0 ) { cur_href = document.location.href.substring(0,i); }
  162.   if( procname.style.display == "" ) {
  163.     procname.style.display = "none";
  164.     imgname.src = "right.gif";
  165.     procmore.title = strclick4more;
  166.   }
  167.   else {
  168.     procname.style.display="";
  169.     imgname.src = "down.gif";
  170.     procmore.title = strclick2hide;
  171.   }
  172. }
  173.  
  174.  
  175.  
  176.  
  177.