function verifyPhoneNumber(phoneString)
  {
   // Custom-built function that checks for a valid telephone number format.

   var matchArray = "";        		// Telephone number format. 

   // Regular expressions are delimited by forward slashes (/).
   //   1. Assertions are ^ for matches at the beginning of the string and $ for
   //      matches at the end of the string.
   //   2. Quantifier range of {n} for must occur exactly n times.
   //   3. Character matches \d for a digit (same as [0-9]) and \s for a
   //      whitespace character (same as [ \t\v\n\r\f]). 

   if (phoneString.length == 8)
      {
       // Check for exchange and number - eee-nnnn.
       matchArray = phoneString.match(/^\d{3}-\d{4}$/);
      }
   else 
      {      
       if (phoneString.length == 14)
          {
           // Check for area, exchange and number - (aaa) eee-nnnn.
           matchArray = phoneString.match(/^\(\d{3}\)\s\d{3}-\d{4}$/);
          }
       else	
	  {
           // Check for 1, area, exchange and number - 1 (aaa) eee-nnnn.
           matchArray = phoneString.match(/^1\s\(\d{3}\)\s\d{3}-\d{4}$/);
          }
      }

   if (matchArray == null)	// Is the phone number format ok?
      {return false;}		// No, return false (Boolean) .
 
   return true;
  }

