String.prototype.trim = function() {
var strTrim = this.replace(/(^/s*)|(/s*$)/g, "");
strTrim = strTrim.replace(/^[/s /t]+|[/s /t]+$/, "");
return strTrim;
}
--------------------------------------------------------------
var str="";
str.trim();