function trim(str) {
     return str.replace(/^\s*/,'').replace(/\s*$/,'');
}
