


/**********
 *
 * Classes
 *
 **********/



var _CLASSES_JS_ = 0;

{



	 _CLASSES_JS_ = 1;



	/**
	 * Checks if the item has the specified class.<b> 
	 *
	 * @param _item the item to check for, as object.
	 * @param _class the class to check in the _item
	 *
	 * @return true if contains the class
	 */
	function hasClass(_item, _class)
	{
		if (_item != null && _item.className != null && _item.className.length > 0)
		{
			return _item.className.indexOf(_class) != -1;
		}
		else
		{
			return false;
		}
	}
	
	/**
	 * Adds a class to the item.
	 *
	 * @param _item the item to add the class in, as object.
	 * @param _class the class to add
	 */
	function addClass(_item, _class)
	{
		if (_item != null && _item.className.indexOf(_class) == -1)
		{
			_item.className = _item.className + _class;
		}
	}
	
	/**
	 * Removes the specified class, if existing, from the item.
	 *
	 * @param _item the item to delete the class from, as object.
	 * @param _class the class to delete
	 */
	function delClass(_item, _class)
	{
		if (_item != null)
		{
			var i = _item.className.indexOf(_class);
		
			if (i != -1)
			{
				_item.className = _item.className.substring(0, i) + _item.className.substring(i + _class.length, _item.className.length);
		    }
	    }
	}
	
	function getClassParameter(_item, _class)
	{
		if (_item != null)
		{
			var startIndex = _item.className.indexOf(_class) + _class.length;
			var endIndex = _item.className.indexOf(" ", startIndex);
			
			endIndex = endIndex == -1 ? _item.className.length : endIndex;
			
			return _item.className.substring(startIndex, endIndex);
		}
		else
		{
			return "";
		}
	}
	
	function getElementsByClassName(_item, _class, result)
	{
		if (result == null)
		{
			result = new Array();
		}
		
	    if (hasClass(_item, _class))
	    {
	        result[result.length] = _item;
	    }
	    
	    for (var i = 0; i < _item.childNodes.length; i++)
	    {
	        getElementsByClassName(_item.childNodes[i], _class, result);
        }
        
        return result;
	}

}
