home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / Chip_2001-06_cd1.bin / zkuste / vbasic / Data / Utility / MSISDK15.msi / Msi.chm / hh / scripts / langref.js < prev    next >
Text File  |  2000-10-24  |  19KB  |  822 lines

  1. //
  2. // Common code
  3. //
  4. var ieVer = 0;
  5. var curLang = null;
  6. var showAll = true;
  7. var cook = null;
  8. var baseUrl = document.scripts[document.scripts.length - 1].src.replace(/[^\/]+.js/, "");
  9.  
  10. if (navigator.appName == "Microsoft Internet Explorer") {
  11.     var ver = navigator.appVersion;
  12.     var v = new Number(ver.substring(0,ver.indexOf(".", 0)));
  13.     if (v >= 4) {
  14.         ieVer = 4;
  15.  
  16.         // Look for a version number buried somewhere in the version string.
  17.         var toks = ver.split(/[^0-9.]/);
  18.         if (toks) {
  19.             for (var i = 0; i < toks.length; i++) {
  20.                 var tok = toks[i];
  21.                 if (tok.indexOf(".", 0) > 0) {
  22.                     if (tok >= 5)
  23.                         ieVer = 5;
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
  29.  
  30. if (ieVer >= 4) {
  31.     window.onload = bodyOnLoad;
  32. }
  33.  
  34. function bodyOnClick()
  35. {
  36.     if (ieVer >= 4) {
  37.         var elem = window.event.srcElement;
  38.         for (; elem; elem = elem.parentElement) {
  39.             if (elem.id == "reftip")
  40.                 return;
  41.         }
  42.  
  43.         hideTip();
  44.         closeMenu();
  45.         hideSeeAlso();
  46.     }
  47. }
  48.  
  49. function bodyOnLoad()
  50. {
  51.     if (ieVer >= 4) {
  52.         initLangs();
  53.         initReftips();
  54.         initSeeAlso();
  55.         document.body.onclick = bodyOnClick;
  56.     }
  57.  
  58. }
  59.  
  60. //
  61. // Language filtering
  62. //
  63. function initLangs()
  64. {
  65.     var hdr = document.all.hdr;
  66.     if (!hdr)
  67.         return;
  68.  
  69.     var langs = new Array;
  70.     var spans = document.all.tags("SPAN");
  71.     if (spans) {
  72.         var iElem = spans.length;
  73.         for (iElem = 0; iElem < spans.length; iElem++) {
  74.             var elem = spans[iElem];
  75.             if (elem.className == "lang") {
  76.  
  77.                 // Update the array of unique language names.
  78.                 var a = elem.innerText.split(",");
  79.                 for (var iTok = 0; iTok < a.length; iTok++) {
  80.                     var m = a[iTok].match(/([A-Za-z].*[A-Za-z+#])/);
  81.                     if (m) {
  82.                         var iLang = 0;
  83.                         while (iLang < langs.length && langs[iLang] < m[1])
  84.                             iLang++;
  85.                         if (iLang == langs.length || langs[iLang] != m[1]) {
  86.                             var before = langs.slice(0,iLang);
  87.                             var after = langs.slice(iLang);
  88.                             langs = before.concat(m[1]).concat(after);
  89.                         }
  90.                     }
  91.                 }
  92.             }
  93.         }
  94.     }
  95.  
  96.     if (langs.length > 0) {
  97.         var pres = document.all.tags("PRE");
  98.         if (pres) {
  99.             for (var iPre = 0; iPre < pres.length; iPre++)
  100.                 initPreElem(pres[iPre]);
  101.         }
  102.  
  103.         var obj = document.all.obj_cook;
  104.         if (obj && obj.object) {
  105.             cook = obj;
  106.             if (obj.getValue("lang.all") != "1") {
  107.                 var lang = obj.getValue("lang");
  108.                 var c = langs.length;
  109.                 for (var i = 0; i != c; ++i) {
  110.                     if (langs[i] == lang) {
  111.                         curLang = langs[i];
  112.                         showAll = false;
  113.                     }
  114.                 }
  115.             }
  116.         }
  117.  
  118.         var iLim = document.body.all.length;
  119.         var head = null;
  120.         for (var i = 0; i < iLim; i++) {
  121.             var elem = document.body.all[i];
  122.             if (elem.tagName.match(/^(P|PRE|[DOU]L)$/))
  123.                 break;
  124.             if (elem.tagName.match(/^H[1-6]$/)) {
  125.                 head = elem;
  126.                 head.insertAdjacentHTML('BeforeEnd', '<SPAN CLASS=ilang></SPAN>');
  127.             }
  128.         }
  129.  
  130.         var td = hdr.insertCell(0);
  131.         if (td) {
  132.             // Localizable strings.
  133.             var L_Filter_Tip = "Language Filter";        // tooltip for language button
  134.             var L_Language = "Language";                // heading for menu of programming languages
  135.             var L_Show_All = "Show All";                // label for 'show all languages' menu item
  136.  
  137.             // Add the language button to the button bar.
  138.             td.className = "button1";
  139.             td.style.width = "19px";
  140.             td.onclick = langMenu;
  141.             td.innerHTML = '<IMG SRC="' + baseUrl + 'Filter.gif' + '" ALT="' +
  142.                 L_Filter_Tip + '" BORDER=0>';
  143.  
  144.             // Add the menu.
  145.             var div = '<DIV ID="lang_menu" CLASS=langMenu><B>' + L_Language + '</B><UL>';
  146.             for (var i = 0; i < langs.length; i++)
  147.                 div += '<LI><A HREF="" ONCLICK="chooseLang(this)">' + langs[i] + '</A><BR>';
  148.             div += '<LI><A HREF="" ONCLICK="chooseAll()">' + L_Show_All + '</A></UL></DIV>';
  149.             document.body.insertAdjacentHTML('BeforeEnd', div);
  150.         }
  151.  
  152.         if (!showAll)
  153.             filterLang();
  154.     }
  155. }
  156.  
  157. function initPreElem(pre)
  158. {
  159.     var htm0 = pre.outerHTML;
  160.  
  161.     var reLang = /<span\b[^>]*class="?lang"?[^>]*>/i;
  162.     var iFirst = -1;
  163.     var iSecond = -1;
  164.  
  165.     iFirst = htm0.search(reLang);
  166.     if (iFirst >= 0) {
  167.         iPos = iFirst + 17;
  168.         iMatch = htm0.substr(iPos).search(reLang);
  169.         if (iMatch >= 0)
  170.             iSecond = iPos + iMatch;
  171.     }
  172.  
  173.     if (iSecond < 0) {
  174.         var htm1 = trimPreElem(htm0);
  175.         if (htm1 != htm0) {
  176.             pre.insertAdjacentHTML('AfterEnd', htm1);
  177.             pre.outerHTML = "";
  178.         }
  179.     }
  180.     else {
  181.         var rePairs = /<(\w+)\b[^>]*><\/\1>/gi;
  182.  
  183.         var substr1 = htm0.substring(0,iSecond);
  184.         var tags1 = substr1.replace(/>[^<>]+(<|$)/g, ">$1");
  185.         var open1 = tags1.replace(rePairs, "");
  186.         open1 = open1.replace(rePairs, "");
  187.  
  188.         var substr2 = htm0.substring(iSecond);
  189.         var tags2 = substr2.replace(/>[^<>]+</g, "><");
  190.         var open2 = tags2.replace(rePairs, "");
  191.         open2 = open2.replace(rePairs, "");
  192.  
  193.         pre.insertAdjacentHTML('AfterEnd', open1 + substr2);
  194.         pre.insertAdjacentHTML('AfterEnd', trimPreElem(substr1 + open2));
  195.         pre.outerHTML = "";
  196.     }    
  197. }
  198.  
  199. function trimPreElem(htm)
  200. {
  201.     return htm.replace(/[ \r\n]*((<\/[BI]>)*)[ \r\n]*<\/PRE>/g, "$1</PRE>").replace(
  202.         /\w*<\/SPAN>\w*((<[BI]>)*)\w*\r\n/g, "\r\n</SPAN>$1"
  203.         );
  204. }
  205.  
  206. function getBlock(elem)
  207. {
  208.     while (elem && elem.tagName.match(/^([BIUA]|SPAN|CODE|TD)$/))
  209.         elem = elem.parentElement;
  210.     return elem;
  211. }
  212.  
  213. function langMenu()
  214. {
  215.     bodyOnClick();
  216.  
  217.     window.event.returnValue = false;
  218.     window.event.cancelBubble = true;
  219.  
  220.     var div = document.all.lang_menu;
  221.     var lnk = window.event.srcElement;
  222.     if (div && lnk) {
  223.         var x = lnk.offsetLeft + lnk.offsetWidth - div.offsetWidth;
  224.         div.style.pixelLeft = (x < 0) ? 0 : x;
  225.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  226.         div.style.visibility = "visible";
  227.     }
  228. }
  229.  
  230. function chooseLang(item)
  231. {
  232.     window.event.returnValue = false;
  233.     window.event.cancelBubble = true;
  234.  
  235.     if (item) {
  236.         closeMenu();
  237.         curLang = item.innerText;
  238.         showAll = false;
  239.     }
  240.  
  241.     if (cook) {
  242.         cook.putValue('lang', curLang);
  243.         cook.putValue('lang.all', '');
  244.     }
  245.  
  246.     filterLang();
  247. }
  248.  
  249. function chooseAll()
  250. {
  251.     window.event.returnValue = false;
  252.     window.event.cancelBubble = true;
  253.  
  254.     closeMenu();
  255.  
  256.     showAll = true;
  257.     if (cook)
  258.         cook.putValue('lang.all', '1');
  259.  
  260.     unfilterLang();
  261. }
  262.  
  263. function closeMenu()
  264. {
  265.     var div = document.all.lang_menu;
  266.     if (div && div.style.visibility != "hidden") {
  267.         var lnk = document.activeElement;
  268.         if (lnk && lnk.tagName == "A")
  269.             lnk.blur();
  270.  
  271.         div.style.visibility = "hidden";
  272.     }
  273. }
  274.  
  275. function getNext(elem)
  276. {
  277.     for (var i = elem.sourceIndex + 1; i < document.all.length; i++) {
  278.         var next = document.all[i];
  279.         if (!elem.contains(next))
  280.             return next;
  281.     }
  282.     return null;
  283. }
  284.  
  285. function filterMatch(text, name)
  286. {
  287.     var a = text.split(",");
  288.     for (var iTok = 0; iTok < a.length; iTok++) {
  289.         var m = a[iTok].match(/([A-Za-z].*[A-Za-z+#])/);
  290.         if (m && m[1] == name)
  291.             return true;
  292.     }
  293.     return false;
  294. }
  295.  
  296. function topicHeading(head)
  297. {
  298.     var iLim = document.body.children.length;
  299.     var idxLim = head.sourceIndex;
  300.  
  301.     for (var i = 0; i < iLim; i++) {
  302.         var elem = document.body.children[i];
  303.         if (elem.sourceIndex < idxLim) {
  304.             if (elem.tagName.match(/^(P|PRE|[DOU]L)$/))
  305.                 return false;
  306.         }
  307.         else
  308.             break;
  309.     }
  310.     return true;
  311. }
  312.  
  313. function filterLang()
  314. {
  315.     var spans = document.all.tags("SPAN");
  316.     for (var i = 0; i < spans.length; i++) {
  317.         var elem = spans[i];
  318.         if (elem.className == "lang") {
  319.             var newVal = filterMatch(elem.innerText, curLang) ? "block" : "none";
  320.             var block = getBlock(elem);
  321.             block.style.display = newVal;
  322.             elem.style.display = "none";
  323.  
  324.             if (block.tagName == "DT") {
  325.                 var next = getNext(block);
  326.                 if (next && next.tagName == "DD")
  327.                     next.style.display = newVal;
  328.             }
  329.             else if (block.tagName == "DIV") {
  330.                 block.className = "filtered2";
  331.             }
  332.             else if (block.tagName.match(/^H[1-6]$/)) {
  333.                 if (topicHeading(block)) {
  334.                     if (newVal != "none") {
  335.                         var tag = null;
  336.                         if (block.children && block.children.length) {
  337.                             tag = block.children[block.children.length - 1];
  338.                             if (tag.className == "ilang") {
  339.                                 tag.innerHTML = (newVal == "block") ?
  340.                                     '  [' + curLang + ']' : "";
  341.                             }
  342.                         }
  343.                     }
  344.                 }
  345.                 else {
  346.                     var next = getNext(block);
  347.                     while (next && !next.tagName.match(/^(H[1-6]|DIV)$/)) {
  348.                         next.style.display = newVal;
  349.                         next = getNext(next);
  350.                     }
  351.                 }
  352.             }
  353.         }
  354.         else if (elem.className == "ilang") {
  355.             elem.innerHTML = '  [' + curLang + ']';
  356.         }
  357.     }
  358.  
  359.     if (ieVer == 4) {
  360.         document.body.style.display = "none";
  361.         document.body.style.display = "block";
  362.     }
  363. }
  364.  
  365. function unfilterLang(name)
  366. {
  367.     var spans = document.all.tags("SPAN");
  368.     for (var i = 0; i < spans.length; i++) {
  369.         var elem = spans[i];
  370.         if (elem.className == "lang") {
  371.             var block = getBlock(elem);
  372.             block.style.display = "block";
  373.             elem.style.display = "inline";
  374.  
  375.             if (block.tagName == "DT") {
  376.                 var next = getNext(block);
  377.                 if (next && next.tagName == "DD")
  378.                     next.style.display = "block";
  379.             }
  380.             else if (block.tagName == "DIV") {
  381.                 block.className = "filtered";
  382.             }
  383.             else if (block.tagName.match(/^H[1-6]$/)) {
  384.                 if (topicHeading(block)) {
  385.                     var tag = null;
  386.                     if (block.children && block.children.length) {
  387.                         tag = block.children[block.children.length - 1];
  388.                         if (tag && tag.className == "ilang")
  389.                             tag.innerHTML = "";
  390.                     }
  391.                 }
  392.                 else {
  393.                     var next = getNext(block);
  394.                     while (next && !next.tagName.match(/^(H[1-6]|DIV)$/)) {
  395.                         next.style.display = "block";
  396.                         next = getNext(next);
  397.                     }
  398.                 }
  399.             }
  400.         }
  401.         else if (elem.className == "ilang") {
  402.             elem.innerHTML = "";
  403.         }
  404.     }
  405. }
  406.  
  407.  
  408. //
  409. // Reftips (parameter popups)
  410. //
  411. function initReftips()
  412. {
  413.     var DLs = document.all.tags("DL");
  414.     var PREs = document.all.tags("PRE");
  415.     if (DLs && PREs) {
  416.         var iDL = 0;
  417.         var iPRE = 0;
  418.         var iSyntax = -1;
  419.         for (var iPRE = 0; iPRE < PREs.length; iPRE++) {
  420.             if (PREs[iPRE].className == "syntax") {
  421.                 while (iDL < DLs.length && DLs[iDL].sourceIndex < PREs[iPRE].sourceIndex)
  422.                     iDL++;            
  423.                 if (iDL < DLs.length) {
  424.                     initSyntax(PREs[iPRE], DLs[iDL]);
  425.                     iSyntax = iPRE;
  426.                 }
  427.                 else
  428.                     break;
  429.             }
  430.         }
  431.  
  432.         if (iSyntax >= 0) {
  433.             var last = PREs[iSyntax];
  434.             last.insertAdjacentHTML(
  435.                 'AfterEnd',
  436.                 '<DIV ID=reftip CLASS=reftip STYLE="position:absolute;visibility:hidden;overflow:visible;"></DIV>'
  437.                 );
  438.         }
  439.     }
  440. }
  441.  
  442. function initSyntax(pre, dl)
  443. {
  444.     var strSyn = pre.outerHTML;
  445.     var terms = dl.children.tags("DT");
  446.     if (terms) {
  447.         for (var iTerm = 0; iTerm < terms.length; iTerm++) {
  448.             var words = terms[iTerm].innerText.replace(/\[.+\]/g, " ").replace(/,/g, " ").split(" ");
  449.             var htm = terms[iTerm].innerHTML;
  450.             for (var iWord = 0; iWord < words.length; iWord++) {
  451.                 var word = words[iWord];
  452.  
  453.                 if (word.length > 0 && htm.indexOf(word, 0) < 0)
  454.                     word = word.replace(/:.+/, "");
  455.  
  456.                 if (word.length > 0) {
  457.                     var ichStart = strSyn.indexOf('>', 0) + 1;
  458.                     var ichBrace = strSyn.indexOf('{', ichStart);
  459.                     if (ichBrace < 0)
  460.                         ichBrace = strSyn.indexOf('(', ichStart);
  461.                     if (ichBrace >= 0)
  462.                         ichStart = ichBrace + 1;
  463.  
  464.                     var ichMatch = findTerm(strSyn, ichStart, word);
  465.                     while (ichMatch > 0) {
  466.                         var strTag = '<A HREF="" ONCLICK="showTip(this)" CLASS="synParam">' + word + '</A>';
  467.  
  468.                         strSyn =
  469.                             strSyn.slice(0, ichMatch) +
  470.                             strTag +
  471.                             strSyn.slice(ichMatch + word.length);
  472.  
  473.                         ichMatch = findTerm(strSyn, ichMatch + strTag.length, word);
  474.                     }
  475.                 }
  476.             }
  477.         }
  478.     }
  479.  
  480.     // Replace the syntax block with our modified version.
  481.     pre.outerHTML = strSyn;
  482. }
  483.  
  484. function findTerm(strSyn, ichPos, strTerm)
  485. {
  486.     var ichMatch = strSyn.indexOf(strTerm, ichPos);
  487.     while (ichMatch >= 0) {
  488.         var prev = (ichMatch == 0) ? '\0' : strSyn.charAt(ichMatch - 1);
  489.         var next = strSyn.charAt(ichMatch + strTerm.length);
  490.         if (!isalnum(prev) && !isalnum(next) && !isInTag(strSyn, ichMatch)) {
  491.             var ichComment = strSyn.indexOf("/*", ichPos);
  492.             while (ichComment >= 0) {
  493.                 if (ichComment > ichMatch) {
  494.                     ichComment = -1;
  495.                     break; 
  496.                 }
  497.                 var ichEnd = strSyn.indexOf("*/", ichComment);
  498.                 if (ichEnd < 0 || ichEnd > ichMatch)
  499.                     break;
  500.                 ichComment = strSyn.indexOf("/*", ichEnd);
  501.             }
  502.             if (ichComment < 0) {
  503.                 ichComment = strSyn.indexOf("//", ichPos);
  504.                 while (ichComment >= 0) {
  505.                     if (ichComment > ichMatch) {
  506.                         ichComment = -1;
  507.                         break; 
  508.                     }
  509.                     var ichEnd = strSyn.indexOf("\n", ichComment);
  510.                     if (ichEnd < 0 || ichEnd > ichMatch)
  511.                         break;
  512.                     ichComment = strSyn.indexOf("//", ichEnd);
  513.                 }
  514.             }
  515.             if (ichComment < 0)
  516.                 break;
  517.         }
  518.         ichMatch = strSyn.indexOf(strTerm, ichMatch + strTerm.length);
  519.     }
  520.     return ichMatch;
  521. }
  522.  
  523. function isInTag(strHtml, ichPos)
  524. {
  525.     return strHtml.lastIndexOf('<', ichPos) >
  526.         strHtml.lastIndexOf('>', ichPos);
  527. }
  528.  
  529. function isalnum(ch)
  530. {
  531.     return ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_'));
  532. }
  533.  
  534. function showTip(link)
  535. {
  536.     bodyOnClick();
  537.  
  538.     var tip = document.all.reftip;
  539.     if (!tip || !link)
  540.         return;
  541.  
  542.     window.event.returnValue = false;
  543.     window.event.cancelBubble = true;
  544.  
  545.     // Hide the tip if necessary and initialize its size.
  546.     tip.style.visibility = "hidden";
  547.     tip.style.pixelWidth = 260;
  548.     tip.style.pixelHeight = 24;
  549.  
  550.     // Find the link target.
  551.     var term = null;
  552.     var def = null;
  553.     var DLs = document.all.tags("DL");
  554.     for (var iDL = 0; iDL < DLs.length; iDL++) {
  555.         if (DLs[iDL].sourceIndex > link.sourceIndex) {
  556.             var dl = DLs[iDL];
  557.             var iMax = dl.children.length - 1;
  558.             for (var iElem = 0; iElem < iMax; iElem++) {
  559.                 var dt = dl.children[iElem];
  560.                 if (dt.tagName == "DT" && dt.style.display != "none") {
  561.                     if (findTerm(dt.innerText, 0, link.innerText) >= 0) {
  562.                         var dd = dl.children[iElem + 1];
  563.                         if (dd.tagName == "DD") {
  564.                             term = dt;
  565.                             def = dd;
  566.                         }
  567.                         break;
  568.                     }
  569.                 }
  570.             }
  571.             break;
  572.         }
  573.     }
  574.  
  575.     if (def) {
  576.         window.linkElement = link;
  577.         window.linkTarget = term;
  578.         tip.innerHTML = '<DL><DT>' + term.innerHTML + '</DT><DD>' + def.innerHTML + '</DD></DL>';
  579.         window.setTimeout("moveTip()", 0);
  580.     }
  581. }
  582.  
  583. function jumpParam()
  584. {
  585.     hideTip();
  586.  
  587.     window.linkTarget.scrollIntoView();
  588.     document.body.scrollLeft = 0;
  589.  
  590.     flash(3);
  591. }
  592.  
  593. function flash(c)
  594. {
  595.     window.linkTarget.style.background = (c & 1) ? "#CCCCCC" : "";
  596.     if (c)
  597.         window.setTimeout("flash(" + (c-1) + ")", 200);
  598. }
  599.  
  600. function moveTip()
  601. {
  602.     var tip = document.all.reftip;
  603.     var link = window.linkElement;
  604.     if (!tip || !link)
  605.         return; //error
  606.  
  607.     var w = tip.offsetWidth;
  608.     var h = tip.offsetHeight;
  609.  
  610.     if (w > tip.style.pixelWidth) {
  611.         tip.style.pixelWidth = w;
  612.         window.setTimeout("moveTip()", 0);
  613.         return;
  614.     }
  615.  
  616.     var maxw = document.body.clientWidth;
  617.     var maxh = document.body.clientHeight;
  618.  
  619.     if (h > maxh) {
  620.         if (w < maxw) {
  621.             w = w * 3 / 2;
  622.             tip.style.pixelWidth = (w < maxw) ? w : maxw;
  623.             window.setTimeout("moveTip()", 0);
  624.             return;
  625.         }
  626.     }
  627.  
  628.     var x,y;
  629.  
  630.     var linkLeft = link.offsetLeft - document.body.scrollLeft;
  631.     var linkRight = linkLeft + link.offsetWidth;
  632.  
  633.     var linkTop = link.offsetTop - document.body.scrollTop;
  634.     var linkBottom = linkTop + link.offsetHeight;
  635.  
  636.     var cxMin = link.offsetWidth - 24;
  637.     if (cxMin < 16)
  638.         cxMin = 16;
  639.  
  640.     if (linkLeft + cxMin + w <= maxw) {
  641.         x = maxw - w;
  642.         if (x > linkRight + 8)
  643.             x = linkRight + 8;
  644.         y = maxh - h;
  645.         if (y > linkTop)
  646.             y = linkTop;
  647.     }
  648.     else if (linkBottom + h <= maxh) {
  649.         x = maxw - w;
  650.         if (x < 0)
  651.             x = 0;
  652.         y = linkBottom;
  653.     }
  654.     else if (w <= linkRight - cxMin) {
  655.         x = linkLeft - w - 8;
  656.         if (x < 0)
  657.             x = 0;
  658.         y = maxh - h;
  659.         if (y > linkTop)
  660.             y = linkTop;
  661.     }
  662.     else if (h <= linkTop) {
  663.         x = maxw - w;
  664.         if (x < 0)
  665.             x = 0;
  666.         y = linkTop - h;
  667.     }
  668.     else if (w >= maxw) {
  669.         x = 0;
  670.         y = linkBottom;
  671.     }
  672.     else {
  673.         w = w * 3 / 2;
  674.         tip.style.pixelWidth = (w < maxw) ? w : maxw;
  675.         window.setTimeout("moveTip()", 0);
  676.         return;
  677.     }
  678.  
  679.     link.style.background = "#FFFF80";
  680.     tip.style.pixelLeft = x + document.body.scrollLeft;
  681.     tip.style.pixelTop = y + document.body.scrollTop;
  682.     tip.style.visibility = "visible";
  683. }
  684.  
  685. function hideTip()
  686. {
  687.     if (window.linkElement) {
  688.         window.linkElement.style.background = "";
  689.         window.linkElement = null;
  690.     }
  691.  
  692.     var tip = document.all.reftip;
  693.     if (tip) {
  694.         tip.style.visibility = "hidden";
  695.         tip.innerHTML = "";
  696.     }
  697. }
  698.  
  699. function beginsWith(s1, s2)
  700. {
  701.     // Does s1 begin with s2?
  702.     return s1.substring(0, s2.length) == s2;
  703. }
  704.  
  705. //
  706. // See Also popups
  707. //
  708. function initSeeAlso()
  709. {
  710.     // Localizable strings.
  711.     var L_See_Also = "See Also";
  712.     var L_Requirements = "Requirements";
  713.     var L_QuickInfo = "QuickInfo";
  714.  
  715.     var hdr = document.all.hdr;
  716.     if (!hdr)
  717.         return;
  718.  
  719.     var divS = new String;
  720.     var divR = new String;
  721.  
  722.     var heads = document.all.tags("H4");
  723.     if (heads) {
  724.         for (var i = 0; i < heads.length; i++) {
  725.             var head = heads[i];
  726.             var txt = head.innerText;
  727.             if (beginsWith(txt, L_See_Also)) {
  728.                 divS += head.outerHTML;
  729.                 var next = getNext(head);
  730.                 while (next && !next.tagName.match(/^(H[1-4]|DIV)$/)) {
  731.                     divS += next.outerHTML;
  732.                     next = getNext(next);
  733.                 }
  734.             }
  735.             else if (beginsWith(txt, L_Requirements) || beginsWith(txt, L_QuickInfo)) {
  736.                 divR += head.outerHTML;
  737.                 var next = getNext(head);
  738.                 while (next && !next.tagName.match(/^(H[1-4]|DIV)$/)) {
  739.                     divR += next.outerHTML;
  740.                     next = getNext(next);
  741.                 }
  742.             }
  743.         }
  744.     }
  745.  
  746.     var pos = getNext(hdr.parentElement);
  747.     if (pos) {
  748.         if (divR != "") {
  749.             divR = '<DIV ID=rpop CLASS=sapop>' + divR + '</DIV>';
  750.             var td = hdr.insertCell(0);
  751.             if (td) {
  752.                 td.className = "button1";
  753.                 td.style.width = "19px";
  754.                 td.onclick = showRequirements;
  755.                 td.innerHTML = '<IMG SRC="' + baseUrl + 'Requirements.gif' + '" ALT="' + L_Requirements + '" BORDER=0>';
  756.                 if (ieVer == 4)
  757.                     document.body.insertAdjacentHTML('AfterBegin', divR);
  758.                 else
  759.                     document.body.insertAdjacentHTML('BeforeEnd', divR);
  760.             }
  761.         }
  762.         if (divS != "") {
  763.             divS = '<DIV ID=sapop CLASS=sapop>' + divS + '</DIV>';
  764.             var td = hdr.insertCell(0);
  765.             if (td) {
  766.                 td.className = "button1";
  767.                 td.style.width = "19px";
  768.                 td.onclick = showSeeAlso;
  769.                 td.innerHTML = '<IMG SRC="' + baseUrl + 'SeeAlso.gif' + '" ALT="' + L_See_Also + '" BORDER=0>';
  770.                 if (ieVer == 4)
  771.                     document.body.insertAdjacentHTML('AfterBegin', divS);
  772.                 else
  773.                     document.body.insertAdjacentHTML('BeforeEnd', divS);
  774.             }
  775.         }
  776.     }
  777. }
  778.  
  779. function showSeeAlso()
  780. {
  781.     bodyOnClick();
  782.  
  783.     window.event.returnValue = false;
  784.     window.event.cancelBubble = true;
  785.  
  786.     var div = document.all.sapop;
  787.     var lnk = window.event.srcElement;
  788.  
  789.     if (div && lnk) {
  790.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  791.         div.style.visibility = "visible";
  792.     }
  793. }
  794.  
  795. function showRequirements()
  796. {
  797.     bodyOnClick();
  798.  
  799.     window.event.returnValue = false;
  800.     window.event.cancelBubble = true;
  801.  
  802.     var div = document.all.rpop;
  803.     var lnk = window.event.srcElement;
  804.  
  805.     if (div && lnk) {
  806.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  807.         div.style.visibility = "visible";
  808.     }
  809. }
  810.  
  811. function hideSeeAlso()
  812. {
  813.     var div = document.all.sapop;
  814.     if (div)
  815.         div.style.visibility = "hidden";
  816.  
  817.     var div = document.all.rpop;
  818.     if (div)
  819.         div.style.visibility = "hidden";
  820. }
  821.  
  822.