function stripCharsNotInBag(s, bag) {
	// if (debug) trace("stripCharsNotInBag called >> " + classPath);
	var returnString = "";
	//var s = this.toString();
	for (var i=0; i<s.length; i++){   
			var c = s.charAt(i);
			if (bag.indexOf(c) != -1) {
				returnString += c;
			}
	}
	return returnString;
}

// removes leading and trail whitespace from a string
function stripWhitespace(str)  {
	// if (debug) trace("stripWhitespace called >> " + classPath);
	str = stripLeadingWhitespace(str);
	str = stripTrailingWhitespace(str);
	return str;
}

/**
 *	@param str	The string to strip leading whitespace from.
 *	@return 	The supplied string with leading whitespace removed.
 */

// removes leading whitespace from a string
function stripLeadingWhitespace(str)  {
	// if (debug) trace("stripLeadingWhitespace called >> " + classPath);
	while(str.charCodeAt(0) <= 32) str = str.substring(1, str.length);
	return str;
}

/**
 *	@param str		The string to remove trailing whitepsace from.
 *	@return 		The supplied string with trailing whitespace removed.
 */

// removes trailing whitespace from a string
function stripTrailingWhitespace(str)  {
	// if (debug) trace("stripTrailingWhitespace >> " + classPath);
	while(str.charCodeAt(str.length-1) <= 32) str = str.substring(0, str.length - 1);
	return str;
}
