// Add left trim, right trim, and trim functions
if (!String.prototype.lTrim) {
    String.prototype.lTrim = function() { return this.replace(/^\s*/, ''); }
}
if (!String.prototype.rTrim) {
    String.prototype.rTrim = function() { return this.replace(/\s*$/, ''); }
}
if (!String.prototype.trim) {
    String.prototype.trim = function() { return this.lTrim().rTrim(); }
}

// This will remove all whitespace from a string
if (!String.prototype.removeAllWhitespace) {
    String.prototype.removeAllWhitespace = function() { return this.replace(/\s+/g, ''); }
}

// attach multiple listeners to events
function addListener(element, event, listener) {
	if(element.addEventListener)
	{
		element.addEventListener(event, listener, false);
	}
	else if (element.attachEvent)
	{
		element.attachEvent('on'+event, function(){listener.call(element)});
	}
}
