<?php
    if(!defined('VALID_CMS')) { die('ACCESS DENIED'); }
    $inUser = cmsUser::getInstance();
	$inPage = cmsPage::getInstance();

    $mod_count['left']     = $inPage->countModules('left');
    $mod_count['sidebar'] = $inPage->countModules('sidebar');

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- HEAD !-->
    <?php $inPage->printHead(); ?>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <?php if($inUser->is_admin){ ?>
    <script src="/admin/js/modconfig.js" type="text/javascript"></script>
    <link href="/templates/news_portal/css/modconfig.css" rel="stylesheet" type="text/css" />
    <?php } ?>

    <script src="/templates/news_portal/js/nyromodal.js" type="text/javascript"></script>

    <link href="/templates/news_portal/css/nyromodal.css" rel="stylesheet" type="text/css" />
    <link href="/templates/news_portal/css/reset.css" rel="stylesheet" type="text/css" />
    <link href="/templates/news_portal/css/text.css" rel="stylesheet" type="text/css" />
    <link href="/templates/news_portal/css/styles.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="/templates/news_portal/js/scroll.js"></script>
    <script type="text/javascript">var switchTo5x=true;</script>
</head>

<body>
<a href="#" id="toTop"></a>
<a href="#" class="rkl"></a>
<?php if (cmsConfig::getConfig('siteoff') && $inUser->is_admin) { ?>
<div style="margin:4px; padding:5px; border:solid 1px red; background:#FFF; position: fixed;opacity: 0.8; z-index:999"><strong style="color:red">Сайт отключен.</strong> Только администраторы видят его содержимое.</div>
<?php } ?>

<div id="container">
    <div id="header">
        <div class="head-menu">
            <?php $inPage->printModules('headmenu')?>
        </div>
        <?php if(!$inUser->id)  {?>
        <span class="register">
            <a href="#logins" class="nyroModal">
                <img src="/templates/news_portal/images/login.png" alt="login">
            </a>
        </span>
        <?php }?>
        <div class="clear"></div>

        <?php if($inPage->countModules('banner1')) {?>
            <div class="bb-729-90">
                <?php $inPage->printModules('banner1')?>
            </div>
        <?php } ?>

        <div class="info-line">
            <div class="a-bl">
                <a href="#home"><img src="/templates/news_portal/images/home.png" alt=""></a>
                <a href="#sitemap"><img src="/templates/news_portal/images/sitemap.png" alt=""></a>
                <a href="#mail"><img src="/templates/news_portal/images/mail.png" alt=""></a>
                <a href="#time"><img src="/templates/news_portal/images/time.png" alt=""></a>
                <span>Сегодня: <?php echo date('d'),', ', cmsCore::getRusDate(date('F')), ', ', date('Y')?></span>
            </div>
        </div>

        <div class="logo">
            <a href="/">
                <img src="/templates/news_portal/images/logo.png" alt="Logo" border="0">
            </a>
        </div>

        <div class="inform">
            <div class="fifty" style="width: 350px"><?php $inPage->printModules('head1')?></div>
            <div class="fifty" style="width: 255px; text-align: right;">
                <script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
                <div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus,pinterest"></div>

                <?php //$inPage->printModules('head2')?></div>
            <div class="clear"></div>
            <div class="inform-line">
                <div class="marquee-container" id="marquee_container">
                    <div class="marquee-subcontainer" id="marquee_subcontainer">
                        <div class="marquee-text" id="marquee_text">
                            Самые горячие новости одной строкой!
                        </div>
                    </div>
                </div>
                <?php //$inPage->printModules('head3')?>
            </div>
        </div>

        <div class="clear"></div>

        <div class="find">
            <?php $inPage->printModules('find')?>
        </div>
    </div>

    <div id="center">
        <div id='topmenu_s'>
            <?php $inPage->printModules('topmenu')?>
        </div>

        <?php if($inPage->countModules('banner2')||$inPage->countModules('banner3')) {?>
            <div class="fifty">
                <div class="bb-468-60">
                    <?php $inPage->printModules('banner2')?>
                </div>
            </div>
            <div class="fifty">
                <div class="bb-468-60">
                    <?php $inPage->printModules('banner3')?>
                </div>
            </div>
            <div class="clear"></div>
        <?php }?>

        <div class="top">
            <?php $inPage->printModules('top')?>
        </div>

        <div class="left-b sm-red">
            <?php $inPage->printModules('user1')?>
        </div>

        <div class="right-b sm-red">
            <div class="fifty"><?php $inPage->printModules('user2')?></div>
            <div class="fifty"><?php $inPage->printModules('user3')?></div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>

        <?php if($inPage->countModules('banner4')||$inPage->countModules('banner5')) {?>
            <div class="fifty">
                <div class="bb-468-60">
                    <?php $inPage->printModules('banner4')?>
                </div>
            </div>
            <div class="fifty">
                <div class="bb-468-60">
                    <?php $inPage->printModules('banner5')?>
                </div>
            </div>
            <div class="clear"></div>
        <?php }?>

        <div class="left-b sm-black">
            <?php if($inPage->countModules('tab1')) {?>
                <div class="tab-content">
                    <dl class="tabs">
                        <?php cmsModule('tab1')?>
                    </dl>
                </div>
            <?php }?>
            <?php $inPage->printModules('user4')?>
        </div>
        <div class="right-b sm-side">
            <?php $inPage->printModules('user5')?>
        </div>
        <div class="clear"></div>

        <?php if($inPage->countModules('banner6')) {?>
            <div class="bb-729-90">
                <?php $inPage->printModules('banner6')?>
            </div>
        <?php } ?>

        <?php if($inPage->countModules('tab2')) {?>
            <div class="g-line">
                <div class="line-tab">
                    <dl class="tabs">
                        <?php cmsModule('tab2')?>
                    </dl>
                </div>
            </div>
        <?php } ?>

        <?php if($inPage->countModules('user6')||$inPage->countModules('user7')||$inPage->countModules('user8')) {?>
            <div class="trio-1 sm-left"><?php $inPage->printModules('user6')?></div>
            <div class="trio-2 sm-cent"><?php $inPage->printModules('user7')?></div>
            <div class="trio-1 sm-right"><?php $inPage->printModules('user8')?></div>
            <div class="clear"></div>
        <?php } ?>

        <?php if($inPage->countModules('banner7')) {?>
            <div class="bb-729-90">
                <?php $inPage->printModules('banner7')?>
            </div>
        <?php } ?>

        <div class="four-b">
            <div class="fb four-b1"><?php $inPage->printModules('user9')?></div>
            <div class="fb four-b2"><?php $inPage->printModules('user10')?></div>
            <div class="fb four-b3"><?php $inPage->printModules('user11')?></div>
            <div class="fb four-b4"><?php $inPage->printModules('user12')?></div>
            <div class="clear"></div>
        </div>

        <div>
            <div class="fifty sm-grey"><?php $inPage->printModules('user13')?></div>
            <div class="fifty sm-grey"><?php $inPage->printModules('user14')?></div>
            <div class="clear"></div>
        </div>

        <div id="pathway">
            <?php $inPage->printPathway('&#8250;'); ?>
        </div>
        <?php if ($mod_count['left']) { ?>
        <?php if ($mod_count['sidebar']){ ?>
            <!-- ***************** all ******************* -->
            <div class="sidebar-b mm-left"><?php $inPage->printModules('left')?></div>
            <div class="main-b">
                <?php $inPage->printModules('maintop'); ?>

                <?php $messages = cmsCore::getSessionMessages(); ?>
                <?php if ($messages) { ?>
                <div class="sess_messages">
                    <?php foreach($messages as $message){ ?>
                    <?php echo $message; ?>
                    <?php } ?>
                </div>
                <?php } ?>

                <?php if($inPage->page_body){ ?>
                <div class="component">
                    <?php $inPage->printBody(); ?>
                </div>
                <?php } ?>
                <?php $inPage->printModules('mainbottom'); ?>
            </div>
            <div class="sidebar-b mm-right"><?php $inPage->printModules('sidebar')?></div>
            <!-- ************************************ -->
            <?php } else { ?>
            <!-- ****************** left center ****************** -->
            <div class="sidebar-b mm-left"><?php $inPage->printModules('left')?></div>
            <div class="main-b" style="width: 710px;">
                <?php $inPage->printModules('maintop'); ?>

                <?php $messages = cmsCore::getSessionMessages(); ?>
                <?php if ($messages) { ?>
                <div class="sess_messages">
                    <?php foreach($messages as $message){ ?>
                    <?php echo $message; ?>
                    <?php } ?>
                </div>
                <?php } ?>

                <?php if($inPage->page_body){ ?>
                <div class="component">
                    <?php $inPage->printBody(); ?>
                </div>
                <?php } ?>
                <?php $inPage->printModules('mainbottom'); ?>
            </div>
            <!-- ************************************ -->
            <?php } ?>
        <?php } else { ?>
        <?php if ($mod_count['sidebar']){ ?>
            <!-- ****************** center right****************** -->
            <div class="main-b" style="width: 710px;">
                <?php $inPage->printModules('maintop'); ?>

                <?php $messages = cmsCore::getSessionMessages(); ?>
                <?php if ($messages) { ?>
                <div class="sess_messages">
                    <?php foreach($messages as $message){ ?>
                    <?php echo $message; ?>
                    <?php } ?>
                </div>
                <?php } ?>

                <?php if($inPage->page_body){ ?>
                <div class="component">
                    <?php $inPage->printBody(); ?>
                </div>
                <?php } ?>
                <?php $inPage->printModules('mainbottom'); ?>
            </div>
            <div class="sidebar-b mm-right"><?php $inPage->printModules('sidebar')?></div>
            <!-- ************************************ -->
            <?php } else { ?>
            <!-- ****************** center ****************** -->
            <div class="main-b" style="width: 100%;">
                <?php $inPage->printModules('maintop'); ?>

                <?php $messages = cmsCore::getSessionMessages(); ?>
                <?php if ($messages) { ?>
                <div class="sess_messages">
                    <?php foreach($messages as $message){ ?>
                    <?php echo $message; ?>
                    <?php } ?>
                </div>
                <?php } ?>

                <?php if($inPage->page_body){ ?>
                <div class="component">
                    <?php $inPage->printBody(); ?>
                </div>
                <?php } ?>
                <?php $inPage->printModules('mainbottom'); ?>
            </div>
            <!-- ************************************ -->
            <?php } ?>
        <?php } ?>
        <div class="clear"></div>


        <div class="bottom-1"><?php $inPage->printModules('bottom1')?></div>
        <div class="bottom-2"><?php $inPage->printModules('bottom2')?></div>
    </div>
    <div class="pad"></div>
</div>

<div id="footer">
    <div class="foo">
        <div class="trio footer1"><?php $inPage->printModules('footer1')?></div>
        <div class="trio footer1"><?php $inPage->printModules('footer2')?></div>
        <div class="trio footer1"><?php $inPage->printModules('footer3')?></div>
    </div>
    <div class="clear"></div>
    <div>
        <div id="copyright"><?php $inPage->printSitename(); ?> &copy; <?php echo date('Y'); ?></div>
    </div>
</div>


<div id="logins">
    <div class="block-a">
    <h2>Авторизация</h2>
    <form action="/login" method="post" name="authform" style="margin:0px" target="_self" id="authform">
        <table class="authtable">
            <tr>
                <td width="60">Логин:</td>
                <td width=""><input name="login" type="text"/></td>
            </tr>
            <tr>
                <td height="30" valign="top">Пароль:</td>
                <td valign="top"><input name="pass" type="password"/></td>
            </tr>
            <tr>
                <td width="87%">
                    <a href="/passremind.html">Забыли пароль</a>
                </td>
                <td width="13%" align="right"><input id="logins_btn" type="submit" name="Submit" value="Вход" /></td>
            </tr>
        </table>
    </form>
    </div>
</div>


<?php
if($inUser->id){ ?>
<div class="usr_b login_usr">
    <div class="user_b">
        <?php
            echo '<div class="ava_b">';
            echo '<img class="ava" src="'.$inUser->imageurl.'" />';
            echo '</div>';
            $inPage->printModules('header')
        ?>
    </div>
</div>
<?php } ?>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#toTop").scrollToTop({speed:500,start:700});

            enableCrawLine ();

            $('#topmenu .menu li').hover(
                function() {
                    $(this).find('ul:first').show();
                    $(this).find('a:first').addClass("hover");
                },
                function() {
                    $(this).find('ul:first').hide();
                    $(this).find('a:first').removeClass("hover");
                }
            );
            $('#topmenu_s .menu li').hover(
                    function() {
                        $(this).find('ul:first').slideDown();
                        $(this).find('a:first').addClass("hover");
                    },
                    function() {
                        $(this).find('ul:first').hide();
                        $(this).find('a:first').removeClass("hover");
                    }
            );

            $("dl.tabs").each(function(){
                $(this).find('dt:first').addClass('selected');
                $(this).find('dd:first').addClass('selected');
            });
            $('dl.tabs dt').click(function(){
                $(this)
                        .siblings().removeClass('selected').end()
                        .next('dd').andSelf().addClass('selected');
            });
            $('.usr_b').hover(
                    function() {
                        $(this).css('width', '150px');
                        $(this).find('div:first').show();
                    },
                    function() {
                        $(this).find('div:first').hide();
                        $(this).css('width', '0px');

                    }
        );
        });
        var craw_line_offset;
        function enableCrawLine () {
            $('.marquee-text').fadeIn();
            craw_line_offset = 0;
            var craw_line_width = document.getElementById('marquee_text').offsetWidth;
            moveCrawLine (craw_line_width);
        }
        function moveCrawLine (w) {
            var lefttime;
            var container_width = document.getElementById('marquee_container').offsetWidth;
            var step = 2;
            var tdelay = 50;
            w = parseInt(w);
            if (craw_line_offset<(w+container_width)) {
                craw_line_offset = craw_line_offset + step;
            } else {
                craw_line_offset = 0;
            }
            document.getElementById('marquee_text').style.left = parseInt(container_width-craw_line_offset)+'px';
            setTimeout('moveCrawLine ('+w+');', tdelay);
        }
    </script>
</body>

</html>