home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 68 / IOPROG_68.ISO / soft / Tools / AIProSF / AIProSF.exe / ActiveInstall Professional.msi / Data.cab / ActiveInstall.chm / script / helpstudio.js < prev   
Encoding:
JavaScript  |  2003-02-10  |  6.8 KB  |  291 lines

  1. // Current language
  2. var curLang;
  3. var showAll;
  4.  
  5. function hideBoxes(){
  6.     var pres = document.all.tags("DIV");
  7.     var pre;
  8.  
  9.     if (pres) {
  10.         for (var iPre = 0; iPre < pres.length; iPre++) {
  11.             pre = pres[iPre];
  12.             if (pre.className) {
  13.                 if (pre.className == "popupbubble") {
  14.                     pre.style.visibility = "hidden";
  15.                 }
  16.             };
  17.         }
  18.     }
  19. }
  20.  
  21. function dxBeforePrint(){
  22.  
  23.     var i;
  24.  
  25.     if (window.text) document.all.text.style.height = "auto";
  26.             
  27.     for (i=0; i < document.all.length; i++){
  28.         if (document.all[i].tagName == "BODY") {
  29.             document.all[i].scroll = "yes";
  30.             }
  31.         if (document.all[i].id == "pagetop") {
  32.             document.all[i].style.margin = "0px 0px 0px 0px";
  33.             document.all[i].style.width = "100%";
  34.             }
  35.         if (document.all[i].id == "pagebody") {
  36.             document.all[i].style.overflow = "visible";
  37.             document.all[i].style.top = "5px";
  38.             document.all[i].style.width = "100%";
  39.             document.all[i].style.padding = "0px 10px 0px 30px";
  40.             }
  41.         if (document.all[i].id == "seealsobutton" || document.all[i].id == "languagesbutton") {
  42.             document.all[i].style.display = "none";
  43.             }
  44.         if (document.all[i].className == "LanguageSpecific") {
  45.             document.all[i].style.display = "block";
  46.             }
  47.         }
  48. }
  49.  
  50. function dxAfterPrint(){
  51.  
  52.      document.location.reload();
  53.  
  54. }
  55.  
  56. function showSeeAlsoBox(){
  57.  
  58.     hideSeeAlso();
  59.     hideLanguage();
  60.  
  61.     var button = window.event.srcElement
  62.  
  63.     window.event.returnValue = false;
  64.     window.event.cancelBubble = true;
  65.  
  66.     var div = document.all.dxseealsomenu;
  67.     if (div && button) {
  68.         div.style.pixelLeft = 0;
  69.         div.style.pixelTop = button.offsetTop + button.offsetHeight;
  70.         div.style.visibility = "visible";
  71.     }
  72. }
  73.  
  74.  
  75.  
  76. function showGlossaryItemBox(term,definition){
  77.  
  78.     hideBoxes();
  79.  
  80.     var button = window.event.srcElement
  81.     
  82.     window.event.returnValue = false;
  83.     window.event.cancelBubble = true;
  84.  
  85.     var div = document.all["GlossaryItemBox"]
  86.     if (div && button) {
  87.         div.style.pixelLeft = button.offsetLeft; //window.event.clientX;
  88.         div.style.pixelTop = window.event.clientY+7;
  89.         div.style.width = "30%";
  90.         div.innerHTML = "<p><strong>" + term + "</strong><br>" + definition + "</p>"
  91.         div.style.visibility = "visible";
  92.     }
  93.  
  94. }
  95.  
  96. function showLanguageBox(){
  97.  
  98.     hideSeeAlso();
  99.     hideLanguage();
  100.  
  101.     var button = window.event.srcElement
  102.  
  103.     window.event.returnValue = false;
  104.     window.event.cancelBubble = true;
  105.  
  106.     var div = document.all.dxlanguagemenu;
  107.     if (div && button) {
  108.         div.style.pixelLeft = 0;
  109.         div.style.pixelTop = button.offsetTop + button.offsetHeight;
  110.         div.style.visibility = "visible";
  111.     }
  112. }
  113.  
  114. function setLanguageFilter(language){
  115.  
  116.     hideSeeAlso();
  117.     hideLanguage();
  118.  
  119.     window.event.returnValue = false;
  120.     window.event.cancelBubble = true;
  121.     
  122.     curLang = language;
  123.     updateLanguageElements();
  124.     
  125. }
  126.  
  127. function bodyLoad(){
  128.  
  129.     var cLang;
  130.     var i;
  131.     var b;
  132.     var l;
  133.     var e;
  134.  
  135.     resizeBan();
  136.     document.body.onclick = bodyClick;
  137.     document.body.onresize = bodyResize;
  138.     
  139.     // Check the context window for current language.
  140.     var cLang;
  141.     try{
  142.         for (i=1; i< window.external.ContextAttributes.Count; i++){
  143.             if(window.external.ContextAttributes(i).Name.toUpperCase()=="DEVLANG"){
  144.                 var b = window.external.ContextAttributes(i).Values.toArray();
  145.                 cLang = b[0].toUpperCase();
  146.             }
  147.         }
  148.     }
  149.     catch(e){}
  150.     
  151.     if (cLang != null){
  152.         if (cLang.indexOf("VB")!=-1) curLang = "VB";
  153.         if (cLang.indexOf("VC")!=-1) curLang = "VC";
  154.         if (cLang.indexOf("C#")!=-1) curLang = "CS";
  155.         if (cLang.indexOf("JSCRIPT")!=-1) curLang = "JScript";
  156.     }
  157.  
  158.     if (curLang == null){
  159.         var l = "";
  160.         var multipleLang = false;
  161.         // Check to see what the help filter is set to.
  162.         try {l = window.external.Help.FilterQuery.toUpperCase();}
  163.         catch(e){}
  164.         if (l.indexOf("VB")!=-1){
  165.             cLang = "VB";
  166.             }
  167.         if (l.indexOf("VC")!=-1){
  168.             if (cLang!=null) multipleLang = true;
  169.             cLang = "VC";
  170.             }
  171.         if (l.indexOf("C#")!=-1){
  172.             if (cLang!=null) multipleLang = true;
  173.             cLang = "CS";
  174.             }
  175.         if (l.indexOf("JSCRIPT")!=-1){
  176.             if (cLang!=null) multipleLang = true;
  177.             cLang = "JScript";
  178.             }
  179.         if (multipleLang==false) curLang = cLang;
  180.     }
  181.  
  182.     if (curLang != null)
  183.         showAll = false;
  184.         
  185.     updateLanguageElements();    
  186.     
  187.     window.onbeforeprint = dxBeforePrint;
  188.     window.onafterprint = dxAfterPrint;    
  189.     
  190. }
  191.  
  192. function updateLanguageElements(){
  193.  
  194.     if (!curLang) return;
  195.  
  196.     var pres = document.all.tags("DIV");
  197.     var pre;
  198.  
  199.     if (pres) {
  200.         for (var iPre = 0; iPre < pres.length; iPre++) {
  201.             pre = pres[iPre];
  202.             if (pre.Name && pre.className) {
  203.                 if (pre.className == "LanguageSpecific") {
  204.                     if (pre.Name.indexOf(curLang) != -1 || curLang == "All") {
  205.                         pre.style.display = "block";                
  206.                     }
  207.                     else {
  208.                         pre.style.display = "none";
  209.                     };
  210.                 }
  211.             };
  212.         }
  213.     }
  214.     
  215. }
  216.  
  217. function bodyResize(){
  218.     resizeBan();
  219. }
  220.  
  221. function bodyClick(){
  222.     hideBoxes();
  223.     resizeBan();
  224. }
  225.  
  226. function hideSeeAlso(){
  227.     if (document.all.dxseealsomenu) {
  228.         document.all.dxseealsomenu.style.visibility = "hidden";
  229.     };
  230. }
  231.  
  232.  
  233. function hideLanguage(){
  234.     if (document.all.dxlanguagemenu) {
  235.         document.all.dxlanguagemenu.style.visibility = "hidden";
  236.     };
  237. }
  238.  
  239. function resizeBan(){
  240.  
  241.     if (msieversion() > 4)
  242.     {
  243.         try
  244.         {
  245.  
  246.             if (document.body.clientWidth==0) return;
  247.             var oBanner= document.all.item("pagetop");
  248.             var oText= document.all.item("pagebody");
  249.             if (oText == null) return;
  250.             var oBannerrow1 = document.all.item("projectnamebanner");
  251.             var oTitleRow = document.all.item("pagetitlebanner");
  252.             if (oBannerrow1 != null){
  253.                 var iScrollWidth = dxBody.scrollWidth;
  254.                 oBannerrow1.style.marginRight = 0 - iScrollWidth;
  255.             }
  256.             if (oTitleRow != null){
  257.                 oTitleRow.style.padding = "0px 10px 0px 22px; ";
  258.             }
  259.             if (oBanner != null){
  260.                 document.body.scroll = "no"
  261.                 oText.style.overflow= "auto";
  262.                 oBanner.style.width= document.body.offsetWidth-2;
  263.                 oText.style.paddingRight = "20px"; // Width issue code
  264.                 oText.style.width= document.body.offsetWidth-4;
  265.                 oText.style.top=0;  
  266.                 if (document.body.offsetHeight > oBanner.offsetHeight)
  267.                     oText.style.height= document.body.offsetHeight - (oBanner.offsetHeight+4) 
  268.                 else oText.style.height=0
  269.             }    
  270.             try{nstext.setActive();} //allows scrolling from keyboard as soon as page is loaded. Only works in IE 5.5 and above.
  271.             catch(e){}
  272.  
  273.         }
  274.         catch(e){}
  275.     }
  276.     
  277.  
  278. function msieversion()
  279. // Return Microsoft Internet Explorer (major) version number, or 0 for others.
  280. // This function works by finding the "MSIE " string and extracting the version number
  281. // following the space, up to the decimal point for the minor version, which is ignored.
  282. {
  283.     var ua = window.navigator.userAgent
  284.     var msie = ua.indexOf ( "MSIE " )
  285.  
  286.     if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
  287.         return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
  288.     else
  289.         return 0    // is other browser
  290. }