// Origin: http://www.evocomp.de/beispiele/javascript/trim.html

if ( String.prototype.ltrim == null ) {
	String.prototype.ltrim = function ( clist ) {
		if ( clist ) {
			return this.replace ( new RegExp ( '^[' + clist + ']+' ) , '' );
		}
		return this.replace ( /^\s+/ , '' );
	};
}
if ( String.prototype.rtrim == null ) {
	String.prototype.rtrim = function ( clist ) {
  	if ( clist ) {
	    return this.replace ( new RegExp ( '[' + clist + ']+$' ) , '' );
		}
	  return this.replace ( /\s+$/ , '' );
	};
}
if ( String.prototype.trim == null ) {
	String.prototype.trim = function ( clist ) {
  	if ( clist ) {
    	return this.ltrim ( clist ).rtrim ( clist );
		}	
  	return this.ltrim ().rtrim ();
	};
}