String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};

String.prototype.endsWith = function(str) {
	str = str.toString();
	return this.substr(this.length - str.length, str.length) == str;
}

String.prototype.startsWith = function(str) {
	str = str.toString();
	return this.substr(0, str.length) == str;
}