/**
/  ClassManipulation v1.0
/  (c) 2008 Adam Schwartz - http://polymath.mit.edu
/  Licensed under the MIT Licencse
/  http://www.opensource.org/licenses/mit-license.php
/  This is distributed WITHOUT ANY WARRANTY; without even the implied
/  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/* Dependencies: None  */

var ClassManipulation = {
	hasClass: function(objElement, strClass) {
		if (objElement.className) {
			var arrList = objElement.className.split(' ');
			var strClassUpper = strClass.toUpperCase();
			for (var i=0; i<arrList.length; i++) {
				if (arrList[i].toUpperCase() == strClassUpper) {
					return true;
				}
			}
		}
		return false;
	},
	addClass: function(objElement, strClass) {
		if (objElement.className) {
			var arrList = objElement.className.split(' ');
			var strClassUpper = strClass.toUpperCase();
			for (var i=0; i<arrList.length; i++) {
	            if (arrList[i].toUpperCase() == strClassUpper) {
					arrList.splice(i, 1);
					i--;
				}
			}
			arrList[arrList.length] = strClass;
			objElement.className = arrList.join(' ');
		} else {
			objElement.className = strClass;
		}
	},
	removeClass: function(objElement, strClass) {
		if (objElement) {
			var arrList = objElement.className.split(' ');
			var strClassUpper = strClass.toUpperCase();
			for (var i=0; i<arrList.length; i++) {
				if (arrList[i].toUpperCase() == strClassUpper) {
					arrList.splice(i, 1);
					i--;
				}
			}
			objElement.className = arrList.join(' ');
		}
	}
}