<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<script type="text/javascript">
	function toggleClass(el, class1, class2) {
	    el.className = (el.className == class1) ? class2 : class1;}
	function look(type){
		param=document.getElementById(type);
		if(param.style.display == "none") param.style.display = "block";
		else param.style.display = "none"
	}
</script>

<div class="catalog-section-list">
<ul class="cat-level-0">
<?
$CURRENT_DEPTH=$arResult["SECTION"]["DEPTH_LEVEL"]+1;
foreach($arResult["SECTIONS"] as $key => $arSection):
	$this->AddEditAction($arSection['ID'], $arSection['EDIT_LINK'], CIBlock::GetArrayByID($arSection["IBLOCK_ID"], "SECTION_EDIT"));
	$this->AddDeleteAction($arSection['ID'], $arSection['DELETE_LINK'], CIBlock::GetArrayByID($arSection["IBLOCK_ID"], "SECTION_DELETE"), array("CONFIRM" => GetMessage('CT_BCSL_ELEMENT_DELETE_CONFIRM')));
	
	if($CURRENT_DEPTH<$arSection["DEPTH_LEVEL"])
		echo '<ul class="cat-level-'.$CURRENT_DEPTH.'">';
	elseif($CURRENT_DEPTH>$arSection["DEPTH_LEVEL"])
		echo str_repeat("</div></div></li></ul>", $CURRENT_DEPTH - $arSection["DEPTH_LEVEL"]);
	elseif( $key!=0)
		echo "</div></div></li>";
	$CURRENT_DEPTH = $arSection["DEPTH_LEVEL"];
	?>
	<li id="<?=$this->GetEditAreaId($arSection['ID']);?>" <?if($CURRENT_DEPTH>$arResult["SECTIONS"][$key+1]["DEPTH_LEVEL"]):?>class="last"<?endif?>>
		<div class="product">
			<div class="zagolovok big_font">
				<a class="big" href="<?=$arSection["SECTION_PAGE_URL"]?>">
					<?=$arSection["NAME"]?><?if($arParams["COUNT_ELEMENTS"]):?>&nbsp;(<?=$arSection["ELEMENT_CNT"]?>)<?endif;?>
				</a>
			</div>	
			<?if($CURRENT_DEPTH<$arResult["SECTIONS"][$key+1]["DEPTH_LEVEL"] && $arResult["SECTIONS"][$key+1]):?>		
				<a onclick="toggleClass(this, 'main_ss', 'main_ss1')" id="strelka<?=$arSection['ID']?>" <?if($arSection["DEPTH_LEVEL"]!=1):?>class="main_ss"<?else:?>class="main_ss1"<?endif?> href="javascript:look('subProducts<?=$arSection['ID']?>');"></a>
			<?endif?>
			<div <?if($arSection["DEPTH_LEVEL"]!=1):?>style="display:none;"<?endif?> id="subProducts<?=$arSection['ID']?>" class="vipad">
					<?/*$APPLICATION->IncludeComponent(
						"bitrix:catalog.section",
						"section_inner",
						Array(
							"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
							"IBLOCK_ID" => $arParams["IBLOCK_ID"],
							"ELEMENT_SORT_FIELD" => $arParams["ELEMENT_SORT_FIELD"],
							"ELEMENT_SORT_ORDER" => $arParams["ELEMENT_SORT_ORDER"],
					 		"PROPERTY_CODE" => $arParams["LIST_PROPERTY_CODE"],
							"META_KEYWORDS" => $arParams["LIST_META_KEYWORDS"],
							"META_DESCRIPTION" => $arParams["LIST_META_DESCRIPTION"],
							"BROWSER_TITLE" => $arParams["LIST_BROWSER_TITLE"],
							"INCLUDE_SUBSECTIONS" => "N",
							"BASKET_URL" => $arParams["BASKET_URL"],
							"ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"],
							"PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"],
							"SECTION_ID_VARIABLE" => $arParams["SECTION_ID_VARIABLE"],
							"FILTER_NAME" => $arParams["FILTER_NAME"],
							"DISPLAY_PANEL" => $arParams["DISPLAY_PANEL"],
							"CACHE_TYPE" => $arParams["CACHE_TYPE"],
							"CACHE_TIME" => $arParams["CACHE_TIME"],
							"CACHE_FILTER" => $arParams["CACHE_FILTER"],
							"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
							"SET_TITLE" => $arParams["SET_TITLE"],
							"SET_STATUS_404" => $arParams["SET_STATUS_404"],
							"DISPLAY_COMPARE" => $arParams["USE_COMPARE"],
							"PAGE_ELEMENT_COUNT" => $arParams["PAGE_ELEMENT_COUNT"],
							"LINE_ELEMENT_COUNT" => $arParams["LINE_ELEMENT_COUNT"],
							"PRICE_CODE" => $arParams["PRICE_CODE"],
							"USE_PRICE_COUNT" => $arParams["USE_PRICE_COUNT"],
							"SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"],
					
							"PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"],
					
							"DISPLAY_TOP_PAGER" => $arParams["DISPLAY_TOP_PAGER"],
							"DISPLAY_BOTTOM_PAGER" => $arParams["DISPLAY_BOTTOM_PAGER"],
							"PAGER_TITLE" => $arParams["PAGER_TITLE"],
							"PAGER_SHOW_ALWAYS" => "N",
							"PAGER_TEMPLATE" => $arParams["PAGER_TEMPLATE"],
							"PAGER_DESC_NUMBERING" => $arParams["PAGER_DESC_NUMBERING"],
							"PAGER_DESC_NUMBERING_CACHE_TIME" => $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"],
							"PAGER_SHOW_ALL" => $arParams["PAGER_SHOW_ALL"],
					
							"SECTION_ID" => $arSection['ID'],
							"SECTION_CODE" =>"",
							"SECTION_URL" =>  $arParams["SECTION_URL"],
							"DETAIL_URL" => $arParams["DETAIL_URL"],
						),
						false
					);*/
				?>			
<?endforeach?>
<?if($CURRENT_DEPTH>=1)
	echo str_repeat("</div></div></li></ul>", $CURRENT_DEPTH);?>
</div>
