// Copyright © 2001 by Apple Computer, Inc., All Rights Reserved.

function checkFirstName (strng) {
var error = "";
if (strng == "") {
   error = "Please Enter Your First Name.\n";
}
return error;
}       

function checkLastName (strng) {
var error = "";
if (strng == "") {
   error = "Please Enter Your Last Name.\n";
}
return error;
}

// phone number - strip out delimiters and check for 10 digits

function checkDayPhone (strng) {
var error = "";
if (strng == "") {
   error = "Please Enter A Phone Number.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The Phone Number Contains Illegal Characters.";
  
    }
    if (!(stripped.length == 10)) {
	error = "The Phone Number Is The Wrong Length. Make Sure You Included An Area Code.\n";
    } 
return error;
}

// email

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Please Enter Your Email Address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please Enter a Valid Email Address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\ \\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The Email Address Contains Illegal Characters.\n";
       }
    }
return error;    
}