function IsSubItemsChecked( nDivId)
{
	var bChecked = false;
	var arItems;
	var div;
	div = GetIdItem( nDivId, null);
	if ( div)
	{
		arItems = div.getElementsByTagName( 'input');
		for (var i=0; ((!bChecked)&&(i<arItems.length)); i++) 
		{
			if ( arItems[i].checked)
				bChecked = true;
		}
	}
	return bChecked;
}

function OnClickCheckBoxInDiv( nDivId, strCheckedClassName, strUnCheckedClassName)
{
  var strClassName;
	strClassName = strUnCheckedClassName;
  if ( IsSubItemsChecked( nDivId))
  {
		strClassName = strCheckedClassName;
	}
	SetClassNameById( nDivId, strClassName);
	return true;
}

function SetClassForCheckBoxLabel( item, strCheckedClassName, strUnCheckedClassName)
{
	if ( item)
	{
		var strClassName = strUnCheckedClassName;
		if ( item.checked)
			strClassName = strCheckedClassName;
		SetClassName( item.nextSibling, strClassName);
	}
	return true;
}

function OnClickSetClassForCheckBoxLabel( strName, strCheckedClassName, strUnCheckedClassName)
{
	var item = GetFirstItemByName( strName, null);
	SetClassForCheckBoxLabel( item, strCheckedClassName, strUnCheckedClassName)
	return true;
}
