home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / 2step.js < prev    next >
Text File  |  1998-10-15  |  5KB  |  135 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. <!--  to hide script contents from old browsers
  19.  
  20. var globals = parent.parent.globals;
  21. var controls = parent.controls;
  22. var plugin = globals.document.setupPlugin;
  23.  
  24. function go( msg )
  25. {
  26.     return true;
  27. }
  28.  
  29. function checkData()
  30. {
  31.     netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
  32.  
  33.     //globals.debug( "checkData" );
  34.     // * skip if we're in edit mode
  35.     if ( globals.document.vars.editMode.value != "yes" )
  36.     {
  37.         //globals.debug( "not editing" );
  38.         
  39.         if ( document.forms != null && document.forms[ 0 ] != null && document.forms[ 0 ].popList != null )
  40.         {
  41.             //globals.debug( "top case" );
  42.             selectedIndex = document.forms[ 0 ].popList.selectedIndex;
  43.         }
  44.         else
  45.         {
  46.             selectedIndex = -1;
  47.         }
  48.         
  49.         //globals.debug( "selectedISP: " + globals.selectedISP );
  50.         //globals.debug( "selectedIndex: " + selectedIndex );        
  51.  
  52.         // * check for toll calls when not in international mode
  53.         if ( globals.document.vars.intlMode.value != "yes" )
  54.         {
  55.             ispPhoneNumber = new String( plugin.GetISPModemNumber( globals.selectedISP, selectedIndex ) );
  56.             areaCode = globals.getAreaCode( ispPhoneNumber );
  57.             if ( areaCode != "" )
  58.             {
  59.                 //globals.debug( "areaCode: " + areaCode );s
  60.                 if ( areaCode != "800" && areaCode != "888" )
  61.                     if ( confirm( "The area code to call this ISP is " + areaCode + ".  This might be a toll call from your area code.  Do you wish to continue?" ) == false )
  62.                         return false;
  63.             }
  64.         }
  65.  
  66.         //globals.debug( "calling createConfigIAS" );
  67.         plugin.CreateConfigIAS( globals.selectedISP, selectedIndex );
  68.         
  69.         //globals.debug( "opening support window" );
  70.     
  71.         if (    !globals.supportWindow || globals.supportWindow == null || 
  72.                 !globals.supportWindow.document || globals.supportWindow.document == null ||
  73.                 globals.supportWindow.closed )
  74.         {            
  75.             globals.supportWindow = top.open( "", "supportNumber",
  76.                 "alwaysRaised,dependent=yes,innerHeight=13,innerWidth=550,titleBar=no" );
  77.             globals.supportWindow.moveBy( 2, -18 );
  78.             globals.supportWindow.opener.focus();
  79.         }
  80.         
  81.         ispSupportNumber = plugin.GetISPSupportPhoneNumber( globals.selectedISP );
  82.         ispSupportName = globals.getSelectedISPName();
  83.     
  84.         if ( ispSupportNumber != null && ispSupportNumber != "" )
  85.         {
  86.             // * close before write will force the document to clear
  87.             globals.supportWindow.document.close();
  88.             globals.supportWindow.document.writeln( "<LAYER PAGEX='0' PAGEY='1'><P><CENTER><FONT FACE='PrimaSans BT' SIZE=-1>For problems, please call " +
  89.                 ispSupportName + " at <B>" + ispSupportNumber + "</B></FONT></CENTER></P></LAYER>" );
  90.         }
  91.         
  92.         return true;
  93.     }
  94.     else
  95.         return false;
  96. }
  97.  
  98. function saveData()
  99. {
  100. }
  101.  
  102. function insertISPName()
  103. {
  104.     document.write( globals.getSelectedISPName() );
  105. }
  106.  
  107. function loadData()
  108. {
  109.     if ( controls.generateControls )
  110.         controls.generateControls();
  111. }
  112.  
  113. function generatePopNumberList()
  114. {
  115.     netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
  116.  
  117.     var list = globals.document.setupPlugin.GetISPPopList( globals.selectedISP );
  118.     
  119.     //globals.debug( "generating pop list" );
  120.     if ( list && list.length > 0 )
  121.     {
  122.         //globals.debug( "emitting table" );
  123.         document.writeln( "<TABLE CELLPADDING=2 CELLSPACING=0 ID='minspace'><TR><TD ALIGN=LEFT VALIGN=TOP HEIGHT=25><spacer type=vertical size=2><B>Pick a phone number from the following list to connect to:</B></TD><TD ALIGN=LEFT VALIGN=TOP><FORM><SELECT NAME='popList'>");
  124.         for ( var x = 0; x < list.length; x++ )
  125.         {
  126.             var name = list[ x ];
  127.             var selected = ( x == 0 ) ? " SELECTED" : "";
  128.             document.writeln( "<OPTION VALUE='" + x + "'" + selected + ">" + name );
  129.         }
  130.         document.writeln( "</SELECT></FORM></TD></TR></TABLE>" );
  131.     }
  132. }
  133.  
  134. // end hiding contents from old browsers  -->
  135.