<?php

    if(!defined('VALID_CMS')) { die('ACCESS DENIED'); }
    $inUser = cmsUser::getInstance();
    $inCore = cmsCore::getInstance();

    $mod_count['additional_menu']   = cmsCountModules('additional_menu');
    $mod_count['slider']  = cmsCountModules('slider');
		$mod_count['top']  = cmsCountModules('top');
		$mod_count['registration']  = cmsCountModules('registration');
		$mod_count['top1']  = cmsCountModules('top1');
		$mod_count['top2']  = cmsCountModules('top2');
		$mod_count['top3']  = cmsCountModules('top3');
		$mod_count['top4']  = cmsCountModules('top4');
		$mod_count['center']  = cmsCountModules('center');
		$mod_count['tab1']  = cmsCountModules('tab1');
		$mod_count['tab2']  = cmsCountModules('tab2');
		$mod_count['tab3']  = cmsCountModules('tab3');
		$mod_count['middle1']  = cmsCountModules('middle1');
		$mod_count['middle2']  = cmsCountModules('middle2');
		$mod_count['middle3']  = cmsCountModules('middle3');
		$mod_count['right']  = cmsCountModules('right');
		$mod_count['bottom1']  = cmsCountModules('bottom1');
		$mod_count['bottom2']  = cmsCountModules('bottom2');
		$mod_count['bottom3']  = cmsCountModules('bottom3');
		$mod_count['bottom4']  = cmsCountModules('bottom4');
		$mod_count['footer1']  = cmsCountModules('footer1');
		$mod_count['footer2']  = cmsCountModules('footer2');
		$mod_count['footer3']  = cmsCountModules('footer3');
		$mod_count['footer4']  = cmsCountModules('footer4');
		$mod_count['footer5']  = cmsCountModules('footer5');
		$mod_count['advert1']  = cmsCountModules('advert1');
		$mod_count['advert2']  = cmsCountModules('advert2');
		$mod_count['advert3']  = cmsCountModules('advert3');
		$mod_count['advert4']  = cmsCountModules('advert4');
		$mod_count['advert5']  = cmsCountModules('advert5');
		$mod_count['advert6']  = cmsCountModules('advert6');
		$mod_count['advert7']  = cmsCountModules('advert7');
		$mod_count['advert8']  = cmsCountModules('advert8');

?>
<!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>
<?php cmsPrintHead(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
<?php if($inUser->is_admin){ ?>
<script src="/admin/js/modconfig.js" type="text/javascript"></script>
<script src="/templates/octopus/js/nyromodal.js" type="text/javascript"></script>
<link href="/templates/octopus/css/modconfig.css" rel="stylesheet" type="text/css" />
<link href="/templates/octopus/css/nyromodal.css" rel="stylesheet" type="text/css" />
<?php } ?>
<link href="/templates/octopus/css/reset.css" rel="stylesheet" type="text/css" />
<link href="/templates/octopus/css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]><link href="/templates/octopus/css/ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
<script src="/includes/jquery/tabs/jquery.ui.min.js" type="text/javascript"></script>
<script src="/templates/octopus/js/jquery.uniform.js" type="text/javascript"></script>
<script src="/templates/octopus/js/jquery.jcarousel.min.js" type="text/javascript"></script>
<script src="/templates/octopus/js/jquery.pikachoose.js" type="text/javascript"></script>
<!--[if lte IE 9]>
   <link href="/templates/octopus/css/ie.css" rel="stylesheet" type="text/css" />
   <script src="/templates/octopus/js/jquery.textshadow.js" type="text/javascript"></script>
   <script type="text/javascript">
		$(document).ready(function(){
			$("#topmenu .menu li a span.shad, #additional_menu .menu li a span.shad").textShadow();
		});
	</script>
   <![endif]-->
<script type="text/javascript">
  $(function(){
    $("#loginblock input:checkbox").uniform();
  });
</script>
<script type="text/javascript">
			$(document).ready(function (){
					$("#pickame").PikaChoose();
				});
		</script>
<script type="text/javascript">
		$(document).ready(function(){
			$("#tabmod > #ulwrap > ul#tabul").tabs();
		});
	</script>
</head>
<body>
<div id="wrapper">
  <div id="header">
    <div class="limiter">
      <div id="logo"><a href="/"></a></div>
      <div> </div>
      <?php if (!$inUser->id){ ?>
      <div id="loginblock">
        <form id="authform" target="_self" name="authform" method="post" action="/login">
          <div id="inputs">
            <input id="login" type="text" onfocus="if(this.value=='логин') this.value='';" onblur="if(this.value=='') this.value='логин';" value="логин" name="login">
            <input id="pass" type="password" onfocus="if(this.value=='*****') this.value='';" onblur="if(this.value=='') this.value='*****';" value="*****" name="pass">
            <input class="login_but" type="submit" title="войти" value=" " name="Submit">
          </div>
          <div id="reglinks"> <span class="register"><a href="/registration">Регистрация</a></span> <span class="login"><a href="/passremind.html">Забыли пароль?</a></span>
            <label>
            <input id="remember" type="checkbox" checked="" name="remember" value="1" title="Запомнить меня">
            Запомнить меня</label>
          </div>
        </form>
      </div>
      <?php } else { ?>
      <div id="u_menu">
        <?php cmsModule('usermenu'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['advert1']){ ?>
      <div id="advert1">
        <?php cmsModule('advert1'); ?>
      </div>
      <?php } ?>
    </div>
  </div>
  <div <?php if ($mod_count['additional_menu']){ ?>class="non_unique"<?php } else { ?>class="unique"<?php } ?> id="topmenu">
    <div class="limiter">
      <?php cmsModule('topmenu'); ?>
    </div>
  </div>
  <?php if ($mod_count['additional_menu']) { ?>
  <div id="additional_menu">
    <div class="limiter">
      <?php cmsModule('additional_menu'); ?>
      <div id="search">
        <form method="get" action="/index.php">
          <input type="hidden" value="search" name="view">
          <input type="text" value="Поиск..." name="query" onfocus="if (this.value == 'Поиск...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Поиск...';}">
          <button value="submit"></button>
        </form>
      </div>
    </div>
  </div>
  <?php } ?>
  <div class="limiter">
    <?php cmsPathway('&nbsp; &raquo; &nbsp;'); ?>
    <?php if ($mod_count['advert2']){ ?>
    <div id="advert2">
      <?php cmsModule('advert2'); ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['slider'] or $mod_count['top']){ ?>
    <div id="sliderblock">
      <?php if ($mod_count['slider']){ ?>
      <div id="slider">
        <div id="slider1">
          <div id="slider2">
            <?php cmsModule('slider'); ?>
          </div>
        </div>
      </div>
      <?php } ?>
      <?php if ($mod_count['top']){ ?>
      <div id="top">
        <?php cmsModule('top'); ?>
      </div>
      <?php } ?>
      <div class="clear"></div>
    </div>
    <?php } ?>
    <?php if ($mod_count['advert3']){ ?>
    <div id="advert3">
      <?php cmsModule('advert3'); ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['registration'] and !$inUser->id){ ?>
    <div id="registration">
      <div id="registertext">
        <?php cmsModule('registration'); ?>
      </div>
      <div id="registerbutton"><a href="/registration"></a></div>
    </div>
    <?php } ?>
    <?php if ($mod_count['top1'] or $mod_count['top2'] or $mod_count['top3'] or $mod_count['top4']) { ?>
    <?php if ($mod_count['top1']) $t_arr[] = $mod_count['top1'];
						 if ($mod_count['top2']) $t_arr[] = $mod_count['top2'];
						 if ($mod_count['top3']) $t_arr[] = $mod_count['top3'];
						 if ($mod_count['top4']) $t_arr[] = $mod_count['top4'];
						 $t_count = count($t_arr);
						 ?>
    <div id="topblock" class="<?php if ($t_count == 4) { ?>four<?php } elseif ($t_count == 3) { ?>three<?php } elseif ($t_count == 2) { ?>two<?php } else { ?>one<?php } ?>">
      <?php if ($mod_count['top1']) { ?>
      <div id="top1">
        <?php cmsModule('top1'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['top2']) { ?>
      <div id="top2">
        <?php cmsModule('top2'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['top3']) { ?>
      <div id="top3">
        <?php cmsModule('top3'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['top4']) { ?>
      <div id="top4">
        <?php cmsModule('top4'); ?>
      </div>
      <?php } ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['advert4']){ ?>
    <div id="advert4">
      <?php cmsModule('advert4'); ?>
    </div>
    <?php } ?>
    <div id="mainblock">
      <div id="center" class="<?php if ($mod_count['tab1'] or $mod_count['tab2'] or $mod_count['tab3'] or $mod_count['right']) { ?>tight<?php } else { ?>wide<?php } ?>">
        <?php $messages = cmsCore::getSessionMessages(); ?>
        <?php if ($messages) { ?>
        <div class="sess_messages">
          <?php foreach($messages as $message){ ?>
          <?php echo $message; ?>
          <?php } ?>
        </div>
        <?php } ?>
        <?php cmsBody(); ?>
        <?php if ($mod_count['center']) { ?>
        <div id="centermod">
          <?php cmsModule('center'); ?>
        </div>
        <?php } ?>
      </div>
      <?php if ($mod_count['tab1'] or $mod_count['tab2'] or $mod_count['tab3'] or $mod_count['right']) { ?>
      <div id="right">
        <?php if ($mod_count['tab1'] or $mod_count['tab2'] or $mod_count['tab3']) { ?>
        <div id="tabmod">
          <div id="ulwrap">
            <ul id="tabul">
              <?php if ($mod_count['tab1']) { ?>
              <li><span><a href="#tab1">Новички</a></span></li>
              <?php } ?>
              <?php if ($mod_count['tab2']) { ?>
              <li><span><a href="#tab2">Статистика</a></span></li>
              <?php } ?>
              <?php if ($mod_count['tab3']) { ?>
              <li><span><a href="#tab3">Онлайн</a></span></li>
              <?php } ?>
            </ul>
          </div>
          <?php if ($mod_count['tab1']) { ?>
          <div id="tab1">
            <?php cmsModule('tab1'); ?>
          </div>
          <?php } ?>
          <?php if ($mod_count['tab2']) { ?>
          <div id="tab2">
            <?php cmsModule('tab2'); ?>
          </div>
          <?php } ?>
          <?php if ($mod_count['tab3']) { ?>
          <div id="tab3">
            <?php cmsModule('tab3'); ?>
          </div>
          <?php } ?>
        </div>
        <?php } ?>
        <?php cmsModule('right'); ?>
      </div>
      <?php } ?>
    </div>
    <?php if ($mod_count['advert5']){ ?>
    <div id="advert5">
      <?php cmsModule('advert5'); ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['middle1'] or $mod_count['middle2'] or $mod_count['middle3']) { ?>
    <div id="middleblock">
      <?php if ($mod_count['middle1']) { ?>
      <div id="middle1">
        <?php cmsModule('middle1'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['middle2']) { ?>
      <div id="middle2">
        <?php cmsModule('middle2'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['middle3']) { ?>
      <div id="middle3">
        <?php cmsModule('middle3'); ?>
      </div>
      <?php } ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['advert6']){ ?>
    <div id="advert6">
      <?php cmsModule('advert6'); ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['bottom1'] or $mod_count['bottom2'] or $mod_count['bottom3'] or $mod_count['bottom4']) { ?>
    <?php if ($mod_count['bottom1']) $b_arr[] = $mod_count['bottom1'];
						 if ($mod_count['bottom2']) $b_arr[] = $mod_count['bottom2'];
						 if ($mod_count['bottom3']) $b_arr[] = $mod_count['bottom3'];
						 if ($mod_count['bottom4']) $b_arr[] = $mod_count['bottom4'];
						 $b_count = count($b_arr);
						 ?>
    <div id="bottomblock" class="<?php if ($b_count == 4) { ?>four<?php } elseif ($b_count == 3) { ?>three<?php } elseif ($b_count == 2) { ?>two<?php } else { ?>one<?php } ?>">
      <?php if ($mod_count['bottom1']) { ?>
      <div id="bottom1">
        <?php cmsModule('bottom1'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['bottom2']) { ?>
      <div id="bottom2">
        <?php cmsModule('bottom2'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['bottom3']) { ?>
      <div id="bottom3">
        <?php cmsModule('bottom3'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['bottom4']) { ?>
      <div id="bottom4">
        <?php cmsModule('bottom4'); ?>
      </div>
      <?php } ?>
    </div>
    <?php } ?>
    <?php if ($mod_count['advert7']){ ?>
    <div id="advert7">
      <?php cmsModule('advert7'); ?>
    </div>
    <?php } ?>
  </div>
  <?php if ($mod_count['footer1'] or $mod_count['footer2'] or $mod_count['footer3'] or $mod_count['footer4'] or $mod_count['footer5']) { ?>
  <?php if ($mod_count['footer1']) $f_arr[] = $mod_count['footer1'];
						 if ($mod_count['footer2']) $f_arr[] = $mod_count['footer2'];
						 if ($mod_count['footer3']) $f_arr[] = $mod_count['footer3'];
						 if ($mod_count['footer4']) $f_arr[] = $mod_count['footer4'];
						 if ($mod_count['footer5']) $f_arr[] = $mod_count['footer5'];
						 $f_count = count($f_arr);
						 ?>
  <div id="footerblock" class="<?php if ($f_count == 5) { ?>five<?php } elseif ($f_count == 4) { ?>four<?php } elseif ($f_count == 3) { ?>three<?php } elseif ($f_count == 2) { ?>two<?php } else { ?>one<?php } ?>">
    <div class="limiter">
      <?php if ($mod_count['footer1']) { ?>
      <div id="footer1">
        <?php cmsModule('footer1'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['footer2']) { ?>
      <div id="footer2">
        <?php cmsModule('footer2'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['footer3']) { ?>
      <div id="footer3">
        <?php cmsModule('footer3'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['footer4']) { ?>
      <div id="footer4">
        <?php cmsModule('footer4'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['footer5']) { ?>
      <div id="footer5">
        <?php cmsModule('footer5'); ?>
      </div>
      <?php } ?>
      <?php if ($mod_count['advert8']){ ?>
      <div id="advert8">
        <?php cmsModule('advert8'); ?>
      </div>
      <?php } ?>
    </div>
  </div>
  <?php } ?>
  <?php if (!$mod_count['footer1'] and !$mod_count['footer2'] and !$mod_count['footer3'] and !$mod_count['footer4'] and !$mod_count['footer5']) { ?>
  <div class="pad"></div>
  <?php } ?>
</div>
<div id="footer"<?php if (!$mod_count['footer1'] and !$mod_count['footer2'] and !$mod_count['footer3'] and !$mod_count['footer4'] and !$mod_count['footer5']) { ?> class="lowered"<?php } ?>>
  <div class="limiter">
    <div id="copy">
      <?php cmsPrintSitename(); ?>
      &copy; <?php echo date('Y'); ?> </div>
    <div id="fract">
      <div id="generator">Шаблон от <a target="_blank" href="/go/url=http://instantlab.ru">instantlab.ru</a></div>
      <div id="counters"><img src="/templates/octopus/images/b88x31.gif" border="0"/></div>
    </div>
  </div>
</div>
<script type="text/javascript">
        $(document).ready(function(){
            $('#topmenu .menu li, #additional_menu .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");
                }
            );
        });
    </script>
</body>
</html>
