<?php
if (!defined('GAME')) {
    die();
}

$tattack = '';

$tattack = '<a style="color:#D8D8D8" style="cursor:pointer" onclick="top.useMagic(\'Нападение на персонажа\',\'night_atack\',\'pal_button8.gif\',1,\'main.php?nightatack=1\');">Напасть</a> &nbsp; ';

if ($u->room['file'] == 'cp1') {
    if (date("H") >= 6 && date("H") < 22) {
        $now = 'day';
    } else {
        $now = 'night';
    }
    ?>
    <script>
        <?php
        if (date("H") < 6 || date("H") >= 22) {
            ?>
        function AtackNoWindow() {
            var dt = document.getElementById('atackDiv');
            if (dt.style.display == 'none') {
                dt.style.display = '';
            } else {
                dt.style.display = 'none';
            }
        }
            <?php
        }
        ?>
    </script>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="250" valign="top">
                <?php $usee = $u->getInfoPers($u->info['id'], 0);
                if ($usee != false) {
                    echo $usee[0];
                } else {
                    echo 'information is lost.';
                } ?>
            </td>
            <td width="230" valign="top" style="padding-top:19px;"><?php include('modules_data/stats_loc.php'); ?></td>
            <td valign="top">
                <div align="right">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr align="right" valign="top">
                            <td>
                                <?php if ($re != '') {
                                    echo '<font color="red"><b>' . $re . '</b></font>';
                                } ?>
                                <table width="500" border="0" cellspacing="0" cellpadding="0">
                                    <?php if ($u->error != '') { ?>
                                        <font color=red><b>
                                            <?php echo $u->error; ?></font></b>
                                    <?php } ?>
                                    <tr>
                                        <td>
                                            <div style="position:relative; cursor: pointer; width: 590px;" id="ione">
                                                <div style="position: absolute; left: 4px; right: 0; z-index: 1500; top: 5px;">
                                                    <div id="frvrks" style="position:relative;"></div>
                                                </div>
                                                <div style="position:relative; cursor: pointer; width: 590px;" id="ione"><img
                                                            src="/static/img/loca/leg_loc/cp/bg_20_day<?php if (date('H') >= 22 || date('H') < 6) {
                                                                echo 'night';
                                                                                                               } ?>.png" id="img_ione" width="590" height="250" border="1"/>
                                                    <div id="buttons_on_image" style="cursor:pointer; font-weight:bold; color:#D8D8D8; font-size:10px;">
                                                        <?php echo $tattack; ?>
                                                        &nbsp;
                                                        <span onMouseMove="this.runtimeStyle.color = 'white';" onMouseOut="this.runtimeStyle.color = this.parentElement.style.color;"
                                                              onclick="window.open('/forum', 'forum', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')">Форум</span>
                                                        &nbsp;
                                                    </div>
                                                    <script>
                                                        <!--
                                                        if (document.getElementById('ione')) {
                                                            document.getElementById('ione').appendChild(document.getElementById('buttons_on_image'));
                                                            document.getElementById('buttons_on_image').style.position = 'absolute';
                                                            document.getElementById('buttons_on_image').style.bottom = '8px';
                                                            document.getElementById('buttons_on_image').style.right = '23px';
                                                        } else {
                                                            document.getElementById('buttons_on_image').style.display = 'none';
                                                        }
                                                        -->
                                                    </script>
                                                    <div style="position: absolute; left: 165px; top: 19px; width: 252px; height: 168px; z-index: 90;"><img <?php thisInfRm('1.180.0.3'); ?>
                                                                src="/static/img/loca/leg_loc/cp/bk.png" width="252" height="168" title="" class="aFilter"/></div>

                                                    <!-- <div style="position: absolute; left: 376px; top: 118px; width: 79px; height: 88px; z-index: 91;"><img  <?php thisInfRm('1.180.0.371'); ?> src="/static/img/city/capitalcity/day/loto.gif" class="aFilter" width="86" height="63" /></div>  -->

                                                    <div style="position: absolute; left: 122px; top: 156px; width: 92px; height: 70px; z-index: 90;"><img <?php thisInfRm('1.180.0.10'); ?>
                                                                src="/static/img/loca/leg_loc/cp/shop.png" width="92" height="70" title="" class="aFilter"/></div>

                                                    <div style="position: absolute; left: 49px; top: 152px; width: 70px; height: 48px; z-index: 90;"><img <?php thisInfRm('1.180.0.272'); ?>
                                                                src="/static/img/loca/leg_loc/cp/comission.png" width="70" height="48" title="" class="aFilter"/></div>

                                                    <div style="position: absolute; left: 220px; top: 145px; width: 84px; height: 58px; z-index: 90;"><img <?php thisInfRm('1.180.0.210'); ?>
                                                                src="/static/img/loca/leg_loc/cp/repair.png" width="84" height="58" title="" class="aFilter"/></div>

                                                    <div style="position: absolute; left: 339px; top: 144px; width: 108px; height: 88px; z-index: 90;"><img <?php thisInfRm('1.180.0.13'); ?>
                                                                src="/static/img/loca/leg_loc/cp/berezka.png" width="108" height="88" title="" class="aFilter"/></div>

                                                    <!--<div style="position: absolute; left: 416px; top: 162px; width: 75px; height: 52px; z-index: 90;"><img <?php thisInfRm('1.180.0.371'); ?> src="/static/img/loca/cp11/loto_png.png" width="75" height="52" title="" class="aFilter" /></div>-->
                                                    <?php /*
                        <div style="position: absolute; left: 371px; top: 173px; width: 60px; height: 41px; z-index: 93;"><img  <?php thisInfRm('1.180.0.404'); ?> src="/static/img/city/priz2shop.gif" width="60" class="aFilter" height="40" /></div>
                        */ ?>

                                                    <?php if (date('m') != 12 && date('m') != 1) { ?>
                                                        <!--<div style="position: absolute; left: 230px; top: 150px; width: 27px; height: 55px; z-index: 93;"><img  <?php thisInfRm('1.180.0.x'); ?> src="/static/img/city/capitalcity/day/2pm.gif" class="aFilter" width="27" height="55" /></div>-->
                                                    <?php } ?>

                                                    <?php if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 8)) { /* Хэллоуин */ ?>
                                                        <div style="position: absolute; left: 219px; top: 171px; width: 32px; height: 43px; z-index: 91;"><img onclick="location.href='main.php?talk=5'"
                                                                                                                                                               title="Диалог с Тыквоголовым"
                                                                                                                                                               src="/static/img/loca/cp11/sun_pmd.gif"
                                                                                                                                                               width="32" height="43" class="aFilter"/>
                                                        </div>
                                                    <?php } ?>
                                                    <?php if (date('m') == 12 || date('m') == 1) { ?>
                                                        <div style="position: absolute; left: 145px; top: 114px; width: 32px; height: 43px; z-index: 95;"><img <?php thisInfRm('1.180.0.208'); ?>
                                                                    src="/static/img/newyear2014.png" width="60" height="90" title="" class="aFilter"/></div>
                                                    <?php } ?>

                                                    <div style="position: absolute; left: 443px; top: 120px; width: 92px; height: 70px; z-index: 89;"><img <?php thisInfRm('1.180.0.226'); ?>
                                                                src="/static/img/loca/leg_loc/cp/post.png" width="106" height="84" title="" class="aFilter"/></div>

                                                    <!--<div style="position:absolute; left:73px; top:135px; width:92px; height:62px; z-index:92;"><img  <?php thisInfRm('1.180.0.14'); ?>  onclick="alert('Не работает. Находится на реконструкции.')"  onMouseOver="this.className='aFilterhover';" onMouseOut="this.className='aFilter';" src="/static/img/city/capitalcity/day/2vokzal.gif" width="92" height="62" class="aFilter" /></div>-->

                                                    <!-- <div style="position:absolute; left:166px; top:149px; width:27px; height:55px; z-index:99;"><img  src="/static/img/i/images/300x225/capital/2pm.gif" width="27" height="55" title="Памятник Мироздателю" /></div> -->

                                                    <!-- <div style="position:absolute; left:100px; top:146px; width:75px; height:90px; z-index:99;"><img src="/static/img/i/images/300x225/capital/stellav.gif" width="75" height="90" title="Стела выбора" class="aFilter" /></div> -->

                                                    <div style="position: absolute; left: 537px; top: 184px; width: 29px; height: 41px; z-index: 91;"><img <?php thisInfRm('1.180.0.11'); ?>
                                                                src="/static/img/loca/leg_loc/cp/arr_right.png" width="38" height="46" title="" class="aFilter"/></div>
                                                    <div style="position: absolute; left: 13px; top: 184px; width: 29px; height: 41px; z-index: 91;"><img <?php thisInfRm('1.180.0.323'); ?>
                                                                src="/static/img/loca/leg_loc/cp/arr_left.png" width="38" height="46" title="" class="aFilter"/></div>

                                                    <div id="snow"></div>
                                                    <?php echo $goline; ?>
                                                </div>
                                        </td>
                                    </tr>
                                </table>
                                <?php
                                if (date("H") < 6 || date("H") >= 22) {
                                    ?>
                                    <div align="center" id="atackDiv" style="display:none;">
                                        <form method="post" action="main.php">
                                            <table width="300" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <div style="width:300px; padding:3px; margin:7px; background-color:#CCCCCC; border:1px solid #575757;"> Введите логин жертвы:<br/>
                                                            <input name="atack" type="text" id="atack" size="35" maxlength="30"/>
                                                            <input type="submit" name="button" id="button" class="btn" value="OK"/>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                    </div>
                                    <?php
                                }
                                ?>
                                <!--
        <div style="width:500px; text-align:left; background-color:#D3D3D3;">
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.3'); ?>>Бойцовский Клуб</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.323'); ?>>Парковая улица</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.10'); ?>>Магазин</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.210'); ?>>Ремонтная мастерская</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.272'); ?>>Комиссионный магазин</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.11'); ?>>Страшилкина улица</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.14'); ?>>Вокзал</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.371'); ?>>Лотерейный дом</a></span>
        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="/static/img/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" class="menutop" <?php thisInfRm('1.180.0.404'); ?>>Призовой магазин</a></span>
        </div>
        -->
                                <div style="display:none; height:0 " id="moveto"></div>
                            </td>
                            <td>
                                <!-- <br /><span class="menutop"><nobr>Комната для новичков</nobr></span>-->
                            </td>
                        </tr>
                    </table>
                    <small>
                        <?php
                        /*function testMonster( $mon , $type ) {
                            $r = true;
                            if(isset($mon['id'])) {
                                //
                                if($type == 'start') {
                                    //День недели
                                    if( $mon['start_day'] != -1 ) {
                                        if( ($mon['start_day'] < 7 && $mon['start_day'] != date('w')) || $mon['start_day'] != 7 ) {
                                            $r = false;
                                        }
                                    }
                                    //Число
                                    if( $mon['start_dd'] != -1 ) {
                                        if( $mon['start_dd'] != date('j') ) {
                                            $r = false;
                                        }
                                    }
                                    //месяц
                                    if( $mon['start_mm'] != -1 ) {
                                        if( $mon['start_mm'] != date('n') ) {
                                            $r = false;
                                        }
                                    }
                                    //час
                                    if( $mon['start_hh'] != -1 ) {
                                        if( $mon['start_hh'] != date('G') ) {
                                            $r = false;
                                        }
                                        if( $mon['start_min'] != -1 ) {
                                            if( $mon['start_min'] < (int)date('i') ) {
                                                $r = false;
                                            }
                                        }
                                    }
                                }elseif($type == 'back') {
                                    //День недели
                                    if( $mon['back_day'] != -1 ) {
                                        if( ($mon['back_day'] < 7 && $mon['back_day'] != date('w')) || $mon['back_day'] != 7 ) {
                                            $r = false;
                                        }
                                    }
                                    //Число
                                    if( $mon['back_dd'] != -1 ) {
                                        if( $mon['back_dd'] != date('j') ) {
                                            $r = false;
                                        }
                                    }
                                    //месяц
                                    if( $mon['back_mm'] != -1 ) {
                                        if( $mon['back_mm'] != date('n') ) {
                                            $r = false;
                                        }
                                    }
                                    //час
                                    if( $mon['back_hh'] != -1 ) {
                                        if( $mon['back_hh'] != date('G') ) {
                                            $r = false;
                                        }
                                        if( $mon['back_min'] != -1 ) {
                                            if( $mon['back_min'] < (int)date('i') ) {
                                                $r = false;
                                            }
                                        }
                                    }
                                }else{
                                    //что-то другое
                                    $r = false;
                                }
                                //
                            }
                            return $r;
                        }

                        echo '<font color=red><b>Расписание атак монстров:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></font><br>';
                        $sp = mysql_query('SELECT * FROM `aaa_monsters` ORDER BY `start_hh`');
                        while( $pl = mysql_fetch_array($sp) ) {
                            $btc = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1'));
                            if( isset($btc['id']) ) {
                                if( testMonster($pl,'start') == true ) {
                                    echo '<a href="/info/'.$btc['id'].'" target="_blank">'.$btc['login'].'</a> появится через <b>Уже был!</b><br>';
                                }else{
                                    if( $pl['start_hh'] != -1 ) {
                                        if ($pl['start_mm'] == - 1 ) {
                                            $pl['start_mm'] = '00';
                                        }
                                        echo '<a href="/info/'.$btc['id'].'" target="_blank">'.$btc['login'].'</a> появится в '.$pl['start_hh'].':'.$pl['start_mm'].'<br>';
                                    }
                                }
                            }
                        }
                        echo '';
                        */
                        ?>
                        <HR>
                        <INPUT id="forum" class="btn btn-inverse"
                               onclick="window.open('/news/', 'news', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')" value="Новости"
                               type="button" name="forum">
                        <INPUT onclick="location.href='main.php?zayvka=<?php echo $code; ?>';" class="btn btn-inverse" value="Поединки" type="button" name="combats">
                        <?php $hgo = $u->testHome();
                        if (!isset($hgo['id'])) {
                            ?><INPUT onclick="location.href='main.php?homeworld=<?php echo $code; ?>';" class="btn btn-inverse" value="Возврат" type="button"
                                                           name="combats2">
                        <?php }
                        unset($hgo); ?>
                        <INPUT id="forum" class="btn btn-inverse"
                               onclick="window.open('/forum/', 'forum', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')" value="Форум"
                               type="button" name="forum">
                        <br/>
                        <!--<strong>Внимание!</strong> Никогда и никому не говорите пароль от своего персонажа. Не вводите пароль на других сайтах, типа "новый город", "лотерея", "там, где все дают на халяву". Пароль не нужен ни паладинам, ни кланам, ни администрации, <U>только взломщикам</U> для кражи вашего героя.<BR>
                        <em>Администрация.</em></small> <BR>-->
                        <?php echo $rowonmax; ?><BR>

                </div>
            </td>
        </tr>
    </table>
    <?php
}

?>
