// Removes whitespace from the beginning and end of a string
String.prototype.trim = function()
{ 
	var retValue = this;
	while(retValue.charAt(0) == " ")
		retValue = retValue.substring(1, retValue.length);

	while(retValue.charAt(retValue.length-1) == " ")
		retValue = retValue.substring(retValue, retValue.length-1);

	return retValue;
}

// Removes white space from the beginning of a string
String.prototype.ltrim = function()
{
	var retValue = this;
	while(retValue.charAt(0) == "")
		retValue = retValue.substring(1, retValue.length);
		
	return retValue;
}

// Removes white space from the end of a string
String.prototype.rtrim = function()
{
	var retValue = this;
	while(retValue.charAt(retValue.length-1) == " ")
		retValue = retValue.substring(retValue, retValue.length-1);
		
	return retValue;
}

// Replaces all instances of the specified substring in a string with a specified substring
String.prototype.replace = function(string1, string2)
{
	var retValue = this;
	retValue = retValue.split(string1).join(string2);
	return retValue;
}
