// Remove leading and trailing whitespace from a string
String.prototype.trim = function() {
	
	return this.replace(/(^\s+|\s+$)/g, '');
};

// Return the reverse of a string: split into an array, reverse the array, 
// and rejoin.
String.prototype.reverse = function() {

	return this.split("").reverse().join("");

};

// Does case-sensitive/case-insensitive match of this with str.
// Default to case-insensitive
String.prototype.equals = function(str, caseSensitive) {
	
	caseSensitive = caseSensitive || false;	
	return (caseSensitive ? this == str : this.toLowerCase() == str.toLowerCase());
};