<?if(!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();?>
<?$this->setFrameMode(true);?>
<?
// get element
$arItemFilter = CScorp::GetCurrentElementFilter($arResult['VARIABLES'], $arParams);
$arElement = CCache::CIblockElement_GetList(array('CACHE' => array('TAG' => CCache::GetIBlockCacheTag($arParams['IBLOCK_ID']), 'MULTI' => 'N')), $arItemFilter, false, false, array('ID', 'NAME', 'PREVIEW_TEXT','DETAIL_PICTURE','DETAIL_PAGE_URL','DETAIL_TEXT', 'PREVIEW_PICTURE', 'PROPERTY_FIRST_SCREEN', 'PROPERTY_BLOCKS','PROPERTY_FAQ','PROPERTY_SCHEME', 'PROPERTY_TABLE_PRICE', 'PROPERTY_ADVANTAGES','PROPERTY_TITLE_ADVANTAGES', 'PROPERTY_ACTIONS','IBLOCK_SECTION_ID'));
$arSection = CCache::CIblockSection_GetList(array("CACHE" => array("TAG" => CCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]), "MULTI" => "N")), array('ID' => $arElement['IBLOCK_SECTION_ID']), false, array('ID','NAME'), true);

$isTitle = false;
?>
<?if(!$arElement && $arParams['SET_STATUS_404'] !== 'Y'):?>
	<div class="alert alert-warning"><?=GetMessage("ELEMENT_NOTFOUND")?></div>
<?elseif(!$arElement && $arParams['SET_STATUS_404'] === 'Y'):?>
	<?CScorp::goto404Page();?>
<?else:?>
	<?// rss
    $component->__template->addExternalJS(SITE_TEMPLATE_PATH . '/js/accordion.min.js');
	if($arParams['USE_RSS'] !== 'N'){
		CScorp::ShowRSSIcon($arResult['FOLDER'].$arResult['URL_TEMPLATES']['rss']);
	}?>
	<?CScorp::AddMeta(
		array(
			'og:description' => $arElement['PREVIEW_TEXT'],
			'og:image' => (($arElement['PREVIEW_PICTURE'] || $arElement['DETAIL_PICTURE']) ? CFile::GetPath(($arElement['PREVIEW_PICTURE'] ? $arElement['PREVIEW_PICTURE'] : $arElement['DETAIL_PICTURE'])) : false),
		)
	);
    if($arSection["NAME"]) {
        $APPLICATION->AddChainItem($arSection["NAME"], $arResult["FOLDER"] . $arResult["VARIABLES"]["SECTION_CODE_PATH"] . '/');
    }
    $APPLICATION->AddChainItem($arElement['NAME'], $arElement['DETAIL_PAGE_URL']);
	?>
    </div>
	 <div class="first-screen-wrapper">
        <div class="maxwidth-theme">
            <? $APPLICATION->IncludeComponent("bitrix:breadcrumb", "corp", array(
                "START_FROM" => "0",
                "PATH" => "",
                "SITE_ID" => SITE_ID
            ),
                false
            );


            if($arElement['PROPERTY_FIRST_SCREEN_VALUE']) {
                //первый экран
                $APPLICATION->IncludeComponent(
                    "bitrix:news.detail",
                    "banner-service",
                    array(
                        "ACTIVE_DATE_FORMAT" => "d.m.Y",
                        "ADD_ELEMENT_CHAIN" => "N",
                        "ADD_SECTIONS_CHAIN" => "N",
                        "AJAX_MODE" => "N",
                        "AJAX_OPTION_ADDITIONAL" => "",
                        "AJAX_OPTION_HISTORY" => "N",
                        "AJAX_OPTION_JUMP" => "N",
                        "AJAX_OPTION_STYLE" => "N",
                        "BROWSER_TITLE" => "-",
                        "CACHE_GROUPS" => "N",
                        "CACHE_TIME" => "36000000",
                        "CACHE_TYPE" => "A",
                        "CHECK_DATES" => "Y",
                        "DETAIL_URL" => "",
                        "DISPLAY_BOTTOM_PAGER" => "Y",
                        "DISPLAY_DATE" => "Y",
                        "DISPLAY_NAME" => "Y",
                        "DISPLAY_PICTURE" => "Y",
                        "DISPLAY_PREVIEW_TEXT" => "Y",
                        "DISPLAY_TOP_PAGER" => "N",
                        "ELEMENT_CODE" => "",
                        "ELEMENT_ID" => $arElement['PROPERTY_FIRST_SCREEN_VALUE'],
                        "FIELD_CODE" => array("ID", "PREVIEW_PICTURE"),
                        "IBLOCK_ID" => "31",
                        "IBLOCK_TYPE" => "info",
                        "IBLOCK_URL" => "",
                        "INCLUDE_IBLOCK_INTO_CHAIN" => "N",
                        "MESSAGE_404" => "",
                        "META_DESCRIPTION" => "-",
                        "META_KEYWORDS" => "-",
                        "PAGER_BASE_LINK_ENABLE" => "N",
                        "PAGER_SHOW_ALL" => "N",
                        "PAGER_TEMPLATE" => ".default",
                        "PAGER_TITLE" => "Страница",
                        "PROPERTY_CODE" => array("PRICE", "TITLE_PHOTO"),
                        "SET_BROWSER_TITLE" => "N",
                        "SET_CANONICAL_URL" => "N",
                        "SET_LAST_MODIFIED" => "N",
                        "SET_META_DESCRIPTION" => "N",
                        "SET_META_KEYWORDS" => "N",
                        "SET_STATUS_404" => "N",
                        "SET_TITLE" => "N",
                        "SHOW_404" => "N",
                        "STRICT_SECTION_CHECK" => "N",
                        "USE_PERMISSIONS" => "N",
                        "USE_SHARE" => "N"
                    )
                );
            }else{
                $isTitle = true;?>
                <article class="service-description">
                    <h1 class="title-block underline"><?php echo $arElement['NAME']?></h1>
                    <div class="service-description__text"><?php echo $arElement['DETAIL_TEXT'] ?></div>
                </article>
            <?}?>
        </div>
    </div>
    <div class="maxwidth-theme">

        <?php //Блоки
        $APPLICATION->IncludeFile(SITE_DIR . "include/blocks.php",
            array_merge($arParams,
                array(
                    'arResult' => $arResult,
                    'ID' => $arElement["ID"],
                    'HIDE_BLOCKS' => $arElement["PROPERTY_BLOCKS_VALUE"],
                    'CONTENT' => !$isTitle ? array('TITLE' => $arElement['NAME'], 'TEXT' => $arElement['DETAIL_TEXT']) : array(),
                    'SCHEME' => $arElement["PROPERTY_SCHEME_VALUE"],
                    'FAQ' => $arElement["PROPERTY_FAQ_VALUE"],
                    'TABLE_PRICE' => $arElement["PROPERTY_TABLE_PRICE_VALUE"],
                    'IS_DETAIL' => true,
                    'ADVANTAGES' => $arElement["PROPERTY_ADVANTAGES_VALUE"],
                    'TITLE_ADVANTAGES' => $arElement["PROPERTY_TITLE_ADVANTAGES_VALUE"],
                    'ACTIONS' => $arElement["PROPERTY_ACTIONS_VALUE"]
                )
            )
        ); ?>
	<?
	if(is_array($arElement['IBLOCK_SECTION_ID']) && count($arElement['IBLOCK_SECTION_ID']) > 1){
		CScorp::CheckAdditionalChainInMultiLevel($arResult, $arParams, $arElement);
	}
	?>
<?endif;?>
<div style="clear:both"></div>
<div class="row">
	<div class="col-md-6 share">
		<?if($arParams["USE_SHARE"] == "Y" && $arElement):?>
			<span class="text"><?=GetMessage('SHARE_TEXT')?></span>
			<script type="text/javascript" src="//yastatic.net/share2/share.js" async="async" charset="utf-8"></script>
			<div class="ya-share2" data-services="vkontakte,facebook,twitter,viber,whatsapp,odnoklassniki,moimir"></div>
		<?endif;?>
	</div>
	<div class="col-md-6">
		<a class="back-url" href="<?=$arResult['FOLDER'].$arResult['URL_TEMPLATES']['news']?>"><i class="fa fa-chevron-left"></i><?=GetMessage('BACK_LINK')?></a>
	</div>
</div>