String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function classAdd(element, theclass) {
	// Add a CSS class to the specified element (will not add the class if it already exists)
	if (!element) return;
	if (!element.className) element.className = '';
	var reg = new RegExp('(^| )'+theclass+'( |$)', 'g');
	if (element.className.search(reg) == -1) element.className = (element.className + ' ' + theclass).trim();
}

function classRemove(element, theclass) {
	// Remove a CSS class from the specified element
	if (!element) return;
	if (!element.className) return;
	var reg = new RegExp('(^| )'+theclass+'( |$)', 'g');
	element.className = element.className.replace(reg, ' ').trim();
}




