var _ErrorChars
// function:	ValidString
// Purpose:		Takes a string and makes sure that it is a valid string.
function ValidString( checkStr, strExtra, bNumbers )
{
	// set variables
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var allValid = true;

	_ErrorChars = ""
	
	checkOK += strExtra;
	if (bNumbers)
		checkOK += "1234567890";
			
	// run through the checkStr, one character at a time...
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);

		// check the character against each one in the comparison string
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
			_ErrorChars = _ErrorChars + ch
			//break;
		}
	}
	
	// return the status of the comparison
	if (allValid){
		return (true);
	} else {
		return (false);
	}
}

// function:	ValidNumber
// Purpose:		Takes a string and makes sure that it is a number.  If the 'dot' flag is
//				true then there can be a dot in it
function ValidNumber( checkStr, dot )
{
	// set variables
	var checkOK = "-1234567890";
	var allValid = true;
	var dotCount = 0;
	
	_ErrorChars = ""

// dot has been allowed so add it to the comparison string
	if (dot){
		checkOK = checkOK + "."
	}
	
	// run through the checkStr, one character at a time...
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);

		// if the character is a '.' then keep a count of it
		if (ch == '.'){
			dotCount++;
		}
		// check the character against each one in the comparison string
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
	}
	// if there is more than 1 '.' in the string then this is an error
	if (dot && dotCount > 1){
		allValid = false
	}
	
	// return the status of the comparison
	if (allValid){
		return (true);
	} else {
		return (false);
	}
}

// function:	ValidTelephoneNumber
// Purpose:		Takes a string and makes sure that it has the makings of a telephone number.
function ValidTelephoneNumber( checkStr )
{
	// set variables
	var checkOK = "1234567890()+- ";
	var allValid = true;
	
	_ErrorChars = ""

// run through the checkStr, one character at a time...
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);

		// check the character against each one in the comparison string
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
	}
	
	// return the status of the comparison
	if (allValid){
		return (true);
	} else {
		return (false);
	}
}

// function:	ValidEmail
// Purpose:		Takes a string and makes sure that it is a valid email address.
function ValidEmail( checkStr )
{
	// set variables
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.";
	var allValid = true;

	_ErrorChars = ""

// run through the checkStr, one character at a time...
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);

		// check the character against each one in the comparison string
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
	}
	
	// return the status of the comparison
	if (allValid){
		return (true);
	} else {
		return (false);
	}
}