/**
 * C4U Javascript library for trees.
 * 
 * Copyright (c) 1999-2010 by Community4you GmbH
 */

/**
 * Removes all toggle classes from the tree.
 * 
 * @param theTreeID the id of the tree
 * @param theActiveID the id of the active element 
 * @param theClass the class to add / remove
 * @param theSelectedImgClass the selected image class
 * @param theSelectedImgAddClass the selected image add class
 * @param theNotSelectedImgClass the selected image class
 * @param theNotSelectedImgRemoveClass the selected image remove class
 */
function removeToggleClassFromTree(theTreeID, theActiveID, theClass, 
    theSelectedImgClass, theSelectedImgAddClass,
    theNotSelectedImgClass, theNotSelectedImgRemoveClass)
{
  if (!theTreeID)
    return;
  
  jQuery('#' + theTreeID).find('.' + theClass ).each(function(theElement) 
      {
        var _el = jQuery(this);
    
        if (!theActiveID || (_el.attr('id') != theActiveID))
        {
          _el.removeClass(theClass);
          
          if (theSelectedImgClass)
            _el.find('.' + theSelectedImgClass).addClass(theSelectedImgAddClass);
          if (theNotSelectedImgClass)
            _el.find('.' + theNotSelectedImgClass).removeClass(theNotSelectedImgRemoveClass);
        }        
      });
}