home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / NETSCAPE / CCK / ASE.Z / toolbar.js < prev    next >
Encoding:
Text File  |  1997-08-21  |  20.0 KB  |  659 lines

  1. //toolbar.js
  2.  
  3.  
  4. //handles:
  5. //Globals frame: opener.top.globals
  6. //controls frame: opener.top.screen.controls
  7.  
  8. // Request privilege
  9. compromisePrincipals();            // work around for the security check
  10. netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  11. //var theEditor = null;
  12. var ready;
  13. var cfgHelpWindow;
  14. var numValidPopupEntries = 0;
  15.  
  16. function finishedLoading()
  17. {
  18.     if (ready && document.layers["reload"])
  19.         return true;
  20.     else
  21.         return false;
  22. }
  23.  
  24. function getLayerVisibility(inLayerName)
  25. {
  26.     if (finishedLoading && document.layers[inLayerName])
  27.         return document.layers[inLayerName].visibility;
  28. }
  29.  
  30.  
  31. function editScreen(isHelpScreen) 
  32. {
  33.         
  34.         var thePlatform = new String(navigator.userAgent);
  35.         var x=thePlatform.indexOf("(")+1;
  36.         var y=thePlatform.indexOf(";",x+1);
  37.         var helpFolderAppend = "help/";
  38.         var macFSHelpFolderAppend = "help:";
  39.         thePlatform=thePlatform.substring(x,y);
  40.  
  41.         // Request privilege
  42.  
  43.         netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  44.  
  45.         var theEditor = top.opener.top.globals.document.vars.externalEditor.value;
  46.         //alert("editor: " + theEditor);
  47.         
  48.         var theLoc = null;
  49.         
  50.         
  51.         
  52.         //see if we can find a help Window that is open, and snarf it's location
  53.         if (top.opener.top.screen.controls.helpWindow && top.opener.top.screen.controls.helpWindow != null && !top.opener.top.screen.controls.helpWindow.closed && top.opener.top.screen.controls.helpWindow.location)
  54.         {
  55.             theLoc = new String(top.opener.top.screen.controls.helpWindow.location);
  56.             helpFolderAppend = "";  // the path will already point to the help folder if we get it from the window.
  57.             macFSHelpFolderAppend = "";
  58.         }
  59.         else
  60.         {
  61.             //default case - no help window open, figure out it's location as we normally would.
  62.             theLoc = new String(opener.top.screen.content.location);
  63.         }
  64.         
  65.         //if we should look for the help file, parse that location here
  66.         if (isHelpScreen && isHelpScreen != null && isHelpScreen == true)
  67.         {
  68.             var defaultHelpFile = "ashelp.htm";
  69.             var slashIdx = theLoc.lastIndexOf("/");
  70.             var thePath = theLoc.substring(0,slashIdx+1);
  71.             var thePage = theLoc.substring(slashIdx+1, theLoc.length);
  72.             
  73.             if (thePath.substring(thePath.length - 6, thePath.length) == "intro/")
  74.             {
  75.                 thePath = thePath.substring(0, thePath.length - 6);
  76.             }
  77.             else if (thePath.substring(thePath.length - 9, thePath.length) == "ipreview/")
  78.             {
  79.                 thePath = thePath.substring(0, thePath.length - 9);
  80.             }
  81.             else if (thePath.substring(thePath.length - 8, thePath.length) == "preview/")
  82.             {
  83.                 thePath = thePath.substring(0, thePath.length - 8);
  84.             }
  85.                         
  86.             var helpFile = thePath + helpFolderAppend + defaultHelpFile;
  87.             
  88.             //now get a directory listing and look for a help file that matches the
  89.             // thePage fileName
  90.             if (top.opener && top.opener.top.globals)    
  91.             {
  92.                 helpPath = "" + top.opener.top.globals.getFolder(top.opener.top.globals);
  93.             }
  94.  
  95.             if (thePlatform == "Macintosh")    
  96.             {                        // Macintosh support
  97.                 helpPath = helpPath + macFSHelpFolderAppend;
  98.             }
  99.             else    
  100.             {                                                // Windows support
  101.                 helpPath = helpPath + helpFolderAppend;
  102.             }
  103.     
  104.             var lookingForFile = thePage;
  105.             
  106.             var theList = top.opener.top.globals.document.setupPlugin.GetFolderContents(helpPath,".htm");
  107.             if (theList != null)    
  108.             {
  109.                 for (var i=0; i<theList.length; i++)    
  110.                 {
  111.                     if (lookingForFile == theList[i])    {
  112.                         helpFile = thePath + helpFolderAppend + lookingForFile;
  113.                         break;
  114.                         }
  115.                 }
  116.             }
  117.             //else
  118.             //    alert("found no list from: " + helpPath);
  119.                 
  120.             if (helpFile != null && helpFile != "null" && helpFile != "")
  121.                 theLoc = helpFile;
  122.             
  123.             //alert("HelpLoc: " + helpFile);
  124.                 
  125.         }
  126.         //now, if the layer select popup is around, see if it has a better location for us
  127.         else if ((!isHelpScreen) && (document.layers["layerSwitch"]) && (document.layers["layerSwitch"].visibility=="show") && (document.layers["layerSwitch"].document.forms) && (document.layers["layerSwitch"].document.forms[0]["layerSelect"]))
  128.         {
  129.             var selindex = document.layers["layerSwitch"].document.forms[0]["layerSelect"].options.selectedIndex;
  130.             var theValue =  document.layers["layerSwitch"].document.forms[0]["layerSelect"].options[selindex].value;
  131.             
  132.             if (theValue && theValue != null && theValue != "" && theValue != "null"  && theValue != "_none")
  133.             {
  134.                 document.layers["layerSwitch"].document.forms[0]["layerSelect"].options[selindex].value;
  135.                 theLoc = theValue;
  136.                 //alert("Would edit: " + theValue);
  137.             }
  138.             else
  139.             {
  140.                 //alert("ERROR: selected layer had a defined location of: " + theValue);    
  141.             }
  142.         }
  143.  
  144.         
  145.  
  146.         if (theEditor.toString().lastIndexOf("Netscape Communicator") >= 0)    
  147.         {
  148.             //editWindow=window.open("","_blank","dependent=yes,toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1");
  149.             //editWindow.onerror=null;
  150.             //editWindow.location=theLoc;
  151.             netscape.plugin.composer.Document.editDocument(theLoc);
  152.         }
  153.         else if (theEditor != null && theEditor != "" && theEditor.length > 0)
  154.         {
  155.         
  156.             var theFile = theLoc;
  157.             
  158.             //We need to see if we are editing a multi-layer document, which has the layer popup, and
  159.             //if so, make sure we get the right document from the popup here
  160.             
  161.             
  162.             if (theFile.indexOf("file:///") ==0)    {
  163.                 theFile = theFile.substring(8,theFile.length);
  164.                 }
  165.  
  166.             if (thePlatform == "Macintosh")    {
  167.                 var path=unescape(theFile);
  168.                 var fileArray=path.split("/");
  169.                 var newpath=fileArray.join(":");
  170.                 if (newpath.charAt(0)==':')    {
  171.                     newpath=newpath.substring(1,newpath.length);
  172.                     }
  173.                 theFile=unescape(newpath);            
  174.                 }
  175.             else    {
  176.                 // note: JavaScript returns path with '/' instead of '\'        
  177.                 var path=unescape(theFile);
  178.                                 
  179.                 // gets the drive letter and directory path
  180.                 var Drive = path.substring(path.indexOf('|')-1, path.indexOf('|'));
  181.                 var thepath = path.substring(path.indexOf('/'), path.length);
  182.                 var newpath=Drive + ":" + thepath;
  183.                 var fileArray=newpath.split("/");
  184.                 theFile=fileArray.join("\\");
  185.                 }
  186.  
  187.             //alert("I wanna open: " + theFile);
  188.             opener.top.globals.document.setupPlugin.OpenFileWithEditor(theEditor, theFile);
  189.         }
  190.         else
  191.         {
  192.             alert("You must select an application as your editor before you can edit HTML pages.");
  193.             chooseEditor();
  194.         }
  195.             
  196. }
  197.  
  198.  
  199. function setShowScreenBox()
  200. {
  201.     if (document && document.layers["showscreen"] && document.layers["showscreen"].document.ssForm)
  202.     {    
  203.         var theBox = document.layers["showscreen"].document.ssForm.showScreenBox;
  204.         if ((theBox))
  205.         {
  206.         
  207.             var isVisible = screenVisible();
  208.             
  209.             if (isVisible == false)
  210.             {
  211.                 theBox.checked = false;
  212.             }
  213.             else
  214.             {
  215.                 theBox.checked = true;
  216.             }
  217.         }
  218.     }
  219. }
  220.  
  221.  
  222. function screenVisible()
  223. {
  224.     var visible = true;
  225.     
  226.     if (opener.top && opener.top.screen && opener.top.screen.controls && opener.top.screen.controls.screenVisible)
  227.     {
  228.             visible = opener.top.screen.controls.screenVisible();
  229.     }
  230.     //else
  231.     //alert("toolbar - screenvisible: " + visible);
  232.     
  233.     return visible;
  234. }
  235.  
  236. function reloadScreen()
  237. {
  238.     //var theLoc = top.opener.screen.content.location;
  239.     //alert("top.opener.screen.content.location is " + top.opener.screen.content.location);
  240.     //top.opener.screen.content.history.go(0);
  241.     top.opener.screen.controls.reloadDocument();
  242.     return false;
  243. }
  244.  
  245. function chooseEditor()
  246. {
  247.  
  248.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  249.     
  250.     var theEditor = opener.top.globals.document.setupPlugin.GetExternalEditor();
  251.     if ((theEditor != null) && (theEditor != "")) {
  252.         top.opener.top.globals.document.vars.externalEditor.value = theEditor;
  253.         top.opener.top.globals.saveExternalEditor();
  254.     }
  255. }
  256.  
  257. function screenOptions()
  258. {
  259.     return opener.top.screen.controls.go('Screen Options');
  260.  
  261. }
  262.  
  263. function showScreen(thisRef)
  264. {
  265.     var result = thisRef.checked;
  266.     
  267.     var theBox = document.layers["showscreen"].document.ssForm.showScreenBox;
  268.     if ((theBox))
  269.     {
  270.         var result = opener.top.screen.controls.showScreen(theBox.checked);
  271.         if ((result != null)) 
  272.             theBox.checked = result;
  273.     }
  274.     
  275.     return result;
  276. }
  277.  
  278. function hidelayer(layerName)
  279. {
  280.     if (document.layers)
  281.     {
  282.         theLayer = eval("document.layers."+layerName);
  283.         if(theLayer)
  284.         {
  285.             theLayer.visibility="hide";
  286.         }
  287.     }
  288.     else
  289.     {
  290.         //alert("hide: " + layerName);
  291.         theImg = eval("document.images."+layerName);
  292.         replaceSrc(theImg, "Images/blank.gif");
  293.         replaceSrc(theImg, "Images/blank1.gif");
  294.     }
  295. }
  296.  
  297. function showlayer(layerName)
  298. {
  299.     if (document.layers)
  300.     {
  301.         theLayer = eval("document.layers."+layerName);
  302.         if(theLayer)
  303.         {
  304.             theLayer.visibility="show";
  305.         }
  306.     }
  307.     else
  308.     {
  309.         //alert("show: " + layerName);
  310.         theImg = eval("document.images."+layerName);
  311.         if(theImg)
  312.             replaceSrc(theImg, theImg.lowsrc);    
  313.     }
  314. }
  315.  
  316.  
  317. function toggleShow(lName, checkValue)
  318. {
  319.     //alert(checkValue);
  320.     if ((checkValue != null) && (checkValue == false))
  321.         hidelayer(lName);
  322.     else
  323.         showlayer(lName);
  324.  
  325. }
  326.  
  327. function callback()
  328. {
  329.     ready = true;
  330.     opener.top.screen.controls.generateToolBarControls();
  331. }
  332.  
  333. function updateLayersLayer()
  334. {
  335.     //first, evaluate the ## of layers in the top document.
  336.     var numLayers = 0;
  337.     var thePopup = document.layers["layerSwitch"].document.forms[0]["layerSelect"];
  338.     
  339.     if (thePopup && !top.loading)
  340.     {
  341.         //if (top.opener.screen.content.document.layers && top.opener.screen.content.document.layers.length > 0)
  342.         //    numLayers = top.opener.screen.content.document.layers.length;
  343.         numLayers = top.opener.screen.controls.countDocumentLayers();
  344.     
  345.         if (numLayers > 0)
  346.         {
  347.             document.layers["layerSwitch"].visibility="show";
  348.             var curLayerName="", curLayerSrc="_none";
  349.             
  350.     
  351.             //blank out old list
  352. top.opener.top.globals.debug("deleting options list: " + thePopup.options.length + " present");
  353.         
  354.             for (var i = (numValidPopupEntries -1); i >= 0 ; i--)
  355.             {
  356.                 thePopup.options[i] = new Option(" "," ",false,false);
  357.             }    
  358.             //thePopup.options.length = 0;
  359.  
  360.             //add a layer for the main body
  361.             thePopup.options[0] = new Option("Main Document                     .",top.opener.screen.controls.getDocumentLocation(), false, false);
  362.             numValidPopupEntries = 1;
  363. top.opener.top.globals.debug("setting popuocount to 1, options.length is: " + thePopup.options.length);
  364.  
  365.             for(var index = 0; index < numLayers; index++)
  366.             {
  367.                 curLayerName=top.opener.screen.controls.getLayerName(index);
  368.                 curLayerSrc=top.opener.screen.controls.getLayerSrc(index);
  369.                 if (!curLayerSrc || curLayerSrc == null || curLayerSrc == "null" || curLayerSrc == "")
  370.                      curLayerSrc = "_none";                  
  371.                 
  372.                 if (top.opener.screen.controls.getDocumentLayerVisibility(index) == "hide")
  373.                 {
  374.                     curLayerName = (curLayerName + " [hidden]");
  375.                 }
  376.                 
  377.                 if (curLayerName == null || curLayerName == "")
  378.                 {
  379.                     curLayerName = ("Layer " + eval(index+1));
  380.                 } 
  381.                 
  382.                 //alert("Layer name: " + curLayerName + "; src: " + curLayerSrc);
  383.                 
  384.                 if ((top.opener.screen.controls.getDocumentLayerVisibility(index) == "hide") || ((curLayerSrc != null) && (curLayerSrc != "") && (curLayerSrc != "null") && (curLayerSrc != "_none")))
  385.                 {
  386. top.opener.top.globals.debug("Adding layer " + curLayerName + " to options " + numValidPopupEntries + ".  thePopup.options.length now: " + thePopup.options.length);
  387.                     thePopup.options[numValidPopupEntries] = new Option(curLayerName,curLayerSrc, false, false);
  388.                     numValidPopupEntries++;
  389.                 }
  390.             }    
  391.             thePopup.selectedIndex=0;
  392.             document.layers["layerSwitch"].document.layers["g_hideothers"].visibility= "hide"; //hide the checkbox if the main document is selected.
  393.         }
  394.         else
  395.         {
  396.             hidelayer("layerSwitch");
  397.             document.layers["layerSwitch"].document.layers["g_hideothers"].visibility= "hide"; //hide the checkbox if the main document is selected.
  398.  
  399.         }
  400.     }
  401.     else
  402.         setTimeout("updateLayersLayer()",1000);
  403.     
  404. }
  405.  
  406.  
  407. function selectLayer(popupIndex)
  408. {
  409.  
  410.     var numLayers = numValidPopupEntries;//document.layers["layerSwitch"].document.forms[0]["layerSelect"].options.length;
  411.     var layerName = "";
  412.     var hideCheckBox =     null;
  413.     
  414.     if (popupIndex >= numValidPopupEntries)
  415.     {
  416.         popupIndex = 0;
  417.         document.layers["layerSwitch"].document.forms[0]["layerSelect"].selectedIndex = 0;
  418.     }
  419.     if (document && document.layers && document.layers["layerSwitch"] && document.layers["layerSwitch"].document.forms[0] && document.layers["layerSwitch"].document.layers["g_hideothers"].document.forms[0]["hideLayers"])
  420.         hideCheckBox = document.layers["layerSwitch"].document.layers['g_hideothers'].document.forms[0]["hideLayers"];
  421.  
  422.     if (top.opener.screen.controls.countDocumentLayers() > 0)
  423.     {
  424.  
  425.         //first restore all originally hidden layers to their old hidden state:
  426.         for (var layidx = 1; layidx < numLayers; layidx++)
  427.         {
  428.             //alert("Layer " + layidx + "/" + numLayers);
  429.             var hiddenIndex = document.layers["layerSwitch"].document.forms[0]["layerSelect"].options[layidx].text.toString().indexOf(" [hidden]");
  430.             
  431.             if (hiddenIndex >= 0)
  432.             {
  433.                 var layerName = document.layers["layerSwitch"].document.forms[0]["layerSelect"].options[layidx].text.substring(0, hiddenIndex);
  434.                 //alert("hiding " + layerName);
  435.                 //if (top.opener.screen.content.document.layers[layerName].visibility)
  436.                     top.opener.top.screen.controls.showDocumentLayer(layerName, false);
  437.                     //top.opener.screen.content.document.layers[layerName].visibility="hide";
  438.             }
  439.         }
  440.         
  441.         //now make sure we are showing the currently selected layer
  442.         if (popupIndex > 0)                //omit 0 becuase that represents the main document
  443.         {
  444. top.opener.top.globals.debug("selectLayer, showing current Layer #: " + popupIndex);
  445.  
  446.             document.layers["layerSwitch"].document.layers["g_hideothers"].visibility="show";
  447.             layerName = document.layers["layerSwitch"].document.forms[0]["layerSelect"].options[popupIndex].text.toString();
  448. top.opener.top.globals.debug("selectLayer, layer name is: " + layerName);
  449.             if (layerName.indexOf(" [hidden]") > 0)
  450.                 layerName = layerName.substring(0,layerName.indexOf(" [hidden]"));
  451.             top.opener.top.screen.controls.showDocumentLayer(layerName, true);
  452.         }
  453.         else if (hideCheckBox != null && hideCheckBox.checked) //showing main document
  454.         {
  455.             numLayers = top.opener.screen.controls.countDocumentLayers();
  456.             //show all document layers
  457.              for (var index = 0; index < numLayers; index++)
  458.             {
  459.                 layerName=top.opener.screen.controls.getLayerName(index);
  460.                 
  461.                 if (!checkIfHiddenInLayerPopup(layerName))
  462.                     top.opener.top.screen.controls.showDocumentLayer(layerName, true);
  463.             
  464.                 hideCheckBox.checked = false;
  465.             }                
  466.         }
  467.         
  468.         if (popupIndex == 0)
  469.             document.layers["layerSwitch"].document.layers["g_hideothers"].visibility= "hide"; //hide the checkbox if the main document is selected.
  470.  
  471.         
  472.  
  473.     }
  474. }
  475.  
  476.  
  477. function checkIfHiddenInLayerPopup(inLayerName)
  478. {
  479.     var thePopup = document.layers["layerSwitch"].document.forms[0]["layerSelect"]; 
  480.     var hiddenName = inLayerName + " [hidden]";
  481.     var result = false;
  482.     
  483.     if (thePopup && thePopup != null)
  484.     {
  485. top.opener.top.globals.debug("length: " + thePopup.length + ".  options.length: " + thePopup.options.length);
  486.         for (var index = thePopup.length-1; index > 0; index--)
  487.         {
  488.             if (thePopup.options[index].text.toString() == hiddenName)
  489.             {
  490.                 result = true;
  491.                 return result;
  492.             }
  493.         }
  494.     }
  495.     
  496.     return result;
  497. }
  498.  
  499. //show all layers that were originally not hidden.
  500. function restoreLayers()
  501. {
  502.     //first, evaluate the ## of layers in the top document.
  503.     var numLayers = 0;
  504.     var curLayerName = "";
  505.     
  506.     numLayers = top.opener.screen.controls.countDocumentLayers();
  507.  
  508.     for (var index = 0; index < numLayers; index++)
  509.     {
  510.         curLayerName=top.opener.screen.controls.getLayerName(index);
  511.         
  512.         //if (!checkIfHiddenInLayerPopup(curLayerName))
  513.             top.opener.top.screen.controls.showDocumentLayer(curLayerName, true);
  514.     }    
  515.  
  516.     selectLayer(document.layers["layerSwitch"].document.forms[0]["layerSelect"].selectedIndex);
  517. }
  518.  
  519.  
  520. function hideOtherLayers(inDoHide)
  521. {
  522.  
  523.     var thePopup = document.layers["layerSwitch"].document.forms[0]["layerSelect"];
  524.     
  525.     if (!thePopup || thePopup == null)
  526.         return;
  527.  
  528.     if (inDoHide == false)
  529.         restoreLayers();
  530.     else if (thePopup.selectedIndex > 0)
  531.     {
  532.         //first, evaluate the ## of layers in the top document.
  533.         var numLayers = 0;
  534.         var curLayerName = "";
  535. top.opener.top.globals.debug("hideOtherLayers, getting layer name for: " + thePopup.selectedIndex);
  536.         var selectedLayerName = thePopup.options[thePopup.selectedIndex].text.toString();
  537. top.opener.top.globals.debug("hideOtherLayers, layer name is: " + selectedLayerName);
  538.         
  539.         numLayers = top.opener.screen.controls.countDocumentLayers();
  540.     
  541.         for (var index = 0; index < numLayers; index++)
  542.         {
  543.             curLayerName=top.opener.screen.controls.getLayerName(index);
  544.             
  545.             if (curLayerName == selectedLayerName || (curLayerName + " [hidden]") == selectedLayerName)
  546.             {
  547.                 top.opener.top.screen.controls.showDocumentLayer(curLayerName, true);
  548.             }
  549.             else
  550.             {
  551.                 top.opener.top.screen.controls.showDocumentLayer(curLayerName, false);
  552.             }
  553.         }    
  554.         
  555.  
  556.     }
  557.     else if (document && document.layers && document.layers["layerSwitch"] && document.layers["layerSwitch"].document.forms[0] && document.layers["layerSwitch"].document.layers['g_hideothers'].document.forms[0]["hideLayers"])
  558.         document.layers["layerSwitch"].document.layers['g_hideothers'].document.forms[0]["hideLayers"].checked = false;
  559.         
  560. }
  561.  
  562.  
  563. function cfgHelp()
  564. {
  565.     if ((!cfgHelpWindow) || (cfgHelpWindow==null) || (!cfgHelpWindow.location) || (cfgHelpWindow.closed))
  566.     {
  567.         cfgHelpWindow = top.open("about:blank", "CFGHELP", "dependent=yes,alwaysRaised=yes,width=300,height=230,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");        
  568.     }    
  569.  
  570.     setHelpLocation();
  571. }
  572.  
  573.  
  574. function setHelpLocation()
  575. {
  576.  
  577.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  578.  
  579.     if (cfgHelpWindow && !cfgHelpWindow.closed)    //don't do anything if there's no window, but set location if there is
  580.     {
  581.         var filePrefix = "./cfghelp"; //default prefix, will change
  582.         var helpFile = "./cfghelp/default.htm";    //put default help screen here
  583.     
  584.         //figure out the file prefix by checking the toolbar location
  585.         var toolbarLoc = document.location.toString();
  586.         filePrefix = toolbarLoc.substring(0, toolbarLoc.lastIndexOf("/")+1) + "cfghelp/";
  587.     
  588.         if (top.opener.screen.content.document.location)
  589.         {
  590.             helpFile = top.opener.screen.content.document.location.toString();
  591.             var theIdx = helpFile.lastIndexOf("/");
  592.             var theLength = helpFile.length;
  593.             helpFile = "" + helpFile.substring(theIdx+1, theLength);
  594.         }
  595.  
  596.         //alert("looking for help file: " + helpFile);
  597.  
  598.         //check if the file we made up exists, if not, revert to the default
  599.         var helpPath = "";
  600.  
  601.         if (top.opener && top.opener.top.globals)    
  602.         {
  603.             helpPath = "" + top.opener.top.globals.getFolder(self);
  604.             //alert("helppath: " + helpPath);
  605.         }
  606.  
  607.         var thePlatform = new String(navigator.userAgent);
  608.         var x=thePlatform.indexOf("(")+1;
  609.         var y=thePlatform.indexOf(";",x+1);
  610.         thePlatform=thePlatform.substring(x,y);
  611.  
  612.         if (thePlatform == "Macintosh")    
  613.         {                        // Macintosh support
  614.             helpPath = helpPath + "cfghelp:";
  615.         }
  616.         else    
  617.         {                                                // Windows support
  618.             helpPath = helpPath + "cfghelp/";
  619.         }
  620.  
  621.         var lookingForFile = helpFile;
  622.         helpFile = filePrefix + "default.htm";
  623.         
  624.         var theList = top.opener.top.globals.document.setupPlugin.GetFolderContents(helpPath,".htm");
  625.         if (theList != null)    
  626.         {
  627.             for (var i=0; i<theList.length; i++)    
  628.             {
  629.                 if (lookingForFile == theList[i])    {
  630.                     helpFile = filePrefix + lookingForFile;
  631.                     break;
  632.                     }
  633.             }
  634.         }
  635.  
  636.         if (helpFile != null && helpFile != "")    
  637.         {
  638.             cfgHelpWindow=window.open("about:blank","CFGHELP","dependent=yes,alwaysraised=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
  639.             if (cfgHelpWindow)    {
  640.                 cfgHelpWindow.focus();
  641.                 //alert("helpfile: " + helpFile);
  642.                 cfgHelpWindow.location = helpFile;
  643.             }
  644.         }
  645.  
  646.     }
  647. }
  648.  
  649.  
  650. function exitASE()
  651. {
  652.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  653.  
  654.     if (confirm("Are you sure you want to quit the Account Setup Editor?") == true)
  655.         top.opener.top.globals.document.setupPlugin.QuitNavigator();
  656. }
  657.  
  658.  
  659.