<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru" dir="ltr">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% set title = block('title') %}
        {% set subtitle = block('subtitle') %}
        {% set title_extra = block('title_extra') %}
        {% set breadcrumbs2 = block('breadcrumbs') %}
        {% set body = block('body') %}
        {% set links_top = links('top') %}
        {% set links_side = links('side') %}
        {% set links_side2 = links('side2') %}
        {% set ad_articles_links = adArticlesLinks() %}
        {% set is_main = (title == '') %}
        {% set is_yandex_news_referer = isYandexNewsReferer() %}
        {% set is_user_logged_in = isUserLoggedIn() %}
        {% if not getDisableYandexAds() %}
        {% set is_show_yandex_direct_top = isShowYandexDirect('top') %}
        {% set is_show_yandex_direct_bottom = isShowYandexDirect('bottom') %}
        {% set is_show_yandex_direct_side = isShowYandexDirect('side') %}
        {% set is_show_yandex_direct_content = isShowYandexDirect('content') %}
        {% else %}
        {% set is_show_yandex_direct_top = false %}
        {% set is_show_yandex_direct_bottom = false %}
        {% set is_show_yandex_direct_side = false %}
        {% set is_show_yandex_direct_content = false %}
        {% endif %}
        {% set search_yandex_searchid = 168493 %}
        {% set search_yandex_text = yandexSearchText() %}
        {% set mobile_device_dialog = mobileDeviceDialog() %}
        {% set banner_right_bottom = getLangVar('page', 'banner_right_bottom', '') %}
        {% set right_top = getLangVar('page', 'right_top', '') %}
        
        {# Yandex ads #}
        {% set yandex_direct_top = '' %}
        {% set yandex_bottom_top = '' %}
        {% set yandex_side_top = '' %}
        {% if is_show_yandex_direct_top %}
        {% set yandex_direct_top = yandexBlock('top') %}
        {% endif %}
        {% if is_show_yandex_direct_bottom %}
        {% set yandex_direct_bottom = yandexBlock('bottom') %}
        {% endif %}
        {% if is_show_yandex_direct_side %}
        {% set yandex_direct_side = yandexBlock('side') %}
        {% endif %}
        
        <title>{% if title %}{{ title|raw }}{% if title_extra %} << {{ title_extra }}{% endif %} | {% endif %}Дебри-ДВ</title>
        
        <link href="{{ asset('css/page_m.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ asset('css/global_m.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ asset('css/bbcode_m.css') }}" rel="stylesheet" type="text/css" />     
        {% block css %}{% endblock %}
        
        <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" type="image/x-icon" />
        <link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon" />
        
        <script src="{{ asset('jquery-ui/js/jquery-1.9.1.js') }}" type="text/javascript"></script>   
        <script src="{{ asset('js/md5.js') }}" type="text/javascript"></script>
        <script src="{{ asset('js/cookie.js') }}" type="text/javascript"></script>
        <script src="{{ asset('js/functions.js') }}" type="text/javascript"></script>
        <script src="{{ asset('js/swf_object.js') }}" type="text/javascript"></script>        
        {% block js %}{% endblock %}
       
    </head>
    <body>
    
<div id="head">
    <div id="logo"> 
        <a href="{{ path('main_m') }}" title="Дебри-ДВ">Дебри-ДВ</a>
    </div>
    <div id="logo-mobile"> 
        мобильная версия
    </div>
    <div id="plus16">
        <img src="{{ asset('images/16plus3.png') }}" width="40" height="40" alt="16+" />
    </div>  

    <div id="search">
        <table border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="left" valign="top" id="search-query">
                    <div id="search-form">
                        <form action="{{ path('search_m') }}" method="get">
                            <div><input type="hidden" name="searchid" value="{{ search_yandex_searchid }}" /></div>
                            <div id="search-input-wrapper"><input type="text" name="text" value="{{ search_yandex_text }}" id="search-input" /></div>
                            <div id="search-submit-wrapper"><input type="image" name="submit" value="Искать" src="{{ asset('images/search_m2.png') }}" id="search-submit" /></div>
                        </form>
                    </div>
                </td>
                <td align="left" valign="top" id="search-type-select">
                    <select name="search_type">
                        <option value="inner">внутренний</option>
                        <option value="yandex">Yandex</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    <div id="search-advanced">
        <a href="{{ path('search_m', {type: 'advanced'}) }}">расширенный</a>
    </div>    
    
    {{ menuTop()|raw }}
    {{ userBlock()|raw }}    
</div>

{% if is_main %}
<div id="main">

    {% if links_top %}
    <div id="sape-main" class="sape">
        {{ links_top|raw }}
    </div>
    {% endif %} 

    {{ traceOutput()|raw }}
    {{ messagesOutput()|raw }}
    {{ body|raw }}
</div>
{% else %}

<div id="middle">

    {% if title %} 
    <div id="content-title">{{ title|raw }}</div>
    {% endif %}
    
            
    {% if subtitle %}
    <h2 id="content-subtitle">{{ subtitle }}</h2>
    {% endif %}
    
    {% if links_top %}
    <div id="sape-top" class="sape">
        {{ links_top|raw }}
    </div>
    {% endif %}   
    
    <div id="content">
    
        {{ mobile_device_dialog|raw }}
    
        {% if not is_yandex_news_referer and is_show_yandex_direct_top %}
        {{ yandex_direct_top|raw }}
        {#
        <div class="yandex-before-content">
            <!-- Яндекс.Директ -->
            <script type="text/javascript">
            yandex_partner_id = 127969;
            yandex_site_bg_color = 'FFFFFF';
            yandex_ad_format = 'direct';
            yandex_font_size = 1;
            yandex_direct_type = 'vertical';
            yandex_direct_border_type = 'block';
            yandex_direct_limit = 2;
            yandex_direct_title_font_size = 3;
            yandex_direct_header_bg_color = 'FEEAC7';
            yandex_direct_border_color = 'FFFFFF';
            yandex_direct_title_color = '0000CC';
            yandex_direct_url_color = '006600';
            yandex_direct_text_color = '000000';
            yandex_direct_hover_color = '0066FF';
            yandex_direct_favicon = true;
            yandex_no_sitelinks = false;
            document.write('<scr'+'ipt type="text/javascript" src="//an.yandex.ru/system/context.js"></scr'+'ipt>');
            </script>
        </div>
        #}
        {% endif %}
        
        {% if links_side %}
        <div id="sape-side" class="sape">
            {{ links_side|raw }}
        </div>
        {% endif %}
        
        {% if ad_articles_links %}
        <div class="ad-articles-links" id="ad-articles-links">
        {{ ad_articles_links|raw }}
        </div>
        {% endif %}   
         
        {#
        <?php if (!$is_yandex_news_referer): ?>
        <?php $yandex_before_content = $UserLangRegistry->getVar('page', 'yandex_before_content', ''); ?>
        <?php if (!empty($yandex_before_content)): ?>
        <div class="yandex-before-content">
            <?php echo $yandex_before_content ?>
        </div>
        <?php endif; ?>  
        <?php endif; ?>
        #}
        
        {#
        <?php if (!empty($breadcrumbs)): ?> 
        <div class="breadcrumbs">
            <?php foreach ($breadcrumbs as $i => $b): ?>
            <?php echo ($i > 0) ? ' >> ' : '' ?>
            <?php if (!empty($b['link'])): ?>
            <?php echo '<a href="'.htmlspecialchars($b['link']).'">'.$b['title'].'</a>'; ?>
            <?php else: ?>
            <?php echo $b['title'] ?>
            <?php endif; ?>
            <?php endforeach; ?>
        </div>
        <?php endif; ?>
        #}
        
        {{ traceOutput()|raw }}
        {{ messagesOutput()|raw }}
        {% if breadcrumbs2 %}
        <div class="breadcrumbs">
            {{ breadcrumbs2|raw }}
        </div>
        {% endif %}
        
        {% if links_side2 %}
        <div id="sape-side2" class="sape">
            {{ links_side2|raw }}
        </div>
        {% endif %}
        
        {{ body|raw }}        
        
        {% if is_show_yandex_direct_bottom %}
        {{ yandex_direct_bottom|raw }}
        {#
        <div class="yandex-under-content">
            <!-- Яндекс.Директ -->
            <script type="text/javascript">
            yandex_partner_id = 127969;
            yandex_site_bg_color = 'FFFFFF';
            yandex_ad_format = 'direct';
            yandex_font_size = 1;
            yandex_direct_type = 'vertical';
            yandex_direct_limit = 3;
            yandex_direct_title_font_size = 3;
            yandex_direct_header_bg_color = 'FEEAC7';
            yandex_direct_title_color = '0000CC';
            yandex_direct_url_color = '006600';
            yandex_direct_text_color = '000000';
            yandex_direct_hover_color = '0066FF';
            yandex_direct_favicon = true;
            yandex_no_sitelinks = false;
            document.write('<scr'+'ipt type="text/javascript" src="//an.yandex.ru/system/context.js"></scr'+'ipt>');
            </script>        
        </div>
        #}
        {% endif %}
        
        {% block similar %}{% endblock %} 
        
        {% block similar_forum_topics %}{% endblock %}

        
        {#
        <?php $yandex_under_content = $UserLangRegistry->getVar('page', 'yandex_under_content', ''); ?>
        <?php if (!empty($yandex_under_content)): ?>
        <div class="yandex-under-content">
            <?php echo $yandex_under_content ?>
        </div>
        <?php endif; ?>
        #}
        
    </div>             
           
    <div id="right-column">
    
        {% if links_side %}
        <div class="sape" id="sape-side">
        {{ links_side|raw }}
        </div>
        {% endif %}
        
        {% if right_top %}
        <div class="right-top" id="right-top">
        {{ right_top|raw }}
        </div>
        {% endif %}
        
        {% set short_news_block = shortNewsBlock() %}        
        {% if short_news_block %}
        <div class="block" id="block-short-news">
            <div class="block-title">
                {{ getLangVar('page', 'short_news_block_title', 'News')|raw }}
            </div>
            <div class="block-content">
            {{ short_news_block|raw }}
            </div>
        </div>    
        {% endif %}
        
        {% set bloggers_block = bloggersBlock() %}        
        {% if bloggers_block %}
        <div class="block" id="block-bloggers">
            <div class="block-title">
                Из блогов
            </div>
            <div class="block-content">
            {{ bloggers_block|raw }}
            </div>
        </div>    
        {% endif %}
        
        {% if links_side2 %}
        <div class="sape" id="sape-side2">
        {{ links_side2|raw }}
        </div>
        {% endif %}
        
        {% set forum_block = forumBlock() %}        
        {% if forum_block %}
        <div class="block" id="block-forum">
            <div class="block-title">
                Новое на форуме
            </div>
            <div class="block-content">
            {{ forum_block|raw }}
            </div>
        </div>    
        {% endif %}
        
        {% set polls_block = pollsBlock() %}        
        {% if polls_block %}
        <div class="block" id="block-polls">
            <div class="block-title">
                Опрос
            </div>
            <div class="block-content">
            {{ polls_block|raw }}
            </div>
        </div>    
        {% endif %}
        
        {% set tags_block = tagsBlock() %}        
        {% if tags_block %}
        <div class="block" id="block-tags">
            <div class="block-title">
                Облако тегов
            </div>
            <div class="block-content">
            {{ tags_block|raw }}
            </div>
        </div>    
        {% endif %}
        
        {% if is_show_yandex_direct_side %}
        <div class="yandex-before-persons block">
            {{ yandex_direct_side|raw }}
            {#
            <!-- Яндекс.Директ -->
            <script type="text/javascript">
            yandex_partner_id = 127969;
            yandex_site_bg_color = 'FFFFFF';
            yandex_ad_format = 'direct';
            yandex_font_size = 1;
            yandex_direct_type = 'vertical';
            yandex_direct_limit = 2;
            yandex_direct_title_font_size = 3;
            yandex_direct_header_bg_color = 'FEEAC7';
            yandex_direct_title_color = 'E9E4E0';
            yandex_direct_url_color = 'E9E4E0';
            yandex_direct_text_color = 'FFFFFF';
            yandex_direct_hover_color = '0066FF';
            yandex_direct_favicon = true;
            yandex_no_sitelinks = false;
            document.write('<scr'+'ipt type="text/javascript" src="//an.yandex.ru/system/context.js"></scr'+'ipt>');
            </script>        
            #}
        </div>
        {% endif %}         
        
        {#
        {% block similar %}{% endblock %}        
        #}
        
        {% if banner_right_bottom %}
        <div class="banner-right-bottom">
            {{ banner_right_bottom|raw }}
        </div>
        {% endif %}         

        
        <div class="rss-block">
            <a href="{{ path('rss') }}" title="RSS"><img width="36" height="14" alt="RSS" src="{{ asset('images/rss.gif') }}" border="0" /></a>
        </div> 
    
    </div>            
    
    
</div>

{% endif %}   

<div id="footer">
    <noindex>
    {{ getConfigVar('footer')|raw }}
    </noindex>
    <div id="counters">
    <noindex>
    {{ getConfigVar('counters')|raw }}
    </noindex>
    </div>
    {#
    <div id="banners">
    <noindex>
    {{ getConfigVar('banners')|raw }}
    </noindex>
    </div>
    #}
</div>

<script type="text/javascript">
function create_menu_top_icon_shadows() {
    $('.menu-top-icon-shadow').remove();
    $('.menu-top div.menu-top-icon').each(function(i){
        offset = $(this).offset();
        width = $(this).width();
        offset_bg = (offset.left + (width-80)/2);
        id = 'menu-top-icon-shadow-'+i;  
        $('#head').prepend('<div id="'+id+'" class="menu-top-icon-shadow"></div>');    
        $('#'+id).css('left', offset_bg+'px');
    });      
}
menu_item_focus = false;
window.menu_item_show_subitems = false;
window.menu_item_current_subitems_id = '';

function menu_item_show (item) {    
    menuid = $(item).attr('menuid');
    id = 'menu-top-subitems-'+menuid;
    //alert('prev: '+window.menu_item_current_subitems_id+', current:'+id);
    //alert(id);
    if (window.menu_item_current_subitems_id != id) {
        //$('.menu-top-subitems').css('display', 'none');
    }
    if ($('#'+id).css('display') == 'none') {
        $('.menu-top-subitems').css('display', 'none');
        window.menu_item_current_subitems_id = id;
        offset = $(item).offset();            
        $('#'+id).css('display', '');
        $('#'+id).css('left', offset.left);
    }
}
function menu_item_hide () {
    if (!window.menu_item_show_subitems) {
        //alert('hide');
        window.menu_item_current_subitems_id = '';
        $('.menu-top-subitems').css('display', 'none');
    }
} 
$('.menu-top-icon').hover(function(){    
    window.menu_item_show_subitems = true; 
    menu_item_show(this);
}, function(){
    window.menu_item_show_subitems = false;      
    setTimeout(menu_item_hide, 500);
});
$('.menu-top-title').hover(function(){
    window.menu_item_show_subitems = true;     
    menu_item_show(this);
}, function(){
    window.menu_item_show_subitems = false;      
    setTimeout(menu_item_hide, 500);
});
$('.menu-top-subitems').hover(function(){    
    window.menu_item_show_subitems = true; 
}, function(){
    window.menu_item_show_subitems = false;      
    setTimeout(menu_item_hide, 500);
});

// Переход по разделу меню
$('#menu-top-select').change(function(){
    url = $('#menu-top-select').val();
    if (url != '') {
        window.location.href = url;
    }
});
$('#menu-user').change(function(){
    url = $('#menu-user').val();
    if (url != '') {
        window.location.href = url;
    }
});
$('#menu-user').change(function(){
    url = $('#menu-user').val();
    if (url != '') {
        window.location.href = url;
    }
});
$('.user-login-input-login input').focusin(function(){
    $('.user-login-label-login').hide();
});
$('.user-login-input-login input').focusout(function(){   
    value = $(this).val();
    if (value == '') {
        $('.user-login-label-login').show(); 
    }
});
$('.user-login-input-pass input').focusin(function(){
    $('.user-login-label-pass').hide();
});
$('.user-login-input-pass input').focusout(function(){   
    value = $(this).val();
    if (value == '') {
        $('.user-login-label-pass').show(); 
    }
});


function set_search_type (type, force_select) {
    if (force_select) {
        $('#search-type-select select').val(type);
    }    
    if (type == 'inner') {            
        $('#search-form form').attr('action', '{{ path('search_m') }}');
    } else {
        $('#search-form form').attr('action', '{{ path('search_yandex_m') }}');
    }
}

$(document).ready(function(){
    // Если нет поискового запроса, пишем слово "Поиск"
    if ($('#search-input').val() == '') {
        $('#search-input').val('Поиск');
        $('#search-input').addClass('search-input-label');
    }
    $("#search-input").focus(function() {
        if ($('#search-input').val() == 'Поиск') {
            $('#search-input').val('');
            $('#search-input').removeClass('search-input-label');
        }
    });
    // Смена типа поиска
    search_type = $.cookie('search_type');    
    //alert(search_type);
    if (search_type != null) {
        set_search_type(search_type, true);
    }  
    $('#search-type-select select').change(function(){
        type = $(this).val();
        if (type != null) {
            set_search_type(type, false);
        }
        $.cookie('search_type', type, { path: '/' });
    });    
    window_width = parseInt($(window).width());
    head_width = parseInt($('#head').width());
    //alert(window_width);
    $.cookie('width', window_width, { path: '/', expires: 31 });
    //alert('document_width: '+document_width+', window_width: '+window_width);
    
    // Уменьшение размеров всех картинок
    $('.article-body img').each(function(){
        image_width = parseInt($(this).width());
        image_height = parseInt($(this).height());
        k = (window_width - 40) / image_width;
        //alert(window_width+', '+image_width+', '+k);
        if (k < 1) {        
            $(this).attr('width', image_width*k);
            $(this).attr('height', image_height*k);
        }
    });
    
});
$(window).resize(function(){
    create_menu_top_icon_shadows();
});
</script>

{% if not is_user_logged_in and not is_main %}
<!-- SAPE RTB DIV 240x400 -->
<div id="SRTB_80547"></div>
<!-- SAPE RTB END -->
{% endif %}

{#
<script async="async" src="https://w.uptolike.com/widgets/v1/zp.js?pid=1268470" type="text/javascript"></script>               
#}

<script async="async" src="https://w.uptolike.com/widgets/v1/zp.js?pid=1640394" type="text/javascript"></script>
      
        {% block javascripts %}{% endblock %}
    </body>
</html>

