// Copyright © 2001 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.

// email


function checkPhone (strng) {
var error = "";
    if (!(strng == "")) {
    
          var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
              if (isNaN(parseInt(stripped))) {
                 error = "The phone number contains illegal characters. Please use format ###-###-####";
              }
              if (!(stripped.length == 10)) {
          	error = "The phone number is the wrong length. Make sure you included an area code.\n";
              } 
          return error;
          }
     return error;          
     }


// password - between 6-8 chars, uppercase, lowercase, and numeral

function checkPassword (strng) {
var error = "";

    var illegalChars = /[\W_]/; // allow only letters and numbers
    
    if (strng.length < 5) {
       error = "Please ensure your password is at least 5 characters.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "Please ensure your password contains only letters and numbers.\n";
    }  
return error;    
}    
 

function areEqual(strng,strng2,strngLabel) {
var error = ""; 
  if (strng != strng2 ) {
     error = "Please ensure your" + strngLabel  + "match.\n";
  }
return error;
}


