<?

$test=array
(
array('d67c7c','8e5252','ce8686','a36161'),
array('d69a7c','8e6652','ce9e86','a37761'),
array('d6b87c','8e7a52','ceb686','a38d61'),
array('d6d67c','8e8e52','cece86','a3a361'),
array('b8d67c','7a8e52','b6ce86','8da361'),
array('9ad67c','668e52','9ece86','77a361'),
array('7cd67c','528e52','86ce86','61a361'),
array('7cd69a','528e66','86ce9e','61a377'),
array('7cd6b8','528e7a','86ceb6','61a38d'),
array('7cd6d6','528e8e','86cece','61a3a3'),
array('7cb8d6','527a8e','86b6ce','618da3'),
array('7c9ad6','52668e','869ece','6177a3'),
array('7c7cd6','52528e','8686ce','6161a3'),
array('9a7cd6','66528e','9e86ce','7761a3'),
array('b87cd6','7a528e','b686ce','8d61a3'),
array('d67cd6','8e528e','ce86ce','a361a3'),
array('d67cb8','8e527a','ce86b6','a3618d'),
array('d67c9a','8e5266','ce869e','a36177'),
array('b2b2b2','4c4c4c','afafaf','939393'),
array('cccccc','666666','c9c9c9','adadad'),
array('e5e5e5','7f7f7f','e2e2e2','c6c6c6'),
array('995858','512f2f','825454','5b3737'),
array('996e58','513a2f','826354','5b4337'),
array('998358','51462f','827254','5b4f37'),
array('999958','51512f','828254','5b5b37'),
array('839958','46512f','728254','4f5b37'),
array('6e9958','3a512f','638254','435b37'),
array('589958','2f512f','548254','375b37'),
array('58996e','2f513a','548263','375b43'),
array('589983','2f5146','548272','375b4f'),
array('589999','2f5151','548282','375b5b'),
array('588399','2f4651','547282','374f5b'),
array('586e99','2f3a51','546382','37435b'),
array('585899','2f2f51','545482','37375b'),
array('635482','43375b','6e5899','3a2f51'),
array('835899','462f51','725482','4f375b'),
array('995899','512f51','825482','5b375b'),
array('995883','512f46','825472','5b374f'),
array('99586e','512f3a','825463','5b3743'),
array('666666','000000','636363','474747'),
array('7f7f7f','191919','7c7c7c','606060'),
array('999999','333333','969696','7a7a7a')
);
if (!isset($ku))
{
$test[$ku['panel']][0]='7c9ad6';
$test[$ku['panel']][1]='52668e';
$test[$ku['panel']][2]='869ece';
$test[$ku['panel']][3]='6177a3';
$per='6780b2';
}
else $per=$ku['panel_style'];

?><style>
.panelD {
position: relative;
background: #<?echo $per;?>;
background: -webkit-gradient(linear,left top,left bottom,from(#<?echo $test[$ku['panel']][0].'),to(#'.$test[$ku['panel']][1];?>));
background: -moz-linear-gradient(top,#<?echo $test[$ku['panel']][0].',#'.$test[$ku['panel']][1];?>);
background: -o-linear-gradient(top,#<?echo $test[$ku['panel']][0].',#'.$test[$ku['panel']][1];?>);
background: -ms-linear-gradient(top,#<?echo $test[$ku['panel']][0].',#'.$test[$ku['panel']][1];?>);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#<?echo $test[$ku['panel']][0]." ',endColorstr='# ".$test[$ku['panel']][1];?>');
zoom: 1;}

a.panel_link {
display: block;
text-align: center;
padding: 3px;}

a.panel_link:hover {background: #<?echo $per;?>;}


.text {
color: #ffffff;
text-decoration: none;
font-size: medium;
}

#panel_n table a{
border-left: 1px solid #<?echo $test[$ku['panel']][2];?>;
border-right: 1px solid #<?echo $test[$ku['panel']][3];?>;
border-bottom: 1px solid #<?echo $test[$ku['panel']][3];?>;
border-top: 1px solid #<?echo $test[$ku['panel']][3];?>;}
.ncount {
color: #ffff00;
font-size: medium;
vertical-align: bottom;}
.time {
padding: 3px;
background: #d0d2d6;
border-left: 1px solid #cccaca;
border-right: 1px solid #cccaca;
border-bottom: 1px solid #b3b3b3;
font-size: small;
text-align: right;
color: #000000;
}

</style>
<?

if ($set['web']==false){
if (isset($ku)){
$count_mon=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_treeground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND (`time_money` = '$time' OR `time_money` < '$time')"),0);$q=mysql_query("SELECT * FROM `kolhoz_treeground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_golz=null;
while($post=mysql_fetch_array($q)){
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)$count_golz++;
}
$q=mysql_query("SELECT * FROM `kolhoz_treeground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_mon=0;
while($post=mysql_fetch_array($q)){
$d_money=floor($post['time_money']/(4*3600));
if($d_money>0)$count_mon++;
}
if($count_golz>$count_mon)$count_zag=$count_mon;else $count_zag=$count_mon;

//загоны
$count_mon=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND (`time_money` = '$time' OR `time_money` < '$time')"),0);$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_gol=null;
while($post=mysql_fetch_array($q)){
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)$count_gol++;
}
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_mon=0;
while($post=mysql_fetch_array($q)){
$d_money=floor($post['time_money']/(4*3600));
if($d_money>0)$count_mon++;
}
if($count_gol>$count_mon)$count_zag=$count_mon;else $count_zag=$count_mon;
echo '<div id="panel_n" class=" "><div class="panelD"><table style="width:100%" cellspacing="0" cellpadding="0"><tr>
<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;"><a style="border-left:none !important;" class="panel_link user_color_link" href="?myfarm" title="Грядки">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/icons/plants.png" alt="o">':'<span class="text">Гр</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)!=0?"".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)."":null)."</div></a></td>";





echo '<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;"><a class="panel_link user_color_link" href="?f_myfarm" title="Пруды">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/fish/fishs.png" alt="o">':'<span class="text">Пр</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground_f` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)!=0?"".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground_f` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)."":null)."</div></a></td>";

echo '<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;"><a class="panel_link user_color_link" href="?mypetfarm" title="Загоны">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/icons/animal.png" alt="o">':'<span class="text">Зг</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".$count_gol."</div></a></td>";

echo '<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;"><a class="panel_link user_color_link" href="?mytreefarm" title="Сады">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/icons/tree.png" alt="o">':'<span class="text">Сад</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".$count_golz."</div></a></td>";

echo '<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;"><a class="panel_link user_color_link" href="?mycellar" title="Погреб">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/icons/recipes.png" alt="o">':'<span class="text">Пг</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka2` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `cultivator2` = '0' OR `time` = '$time' OR `time` < '$time')"),0)!=0?"".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka2` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `time_water2` = '$time' OR `time` = '$time' OR `cultivator2` = '0' OR `time` = '$time' OR `time` < '$time')"),0)."":null)."</div></a></td>";

echo '<td style="vertical-align:top;width:'.($dn==0?'15':'20').'% ;border-right:none !important;"><a class="panel_link user_color_link" href="?sh_myfarm" title="Шахты">'.($ku['panel_vid']==0?'<img width="16" height="16" src="img/shaht/harvest.png" alt="o">':'<span class="text">Шхт</span>').' ';
echo "<div style='position:relative;color:#fff;font-size:x-small;border-radius:2.5em;min-width:1.2em;background: #6c0;display:inline-block'>".(mysql_result(mysql_querll("SELECT COUNT(`id`) FROM `kolhoz_ground_sh` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)!=0?"".mysql_result(mysql_querll("SELECT COUNT(`id`) FROM `kolhoz_ground_sh` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)."":null)."</div></a></td>";

echo '</tr></table></div></div>';
}}


?>