function classSwitch(obj,fromClass,toClass)
{
	removeClass(obj,fromClass);
	addClass(obj,toClass);

	obj.style.cursor="pointer";
}
	
// Adds a new class to an object without losing any of the existing classes.
function addClass(obj, newClassName) {
	if (typeof obj == "string") {
		obj=document.getElementById(obj);
	}
	if (typeof obj == "undefined") return false;
	if (obj==null) return false;
	
	// If there is no existing className, simply write it in.
	if ( (typeof obj.className=="undefined") || (obj.className==null) || (obj.className=="") ) {
		obj.className=newClassName;
	} else {
		if (containsClassName(obj, newClassName)==false) {
			obj.className+=" "+newClassName;
		}
	}
	return true;
}

// Removes a class from an object without affecting any other classes it might have.
function removeClass(obj, classNameToRemove) {
	if (typeof obj == "string") {
		obj=document.getElementById(obj);
	}
	if (typeof obj == "undefined") return null;
	if (obj==null) return null;
	
	// Build a regular expression to match "[word boundary]newClassName[word boundary]" 
	//plus versions with preceeding and post spacing.
	regMatchNoSpace=new RegExp("\\b"+classNameToRemove+"\\b", "gi");
	regMatchPreSpace=new RegExp("\\s"+classNameToRemove+"\\b", "gi");
	regMatchPostSpace=new RegExp("\\b"+classNameToRemove+"\\s", "gi");
	
	// If there is no existing className, nothing needs removing.
	if ( (typeof obj.className=="undefined") || (obj.className==null) || (obj.className=="") ) {
		return;
	} else {
		obj.className=obj.className.replace(regMatchPreSpace, "");
		obj.className=obj.className.replace(regMatchPostSpace, "");
		obj.className=obj.className.replace(regMatchNoSpace, "");
	}
}

