<?php
    $class = null;
    if ($place == 'top') {
        $class = 'yandex-before-content';
    }
    if ($place == 'bottom') {
        $class = 'yandex-under-content';
    }
    if ($place == 'side') {
        $class = 'yandex-before-persons block';
    }
?>
<?php if ($place == 'top'): ?>
        <div class="yandex-before-content" style="float: none;">
            <?php if ($is_rtb): ?>
            <table border="0" cellspacing="0" cellpadding="0" align="left" style="margin-bottom: 10px; float: none; clear: both;">
                <tr>
                    <td align="left" valign="top" style="padding-right: 10px;">
                        
                        <?php
                        /* 
                        if (rand(0,100) > 50) {
                            $file = '1.jpg';
                            $link = 'http://dviu.ranepa.ru';
                        } else {
                            $file = '2.jpg';
                            $link = 'http://dviu.ranepa.ru/Abitur/';
                        }
                        */
                        $file = '1.jpg';
                        $link = 'http://dviu.ranepa.ru/news/?ELEMENT_ID=11896';
                        ?>
                        <noindex>
                        <a href="<?php echo $link; ?>" target="_blank" rel="external nofollow"><img src="<?php echo $view['assets']->getUrl('images/banners/5/'.$file) ?>" width="770" weight="220" alt="РАНХиГС" /></a>
                        </noindex>
                        
                        <?php if (false): ?>                        
                        <!-- Yandex.RTB R-A-127969-1 -->
                        <div id="yandex_rtb_R-A-127969-1" style="max-width: 1000px; overflow-x: hidden"></div>
                        <script type="text/javascript">
                            (function(w, d, n, s, t) {
                                w[n] = w[n] || [];
                                w[n].push(function() {
                                    Ya.Context.AdvManager.render({
                                        blockId: "R-A-127969-1",
                                        renderTo: "yandex_rtb_R-A-127969-1",
                                        async: true
                                    });
                                });
                                t = d.getElementsByTagName("script")[0];
                                s = d.createElement("script");
                                s.type = "text/javascript";
                                s.src = "//an.yandex.ru/system/context.js";
                                s.async = true;
                                t.parentNode.insertBefore(s, t);
                            })(this, this.document, "yandexContextAsyncCallbacks");
                        </script>
                        <?php endif; ?>                         
                    </td>
                    <?php if (is_int($width) ? $width > 1800 : false): ?>
                    <td align="left" valign="top">
                        <!-- Yandex.RTB R-A-127969-3 -->
                        <div id="yandex_rtb_R-A-127969-3" style="max-width: 1000px; overflow-x: hidden"></div>
                        <script type="text/javascript">
                            (function(w, d, n, s, t) {
                                w[n] = w[n] || [];
                                w[n].push(function() {
                                    Ya.Context.AdvManager.render({
                                        blockId: "R-A-127969-3",
                                        renderTo: "yandex_rtb_R-A-127969-3",
                                        async: true
                                    });
                                });
                                t = d.getElementsByTagName("script")[0];
                                s = d.createElement("script");
                                s.type = "text/javascript";
                                s.src = "//an.yandex.ru/system/context.js";
                                s.async = true;
                                t.parentNode.insertBefore(s, t);
                            })(this, this.document, "yandexContextAsyncCallbacks");
                        </script>
                    </td>
                    <?php endif; ?>
                </tr>
            </table>
            <?php else: ?>
            <!-- Яндекс.Директ -->
            <script type="text/javascript">
            yandex_partner_id = 127969;
            yandex_site_bg_color = 'FFFFFF';
            yandex_ad_format = 'direct';
            yandex_font_size = 1;
            yandex_direct_type = '<?php echo !$is_mobile ? 'horizontal' : 'vertical' ?>';
            yandex_direct_border_type = 'block';
            yandex_direct_limit = <?php echo $n ?>;
            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>
            <?php endif; ?>
        </div>
<?php elseif ($place == 'bottom'): ?>
        <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 = '<?php echo !$is_mobile ? 'horizontal' : 'vertical' ?>';
            yandex_direct_limit = <?php echo $n ?>;
            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>
<?php elseif ($place == 'side'): ?>
        <div class="yandex-before-persons">
            <?php if ($is_rtb): ?>
            <!-- Yandex.RTB R-A-127969-2 -->
            <div id="yandex_rtb_R-A-127969-2"></div>
            <script type="text/javascript">
                (function(w, d, n, s, t) {
                    w[n] = w[n] || [];
                    w[n].push(function() {
                        Ya.Context.AdvManager.render({
                            blockId: "R-A-127969-2",
                            renderTo: "yandex_rtb_R-A-127969-2",
                            async: true
                        });
                    });
                    t = d.getElementsByTagName("script")[0];
                    s = d.createElement("script");
                    s.type = "text/javascript";
                    s.src = "//an.yandex.ru/system/context.js";
                    s.async = true;
                    t.parentNode.insertBefore(s, t);
                })(this, this.document, "yandexContextAsyncCallbacks");
            </script>
            <?php else: ?>
            <!-- Яндекс.Директ -->
            <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 = <?php echo $n ?>;
            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>
            <?php endif; ?>        
        </div>
<?php elseif ($place == 'side2'): ?>
        <div class="yandex-before-persons">
            <?php if ($is_rtb): ?>
            <!-- Яндекс.Директ -->            
            <!-- Yandex.RTB R-A-127969-4 -->
            <div id="yandex_rtb_R-A-127969-4"></div>
            <script type="text/javascript">
                (function(w, d, n, s, t) {
                    w[n] = w[n] || [];
                    w[n].push(function() {
                        Ya.Context.AdvManager.render({
                            blockId: "R-A-127969-4",
                            renderTo: "yandex_rtb_R-A-127969-4",
                            async: true
                        });
                    });
                    t = d.getElementsByTagName("script")[0];
                    s = d.createElement("script");
                    s.type = "text/javascript";
                    s.src = "//an.yandex.ru/system/context.js";
                    s.async = true;
                    t.parentNode.insertBefore(s, t);
                })(this, this.document, "yandexContextAsyncCallbacks");
            </script>
            <?php else: ?>
            <!-- Яндекс.Директ -->
            <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 = <?php echo $n ?>;
            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>
            <?php endif; ?>        
        </div>        
<?php elseif ($place == 'content'): ?>
        <div class="yandex-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 = <?php echo $n ?>;
            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>
<?php elseif ($place == 'comment'): ?>
        <div class="yandex-comment">
            <!-- Яндекс.Директ -->
            <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 = <?php echo $n ?>;
            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>
<?php endif; ?>