<?
function group($user = NULL)
{
	global $set, $time;
	static $users;
	
	if (!isset($users[$user]))
	{
		if (mysql_result(mysql_query("SELECT COUNT(id) FROM `user` WHERE `id` = '$user' AND `date_last` > '" . (time()-600) . "' LIMIT 1"),0) == 1)
		{
			if ($set['show_away'] == 0)$on = 'online';
			else
			{
				$ank = mysql_fetch_assoc(mysql_query("SELECT `date_last` FROM `user` WHERE `id` = '$user' LIMIT 1"));
				if ((time() - $ank['date_last']) == 0)
				$on = 'online';
				else
				$on = 'away: ' . (time()-$ank['date_last']) . ' сек';
			}
			$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$user' LIMIT 1"));
if ($ank['pol']==1) $users[$user] ='<img src="/style/icons/online/man_on.gif" alt="" class="icon"/>';
else 
$users[$user] ='<img src="/style/icons/online/woman_on.gif" alt="" class="icon"/>';
}
else
{
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$user' LIMIT 1"));

if ($ank['pol']==1) return '<img src="/style/icons/online/man_off.gif" alt="" class="icon"/>';
else 
return '<img src="/style/icons/online/woman_off.gif" alt="" class="icon"/>';
}
			
	}
	return $users[$user];
}
?>