<div id="stats" style="display:none;">
			<div class="title">Статистика</div>
						<div class="text">
				<div class="str">
					<img src="/images/users.png"/>
					<div class="name">Всего пользователей :</div>
					<div class="value"><span class="red"><?=FullUser(); ?></span> чел.</div>
					<div class="clear"></div>
				</div>
				<div class="str">
					<img src="/images/newusers.png"/>
					<div class="name">Новых за 24 часа :</div>
					<div class="value"><span class="red"><?=FullUserEvery(); ?></span> чел.</div>
					<div class="clear"></div>
				</div>
				
				<div class="str">
					<img src="/images/cashin.png"/>
					<div class="name">Всего пополнено :</div>
					<div class="value"><span class="red"><?=FullEnter()*0.90; ?></span> руб.</div>
					<div class="clear"></div>
				</div>
				
				<div class="str">
					<img src="/images/cashout.png"/>
					<div class="name">Всего выплачено :</div>
					<div class="value"><span class="red"><?=FullVivod(); ?></span> руб.</div>
					<div class="clear"></div>
				</div>
			
				<div class="str">
					<img src="/images/cash.png"/>
					<div class="name">Резерв выплат :</div>
					<div class="value"><span class="red"><?=(FullEnter()*0.90)-FullVivod();; ?></span> руб.</div>
					<div class="clear"></div>
				</div>
			
				<div class="str">
					<img src="/images/clock.png"/>
										<div class="name">Проект платит :</div>
					<div class="value"><span class="red"><?=intval(((time() - $DateStart) / 86400 ) +1); ?></span>-й день</div>
										<div class="clear"></div>
				</div>

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

            <div id="server_time" style="display:none;">
                <div class="title">Серверное время</div>
                
					<div class="text red" align="center">
						<span id="server_timer">--:--:--</span>
						<script type="text/javascript">
							var server_hour = <?=date("H", time()); ?>;
							var server_minute = <?=date("i", time()); ?>;
							var server_second = <?=date("s", time()); ?>;
								
							function server_timer() {	
								$("#server_timer").html((server_hour < 10 ? "0"+server_hour : server_hour)+":"+(server_minute < 10 ? "0"+server_minute : server_minute)+":"+(server_second < 10 ? "0"+server_second : server_second));
								++server_second;
								if(server_second > 59) {
									++server_minute;
									if(server_minute > 59) {
										++server_hour;
										if(server_hour > 23) {
											server_hour = 00;
										}
										server_minute = 00;
									}
									server_second = 00;
								}
							}
							server_timer();
							server_timer_id = setInterval('server_timer()',1000);
						</script>
					</div>
				</div>
            </div>
            


            <!-- AKKAUNT -->



			<div class="text" style="">
	<div align="center" style="color:#6a5e49;">
		<i>В обменнике Вы можете обменять золото на серебро по выгодному курсу</i></div>
<form action="" method="post" id="exchangerForm" onsubmit="return false;">
	<div class="container">
	<img src="/images/moneyout.png"/>
	<input type="text" name="moneyout" maxlength="9" class="w140" value="<?=intval($User['MoneyOut']); ?>" placeholder="Счёт на вывод" onkeyup="return calcul(this,'cashin',0,5);"/>
	<span class="title percent">+5%</span>		<img src="/images/exchange.png"/>
	<img src="/images/moneyin.png"/>
	<span class="title" id="cashin"><?=intval($User['MoneyOut'] + ($User['MoneyOut'] * 0.05)); ?></span>
	<span class="button" onclick="process('exchangerForm','/process/exchanger.php','exchangerForm .fail','exchangerForm .fail','exchangerForm')">Обменять</span>
	</div>
	<div class="fail"></div>
</form>
</div>


  


<!-- SHOP -->

<div class="text" style="">
		 
			<div class="shop" id="shop1" onclick="process('','/process/shop.php?ident=1','shop1 .result','shop1 .result','shop1')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>25%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<span class="title">+500</span></div>				
				<div class="title">Авто заправка</div>
				<img src="/images/Corner_Gas_Station-icon.png"/><br/>
				<img src="/images/Fuel-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[1]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[1]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[1]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[1]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop1 .profitability").height($("#shop1 .profitability").width())</script>
		 
			<div class="shop" id="shop2" onclick="process('','/process/shop.php?ident=2','shop2 .result','shop2 .result','shop2')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>30%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<?
				if($Level[2] > GetUser('Level', $_SESSION['id']))
				{
				?>
				<b class="red-dark">Требуется<br/><?=$Level[2]; ?> уровень</b>
				<? } 
					else 
					{
						echo '<span class="title">+'.$Price[2] / 2 .'</span>';
					}
				?>
				
				</div>				
				<div class="title">Лесопилка</div>
				<img src="/images/Lumber_Mill-icon.png"/><br/>
				<img src="/images/Wood_Plank-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[2]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[2]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[2]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[2]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop2 .profitability").height($("#shop2 .profitability").width())</script>
		 
			<div class="shop" id="shop3" onclick="process('','/process/shop.php?ident=3','shop3 .result','shop3 .result','shop3')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>35%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<?
				if($Level[3] > GetUser('Level', $_SESSION['id']))
				{
				?>
				<b class="red-dark">Требуется<br/><?=$Level[3]; ?> уровень</b>
				<? } 
					else 
					{
						echo '<span class="title">+'.$Price[3] / 2 .'</span>';
					}
				?>
				</div>				
				<div class="title">Хлопковый завод</div>
				<img src="/images/Cotton_Mill-icon.png"/><br/>
				<img src="/images/Cotton_(Farmers_Square)-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[3]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[3]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[3]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[3]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop3 .profitability").height($("#shop3 .profitability").width())</script>
		 
			<div class="shop" id="shop4" onclick="process('','/process/shop.php?ident=4','shop4 .result','shop4 .result','shop4')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>40%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<?
				if($Level[4] > GetUser('Level', $_SESSION['id']))
				{
				?>
				<b class="red-dark">Требуется<br/><?=$Level[4]; ?> уровень</b>
				<? } 
					else 
					{
						echo '<span class="title">+'.$Price[4] / 2 .'</span>';
					}
				?></div>				<div class="title">Амбар</div>
				<img src="/images/Wheat_Silo-icon.png"/><br/>
				<img src="/images/Wheat_(Farmers_Square)-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[4]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[4]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[4]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[4]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop4 .profitability").height($("#shop4 .profitability").width())</script>
		 
			<div class="shop" id="shop5" onclick="process('','/process/shop.php?ident=5','shop5 .result','shop5 .result','shop5')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>50%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<?
				if($Level[5] > GetUser('Level', $_SESSION['id']))
				{
				?>
				<b class="red-dark">Требуется<br/><?=$Level[5]; ?> уровень</b>
				<? } 
					else 
					{
						echo '<span class="title">+'.$Price[5] / 2 .'</span>';
					}
				?></div>				<div class="title">Алюминевый завод</div>
				<img src="/images/Recycling_Center-icon.png"/><br/>
				<img src="/images/Aluminium-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[5]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[5]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[5]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[5]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop5 .profitability").height($("#shop5 .profitability").width())</script>
		 
			<div class="shop" id="shop6" onclick="process('','/process/shop.php?ident=6','shop6 .result','shop6 .result','shop6')">
				<div class="title profitability" style="height: 90px;"><table><tr><td>60%<br/><span>в месяц</span></td></tr></table></div>
				<div class="level"><img src="/images/level.png"/><br/>
				<?
				if($Level[6] > GetUser('Level', $_SESSION['id']))
				{
				?>
				<b class="red-dark">Требуется<br/><?=$Level[6]; ?> уровень</b>
				<? } 
					else 
					{
						echo '<span class="title">+'.$Price[6] / 2 .'</span>';
					}
				?></div>				<div class="title">Магазин инструментов</div>
				<img src="/images/Supply_Shop-icon.png"/><br/>
				<img src="/images/Basic_Nail-icon.png" class="title-image"/>
				<span class="title cols"><?=$Dohod[6]; ?></span> в минуту<br/>
				<img src="/images/clock.png" class="title-image"/>
				<span class="title cols"><?=$Srok[6]; ?></span> дней</span> <br/>
				<img src="/images/repair.png" class="title-image"/> 
				<span class="title cols"><?=$Remont[6]; ?></span></span>  
				<img src="/images/moneyin.png" class="title-image"/><br/>
				<img src="/images/moneyin.png" class="price-image"/>
				<span class="title price"><?=$Price[6]; ?></span><br/>
				<div class="result"></div>
				<span class="button buy">Купить</span>
				<div class="clear"></div>
			</div>
			<script type="text/javascript">$("#shop6 .profitability").height($("#shop6 .profitability").width())</script>
</div>



<!--  ================================== -->
<?php

$q = $mysql->prepare("SELECT * FROM db_farm WHERE UserId = ?");
$q->execute(array($_SESSION['id']));
if($q->rowCount() > 0)
{
while($r = $q->fetch())
{
	$type = $r['Type'];
	$rr = (time() - $r['DateAdd']) / 60;
	$ll = GetUser('Level', $_SESSION['id']);
	$prod = intval($rr * $Dohod[$type]);
	$Golden = intval($prod / $CountGold[$type]);
	$Goldenn = intval($Golden / 100 * $PercentOut[$ll]);
	$PercSerebro = 100 - $PercentOut[$ll];
	$Serebro = intval($Golden / 100 * $PercSerebro);
	$Reuting = intval($prod * 0.1);
	$srokd = intval(($r['LastDate'] - time()) / 86400) + 1;
?>							
				
			<div id="load<?=$r['Uid']; ?>">
				<div class="shop" id="depo<?=$r['Uid']; ?>">

					<?php if($type < 6) { ?>

					<span onclick="process('','/process/deposits.php?action=update&ident=<?=$r['Uid']; ?>','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?>')">					
						<div class="update">
							<img src="/images/70.jpg"/>
								
							<span class="title"><img src="/images/icons/buy.jpg"/> - <?=$PriceModer[$type]; ?></span>
							<span class="title"><img src="/images/icons/opit.jpg.png"/> + <?=$PriceModer[$type] * 0.5; ?></span>
						</div>
					</span>	

					<?php } ?>
						<table>
							<tbody>
								<tr>
									<br><td style="padding-left:15px;font-weight:700;" align="top"><?=$Name[$type]; ?></td>
								</tr>

								<tr>
									<td>
										<img style="margin-top: 30px;margin-left: 80px;" src="/images/shop/image_<?=$r['Type']; ?>.png" width="140"/>
									</td>
								</tr>

								<tr>
									<td align="left">
										<img src="/images/resource<?=$r['Type']; ?>.png" style="height:40px;padding-left:10px;"/>
									</td>
									<td>
										<span class="title cols" id="depores<?=$r['Uid']; ?>"><?=$prod; ?> шт.</span>
									</td>
								</tr>

								<tr>
									<td align="left">
										<img src="/images/icons/buy.gif" style="height:40px;padding-left:10px;"/>
									</td>
									<td>
										<span class="title cols" id="depores<?=$r['Uid']; ?>"><?=$PercMoth[$type];?>% в месяц</span>
									</td>
								</tr>

								<tr style="display:none;">
									<td align="left">
										<img src="/images/icons/buy.gif" style="height:35px;padding-left:10px;"/>
									</td>
									<td>
										<span class="title cols" id="depores<?=$r['Uid']; ?>"><?=$Goldenn; ?></span>
									</td>
								</tr>

								<tr style="">
									<td align="left">
										<img src="/images/icons/level.png" style="height:35px;padding-left:10px;"/>
									</td>
									<td>
										<span class="title cols" id="depoexp<?=$r['Uid']; ?>"><?=$Reuting; ?></span>
									</td>
								</tr>


								<?php if(intval(($r['LastDate'] - time()) / 86400) <= 0) { ?>
									<tr>
										<td>
											<div class="result"></div>
											<span class="button" onclick="process('','/process/deposits.php?action=dell&ident=<?=$r['Uid']; ?>','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?>')">Снести здание</span><br/>
											<span class="button" onclick="process('','/process/deposits.php?action=rem&ident=<?=$r['Uid']; ?>','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?>')">Произвести ремонт за <img src="/images/moneyin.png" class="title-image"/><?=$Remont[$r['Uid']]; ?></span></span>
										
										</td>
									</tr>
								<?php } else { ?>

								<tr>
									<td align="left">
										<img src="/images/icons/clock.png" style="height:35px;padding-left:10px;"/>
									</td>
									<td>
										<span class="title cols" id="depoexp<?=$r['Uid']; ?>"><?=$srokd; ?> дней</span>
									</td>
								</tr>
								<tr><td>			
								<div class="result"></div>
								<div class="butshop">
									<button class="buy" onclick="process('','/process/deposits.php?action=sell&ident=<?=$r['Uid']; ?>','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?> .result','depo<?=$r['Uid']; ?>')">Продать ресурсы</button>	
								</div>
								</td></tr>
							</tbody>
						</table>
					<?php } ?>

				<script type="text/javascript">$("#depo<?=$r['Uid']; ?> .profitability").height($("#depo<?=$r['Uid']; ?> .profitability").width())</script>
				</div>
			</div>
			
					<?php } } else { echo '<center>У вас нет купленной техники!</center>'; } ?>			

		</div>


                                </td>
                            </tr>
                        </tbody>
                    </table>                                
                    </td><!-- CONTENT USER -->
                </tr>
            </tbody>
        </table>
    </td>