<!--//
var num		= "1234567890";
var numPlus	= "1234567890-,. ";
var alpha	= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var alphaPlus	= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.' ";
var alphaNum	= "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var alphaNumPlus= "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_,.'@& ";
var uNmeChar    = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_,.'@";
var emailChar =  "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.@";
var numPay	= "1234567890.";
var billChar =  "$1234567890,.";





/* lenTest - test length of a text field.
||	Parameters:
||		element: Required.  Form element being tested.
||		iMin: Optional.  A minimum length for field; defaults to 1 (not blank).
||	Returns: Boolean true/false (valid/not valid).
*/
function lenTest(element,iMin) {
  
	element.style.background='transparent';
        


	lMin = 1;					// default minimum length (1)
	msg = 'A required field is blank.';		// default message
	if (iMin) {					// is there a minimum length defined?
		lMin = iMin;				// if so, set the specified minimum length...
		msg = 'field value must be at least ' +	// ...and a different error message.
			lMin +' characters in length.';
		}
	if (element.value.length < lMin) {		// if the element's value is too short...
		alert(msg);				// display the error message...
		element.style.backgroundColor="#CCFFFF";// set the background color...
		element.select();			// select any current input in the element...
		element.focus();			// focus the cursor on the element...
		return false;				// ..and return false to the 'submit' function.
		}
	}
/* charTest - test input for invalid characters.
||	Parameters:
||		element: Required.  Form element being tested.
||		typeIn: Optional.  Character set to limit input.  Possible values are:
||				'a' (limits to a-z, hyphen, period, apostrophe, and space)
||				'n' (limits to 0-9, hyphen, period, comma, and space)
||			If no value is entered, by default the character set is limited to
||			a superset of the alpha and numeric sets.
||	Returns: Boolean true/false (valid/not valid).
*/
function charTest(element,typeIn,custSet) {

      element.style.background='transparent';


	switch (typeIn) {
		case 'n':
			type = num;
			typMsg = "numbers.";
			break;
		
		case 'np':
			type = numPlus;
			typMsg = "numbers, commas, hyphens, and spaces.";
			break;
		case 'a':
			type = alpha;
			typMsg = "letters.";
			break;
		case 'ap':
			type = alphaPlus;
			typMsg = "letters, periods, apostrophes, hyphens, and spaces.";
			break;
		case 'an':
			type = alphaNum;
			typMsg = "letters and numbers.";
			break;
		case 'c':
			type = custSet;
			typMsg = custSet;
			break;
                case 'em':
			type = emailChar;
			typMsg = "letters, numbers, hyphens, underscores, @";
			break;
                case 'un':
			type = uNmeChar;
			typMsg = "letters, numbers, hyphens, underscores, @,periods, apostrophes, ";
			break;	
                case 'ny':
			type = numPay;
			typMsg = "numbers,periods";
			break;	
                case 'bc':
			type = billChar;
			typMsg = "numbers, $, commas, periods";
			break;					
		default:
			type = alphaNumPlus;
			typMsg = "letters, numbers, commas, periods, apostrophes,\nhyphens, and spaces.";
		}
	for (var i=0; i< element.value.length; i++) {
		if (type.indexOf(element.value.charAt(i)) < 0) {
		        BD = element.value.charAt(i);
		        if (BD == " ")
		          BD  = 'space';
			alert('(' +BD+ ') is an invalid character for this field.  Valid characters include\n' + typMsg);
			element.style.backgroundColor="#CCFFFF";
			element.select();
			element.focus();
			return false;
			}
		}
	}
//-->
