String.prototype.trim = function() { // Use a regular expression to replace leading and trailing // spaces with the empty string return this.replace(/(^\s*)|(\s*$)/g, ""); }; function getValue(node) { return document.getElementById(node).firstChild.nodeValue; }; function setValue(node, val) { document.getElementById(node).firstChild.nodeValue = val; };