home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / NETSCAPE / CCK / INSTBLDR.Z / asw.jar / modem1.js < prev    next >
Encoding:
Text File  |  1998-02-27  |  5.8 KB  |  219 lines

  1. <!--  to hide script contents from old browsers
  2.  
  3.  
  4.  
  5. function go(msg)
  6. {
  7.     if (parent.parent.globals.document.vars.editMode.value == "yes")
  8.         return true;
  9.     else
  10.         return(checkData());
  11. }
  12.  
  13.  
  14.  
  15. function checkData()
  16. {
  17.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  18.  
  19.     if (document.forms[0].modem.selectedIndex >= 0) {
  20.         if (parent.parent.globals.document.vars.path.value == "New Path")    {
  21.             var theModem = document.forms[0].modem[document.forms[0].modem.selectedIndex].value;
  22. /*
  23.             var theModemType = parent.parent.globals.document.setupPlugin.GetModemType(theModem);
  24.             if (theModemType != null)    {
  25.                 theModemType = theModemType.toUpperCase();
  26.                 if (theModemType == "ISDN")    {
  27.                     alert("ISDN modems can not be used to connect to the Internet account server.");
  28.                     return(false);
  29.                     }
  30.                 }
  31. */
  32.             if (theModem != "")    {
  33.                 if (theModem.indexOf("ISDN-")>=0)    {            // magic "ISDN-" check
  34.                     alert("ISDN modems can not be used to connect to the Internet account server.");
  35.                     return(false);
  36.                     }
  37.                 }
  38.  
  39.             }
  40.         }
  41.     else    {
  42.         alert("Please select a modem, or install a modem if no modem is installed!");
  43.         return(false);
  44.         }
  45.  
  46.     return(true);
  47. }
  48.  
  49.  
  50.  
  51. function loadData()
  52. {
  53.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  54.  
  55.     var thePlatform = new String(navigator.userAgent);
  56.     var x=thePlatform.indexOf("(")+1;
  57.     var y=thePlatform.indexOf(";",x+1);
  58.     thePlatform=thePlatform.substring(x,y);
  59.  
  60.     if (thePlatform != "WinNT")    {
  61.         document.layers["ModemSetup"].visibility = "show";
  62.         }
  63.  
  64.  
  65.     updateModemStatus(true);
  66.     if (parent.controls.generateControls)    parent.controls.generateControls();
  67. }
  68.  
  69.  
  70.  
  71. function saveData()
  72. {
  73.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  74.  
  75.     if (document.forms[0].modem.selectedIndex >= 0) {
  76.         parent.parent.globals.document.vars.modem.value = document.forms[0].modem[document.forms[0].modem.selectedIndex].value;
  77.     }
  78.  
  79.     parent.parent.globals.document.setupPlugin.CloseModemWizard();
  80. }
  81.  
  82.  
  83.  
  84. function generateModems()
  85. {
  86.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  87.  
  88.     var modemList = parent.parent.globals.document.setupPlugin.GetModemList();
  89.     var thePopup = document.forms[0]["modem"];
  90.  
  91.     if (modemList != null && thePopup) 
  92.     {
  93.         //remove all old options
  94.         for (var i = (thePopup.length -1); i >= 0 ; i--)
  95.         {
  96.             thePopup.options[i] = null;
  97.         }    
  98.  
  99.         //add the modems
  100.         for(var index = 0; index < modemList.length; index++)
  101.         {
  102.             thePopup.options[thePopup.options.length] = new Option(modemList[index],modemList[index], false, false);
  103.         }
  104.         
  105.         //select the current modem
  106.         selectCurrentModem();
  107.  
  108.     }
  109. }
  110.  
  111.  
  112. function selectCurrentModem()
  113. {
  114.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  115.  
  116.     var found = false;
  117.     var thePopup = document.forms[0]["modem"];
  118.     var globalModem = parent.parent.globals.document.vars.modem.value;
  119.     var pluginModem = parent.parent.globals.document.setupPlugin.GetCurrentModemName();
  120.  
  121.     var thePlatform = new String(navigator.userAgent);
  122.     var x=thePlatform.indexOf("(")+1;
  123.     var y=thePlatform.indexOf(";",x+1);
  124.     thePlatform=thePlatform.substring(x,y);
  125.  
  126.     var selectIndex = 0;
  127.     if (thePlatform != "Macintosh")    {  // work around for window's list index bug
  128.         var selectIndex = thePopup.options.length-1;
  129.         }
  130.  
  131.     //alert("globalModem: " + globalModem + ", pluginModem: " + pluginModem);
  132.     for(var index = 0; index < thePopup.options.length; index++)
  133.     {
  134.         if ((globalModem == thePopup.options[index]) || (selectIndex == 0 && pluginModem == thePopup.options[index]) )
  135.             selectIndex = index;
  136.     }
  137.  
  138.     thePopup.options[selectIndex].selected = true;    
  139. }
  140.  
  141. function OLDgenerateModems()
  142. {
  143.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  144.  
  145.     var modemList = parent.parent.globals.document.setupPlugin.GetModemList();
  146.  
  147.     if (modemList != null) {
  148.         var theModem = parent.parent.globals.document.vars.modem.value;
  149.         var selectedStr = "";
  150.  
  151.         for (var x=0; x<modemList.length; x++)    {
  152.             if (modemList[x] == theModem)    {
  153.                 selectedStr=" SELECTED";
  154.                 }
  155.             else    {
  156.                 selectedStr="";
  157.                 }
  158.             document.writeln("<OPTION VALUE='" + modemList[x] + "'" + selectedStr + ">" + modemList[x]);
  159.             }
  160.     }
  161. }
  162.  
  163.  
  164.  
  165. function updateModemStatus(loadingFlag)
  166. {
  167.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  168.  
  169.     if (parent.parent.globals.document.setupPlugin.IsModemWizardOpen() == true)    {
  170.         setTimeout("updateModemStatus(false)",1000);
  171.         }
  172.     else    {
  173.         for (x=document.forms[0].modem.length-1; x>=0; x--)    {
  174.             document.forms[0].modem.options[x]=null;
  175.             }
  176.  
  177.     if (loadingFlag == false)    {
  178.         var selectedModem=parent.parent.globals.document.setupPlugin.GetCurrentModemName();
  179.         if (selectedModem != null && selectedModem != "")    {
  180.             parent.parent.globals.document.vars.modem.value = selectedModem;
  181.             }
  182.         }
  183.  
  184.     var theModem = parent.parent.globals.document.setupPlugin.GetModemList();
  185.     if (theModem != null)    {
  186.         var theSelectedIndex=-1;
  187.         for (x=0; x<theModem.length; x++)    {
  188.             var selectedFlag = (parent.parent.globals.document.vars.modem.value==theModem[x]);
  189.         if (selectedFlag==true)    theSelectedIndex=x;
  190.             document.forms[0].modem.options[x] = new Option(theModem[x],theModem[x],selectedFlag,selectedFlag);
  191.             }
  192.         if (theSelectedIndex>=0)    {
  193.             document.forms[0].modem.selectedIndex=theSelectedIndex;
  194.             }
  195.         }
  196.     
  197.     //generateModems();
  198.     
  199.     }
  200. }
  201.  
  202.  
  203.  
  204. function callModemWizard()
  205. {
  206.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  207.  
  208.     if (document.forms[0].modem.selectedIndex >= 0) {
  209.         parent.parent.globals.document.vars.modem.value = document.forms[0].modem[document.forms[0].modem.selectedIndex].value;
  210.     }
  211.     parent.parent.globals.document.setupPlugin.OpenModemWizard();
  212.     setTimeout("updateModemStatus(false)",1000);
  213.     return(false);
  214. }
  215.  
  216.  
  217.  
  218. // end hiding contents from old browsers  -->
  219.