home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / dial2stp.js < prev    next >
Text File  |  1998-10-15  |  6KB  |  166 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.  
  21.  
  22. var    intlString = "";
  23. var    localString = "";
  24.  
  25.  
  26.  
  27. var theFile = parent.parent.globals.getAcctSetupFilename(self);
  28. var intlFlag = parent.parent.globals.GetNameValuePair(theFile,"Mode Selection","IntlMode");
  29. intlFlag = intlFlag.toLowerCase();
  30.  
  31. if ( intlFlag == "yes" )
  32. {
  33.     intlString = "text";
  34.     localString = "hidden";
  35. }
  36. else
  37. {
  38.     intlString = "hidden";
  39.     localString = "text";
  40. }
  41.  
  42.  
  43.  
  44. function writeLocalText( theString )
  45. {
  46.     if ( localString == "text" )
  47.         document.write( theString );
  48. }
  49.  
  50.  
  51.  
  52. function go( msg )
  53. {
  54.     if ( ( parent.parent.globals.document.vars.editMode.value == "yes" ) || checkData() )
  55.     {
  56.         if ( msg == parent.parent.globals.document.vars.path.value )
  57.             return true;
  58.     }
  59.     return false;
  60. }
  61.  
  62. function checkData()
  63. {
  64.     if ( intlFlag != "yes" )
  65.     {
  66.         if ( document.forms[ 0 ].modemAreaCode.value == "" )
  67.         {
  68.             alert( "You must enter an area code." );
  69.             parent.parent.globals.setFocus( document.forms[ 0 ].modemAreaCode );
  70.             return false;
  71.         }
  72.         if ( parent.parent.globals.verifyAreaCode( document.forms[ 0 ].modemAreaCode.value ) == false )
  73.         {
  74.             alert( "Please enter a valid area code." );
  75.             parent.parent.globals.setFocus( document.forms[ 0 ].modemAreaCode );
  76.             return false;
  77.         }
  78.     }
  79.     if ( document.forms[ 0 ].modemPhoneNumber.value == "" )
  80.     {
  81.         alert( "You must enter a telephone number." );
  82.         parent.parent.globals.setFocus( document.forms[ 0 ].modemPhoneNumber );
  83.         return false;
  84.     }
  85.     if ( parent.parent.globals.verifyPhoneNumber( document.forms[ 0 ].modemPhoneNumber.value, 3 ) == false )
  86.     {
  87.         alert( "Please enter a valid telephone number." );
  88.         parent.parent.globals.setFocus( document.forms[ 0 ].modemPhoneNumber );
  89.         return false;
  90.     }
  91.     return true;
  92. }
  93.  
  94.  
  95.  
  96. function loadData()
  97. {
  98.     // Ñ make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  99.     if (    (    ( document.forms[ 0 ].modemAreaCode == "undefined" ) || 
  100.                 ( document.forms[ 0 ].modemAreaCode == "[object InputArray]" )
  101.             ) ||
  102.             (    ( document.forms[ 0 ].modemPhoneNumber == "undefined" ) || 
  103.                 ( document.forms[ 0 ].modemPhoneNumber == "[object InputArray]" ) ) )
  104.     {
  105.         top.globals.debug( "FORM ELEMENT = " + document.forms[ 0 ].modemPhoneNumber );
  106.         top.globals.debug( "SET FOCUS: " + document.forms[ 0 ].modemAreaCode + "BAD OBJECT!!!" );
  107.         top.globals.debug( "HISTORY: " + parent.content.history );
  108.         parent.controls.reloadDocument();
  109.         return;
  110.     }
  111.  
  112.     document.forms[ 0 ].modemAreaCode.value = parent.parent.globals.document.vars.modemAreaCode.value;
  113.  
  114.     if ( intlFlag != "yes" )
  115.     {
  116.         if ( document.forms[ 0 ].modemAreaCode.value == "" )
  117.             document.forms[ 0 ].modemAreaCode.value = parent.parent.globals.document.vars.areaCode.value;
  118.     }
  119.  
  120.     document.forms[ 0 ].modemPhoneNumber.value = parent.parent.globals.document.vars.modemPhoneNumber.value;
  121.     if ( document.forms[ 0 ].modemPhoneNumber.value == "" )
  122.     {
  123.         phonePrefix = parent.parent.globals.document.vars.phoneNumber.value;
  124.         phonePrefix = phonePrefix.substring( 0, 3 );
  125.         document.forms[ 0 ].modemPhoneNumber.value = phonePrefix;
  126.     }
  127.  
  128.     document.forms[ 0 ].altAreaCode1.value = parent.parent.globals.document.vars.altAreaCode1.value;
  129.     document.forms[ 0 ].altAreaCode2.value = parent.parent.globals.document.vars.altAreaCode2.value;
  130.     document.forms[ 0 ].altAreaCode3.value = parent.parent.globals.document.vars.altAreaCode3.value;
  131.     
  132.     parent.parent.globals.setFocus( document.forms[ 0 ].modemAreaCode );
  133.     if ( parent.controls.generateControls )
  134.         parent.controls.generateControls();
  135. }
  136.  
  137.  
  138.  
  139. function saveData()
  140. {
  141.     // make sure all form element are valid objects, otherwise just skip & return!
  142.     if (((document.forms[0].modemAreaCode == "undefined") || (document.forms[0].modemAreaCode == "[object InputArray]")) ||
  143.         ((document.forms[0].modemPhoneNumber == "undefined") || (document.forms[0].modemPhoneNumber == "[object InputArray]")))
  144.     {
  145.         top.globals.debug("SAVE DATA ...");
  146.         top.globals.debug("FORM ELEMENT = " + document.forms[0].modemPhoneNumber);
  147.         top.globals.debug("SET FOCUS: " + document.forms[0].modemAreaCode + "BAD OBJECT!!!");
  148.         top.globals.debug("HISTORY: " + parent.content.history);
  149.         parent.controls.reloadDocument();
  150.         return;
  151.     }
  152.  
  153.     if ( intlFlag != "yes" )
  154.     {
  155.         parent.parent.globals.document.vars.modemAreaCode.value = document.forms[ 0 ].modemAreaCode.value;
  156.     }
  157.     parent.parent.globals.document.vars.modemPhoneNumber.value = document.forms[ 0 ].modemPhoneNumber.value;
  158.     parent.parent.globals.document.vars.altAreaCode1.value = document.forms[ 0 ].altAreaCode1.value;
  159.     parent.parent.globals.document.vars.altAreaCode2.value = document.forms[ 0 ].altAreaCode2.value;
  160.     parent.parent.globals.document.vars.altAreaCode3.value = document.forms[ 0 ].altAreaCode3.value;
  161. }
  162.  
  163.  
  164.  
  165. // end hiding contents from old browsers  -->
  166.