// Copyright © 2001 by Apple Computer, Inc., All Rights Reserved.
// Must be in same order as function

// realname - 4-10 chars, uc, lc, and underscore only.

function checkRealname (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter your name.\n";
	}
/*
    var illegalChars = /\W/; // allow letters, numbers, and underscores
    if ((strng.length < 4) || (strng.length > 10)) {
       error = "The username is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "The username contains illegal characters.\n";
    } */
return error;
}       

// email
function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an 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;    
}

// phone number - strip out delimiters and check for 11 digits
function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't 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 == 11)) {
	error = "The phone number is the wrong length. Make sure you included an area code.\n";
    } 
return error;
}

// Company
function checkCompany (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a company name.\n";
}
return error;
}       

// Type of business
function checkBusiness (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter the type of business.\n";
}
return error;
}       

// Domain name
function checkDomain (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a domain name.\n";
}
/*
    var illegalChars = /\W/; // allow letters, numbers, and underscores
    if ((strng.length < 4) || (strng.length > 10)) {
       error = "The username is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "The username contains illegal characters.\n";
    } */
return error;
}       
