"Trim" Function

<SCRIPT>

function trim(str) {
     str = str.replace(/^\s+/, ""); // beginning spaces are convert to an empty string

     str = str.replace(/\s+$/, ""); // ending spaces are convert to an empty string

     return(str);
}

</SCRIPT>