<inp2:m_XMLTemplate cache="600"/>
<inp2:m_Get var="page_id" result_to_var="page_id"/>
<inp2:m_Inc param="level" by="1"/>
<inp2:m_Get var="level" result_to_var="level"/>
<inp2:m_Get var="max_level" result_to_var="max_level"/>
<inp2:m_Random result_to_var="rand"/>
<inp2:conf_ConfigValue name="CategoriesRebuildSerial" result_to_var="serial"/>
<menus>
  <menu id="subpages<inp2:m_Param name="page_id"/>"
  		orient="V" showicon="true" showsubicon="true" stlprf=""
  		submenuic="['<inp2:m_TemplatesBase module="In-portal"/>img/arrow_white.gif']">
    <items>
    	<inp2:m_DefineElement name="top_sub_menu_elem" no_editing="1">
				<item id="menu<inp2:m_Param name="page_id"/>" url="<inp2:m_if check="m_Param" name="external_url"><inp2:m_Param name="external_url"/><inp2:m_else/><inp2:m_Link template="$template" m_cat_id="0" m_cat_page="1"/></inp2:m_if>" enb="true"
					<inp2:m_if inverse="1" check="m_ParamEquals" name="level" value="$max_level">
						<inp2:m_if check="m_Param" name="has_sub_menu">
							subid="subpages<inp2:m_Param name="page_id"/>"
							suburl="<inp2:m_link __NO_REWRITE__="1" template="platform/elements/menu_subsections.xml"
								m_cat_id="$cat_id"
								m_cat_page="1"
								page_id="$page_id"
								level="$level" max_level="4"
								rand="$rand" serial="$serial"/>"
						</inp2:m_if>
					</inp2:m_if>
				><![CDATA[<inp2:m_Param name="title"/>]]></item>
			</inp2:m_DefineElement>

			<inp2:st_CachedMenu except="index" menu_id="$page_id" category_id="$cat_id" render_as="top_sub_menu_elem"/>
    </items>
  </menu>
</menus>