String.prototype.trim=function()
{ return this.leftTrim().rightTrim();
};
String.prototype.leftTrim=function()
{ return this.replace(/^\s*(.*)/,"$1");
};
String.prototype.rightTrim=function()
{ return this.replace(/^(.*\S)(\s*)$/,"$1");
};


