Example of why and how to add functionality to a JavaScript object. See: http://stackoverflow.com/a/2308157
// IE 8 is a "special needs" browser.
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}