
if(!String.prototype.trim) {
	String.prototype.trim = function(){
  		return this.replace(/(^\s*)|(\s*$)/gi, "");
	}
}

if(!String.prototype.ltrim) {
	String.prototype.ltrim = function() {
		re = /^\s+/g;
		return this.replace(re, '');
	}
}

if(!String.prototype.rtrim) {
	String.prototype.rtrim = function() {
		re = /\s+$/g;
		return this.replace(re, '');
	}
}


if(!String.prototype.replaceAll) {
    String.prototype.replaceAll = function(source, target) {
        source = source.replace(new RegExp("(\\W)", "g"), "\\$1");
        return this.replace(new RegExp(source, "gm"), target);
    }
}


/*
String.prototype.trim = function() {
  var pattern = !arguments[0] ? /^\s+|\s+$/g
              : new RegExp('^['+arguments[0]+']+|['+arguments[0]+']+$', 'g');
  return this.replace(pattern, '');
  
  //alert('  me rong  '.trim().length)
  //alert('::me:rong::'.trim(':'))
}
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}
*/

