home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / dial.js < prev    next >
Text File  |  1998-10-15  |  4KB  |  121 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    intlString = "";
  21. var    localString = "";
  22.  
  23. var theFile = parent.parent.globals.getAcctSetupFilename(self);
  24. var intlFlag = parent.parent.globals.GetNameValuePair(theFile,"Mode Selection","IntlMode");
  25. intlFlag = intlFlag.toLowerCase();
  26.  
  27. if ( intlFlag == "yes" )
  28. {
  29.     intlString = "text";
  30.     localString = "hidden";
  31. }
  32. else
  33. {
  34.     intlString = "hidden";
  35.     localString = "text";
  36. }
  37.  
  38. function writeLocalText( theString )
  39. {
  40.     if ( localString == "text" )
  41.         document.write( theString );
  42. }
  43.  
  44. function go( msg )
  45. {
  46.     if ( parent.parent.globals.document.vars.editMode.value == "yes" )
  47.         return true;
  48.     else
  49.         return checkData();
  50. }
  51.  
  52. function checkData()
  53. {
  54.     if ( intlFlag != "yes" )
  55.     {
  56.         if ( document.forms[ 0 ].accountAreaCode.value == "" )
  57.         {
  58.             alert( "You must enter an area code." );
  59.             parent.parent.globals.setFocus( document.forms[ 0 ].accountAreaCode );
  60.             return false;
  61.         }
  62.         if ( parent.parent.globals.verifyAreaCode( document.forms[ 0 ].accountAreaCode.value) == false )
  63.         {
  64.             alert( "Please enter a valid area code." );
  65.             parent.parent.globals.setFocus( document.forms[ 0 ].accountAreaCode );
  66.             return false;
  67.         }
  68.     }
  69.     if ( document.forms[ 0 ].accountPhoneNumber.value == "" )
  70.     {
  71.         alert( "You must enter a telephone number." );
  72.         parent.parent.globals.setFocus( document.forms[ 0 ].accountPhoneNumber );
  73.         return false;
  74.     }
  75.     if ( parent.parent.globals.verifyPhoneNumber( document.forms[ 0] .accountPhoneNumber.value, 7 ) == false )
  76.     {
  77.         alert( "Please enter a valid telephone number." );
  78.         parent.parent.globals.setFocus( document.forms[ 0 ].accountPhoneNumber );
  79.         return false;
  80.     }
  81.     return true;
  82. }
  83.  
  84. function loadData()
  85. {
  86.     // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  87.     if (((document.forms[0].accountAreaCode == "undefined") || (document.forms[0].accountAreaCode == "[object InputArray]")) ||
  88.         ((document.forms[0].accountPhoneNumber == "undefined") || (document.forms[0].accountPhoneNumber == "[object InputArray]")))
  89.     {
  90.         parent.controls.reloadDocument();
  91.         return;
  92.     }
  93.  
  94.     if (intlFlag != "yes")    {
  95.         document.forms[0].accountAreaCode.value = parent.parent.globals.document.vars.accountAreaCode.value;
  96.         }
  97.     document.forms[0].accountPhoneNumber.value = parent.parent.globals.document.vars.accountPhoneNumber.value;
  98.     parent.parent.globals.setFocus(document.forms[0].accountAreaCode);
  99.     if (parent.controls.generateControls)    parent.controls.generateControls();
  100. }
  101.  
  102.  
  103.  
  104. function saveData()
  105. {
  106.     // make sure all form element are valid objects, otherwise just skip & return!
  107.     if (((document.forms[0].accountAreaCode == "undefined") || (document.forms[0].accountAreaCode == "[object InputArray]")) ||
  108.         ((document.forms[0].accountPhoneNumber == "undefined") || (document.forms[0].accountPhoneNumber == "[object InputArray]")))
  109.     {
  110.         parent.controls.reloadDocument();
  111.         return;
  112.     }
  113.  
  114.     if (intlFlag != "yes")    {
  115.         parent.parent.globals.document.vars.accountAreaCode.value = document.forms[0].accountAreaCode.value;
  116.         }
  117.     parent.parent.globals.document.vars.accountPhoneNumber.value = document.forms[0].accountPhoneNumber.value;
  118. }
  119.  
  120. // end hiding contents from old browsers  -->
  121.