<?
function avatar($id){
	global $set;
	$p = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='$id'  LIMIT 1"));
	$a = mysql_fetch_array(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user`='$id' AND `avatar`='1' LIMIT 1"));
	if (is_file(H."sys/gallery/50/$a[id].$a[ras]"))
	echo "<a href='/foto/$id/$a[id_gallery]/$a[id]/'><img src='/foto/foto50/$a[id].$a[ras]' alt='$a[name]' alt='naSIMbe.ru'></a>";
	else
	echo "<img src='/style/icons/avatar.png' alt='avatar' width='50' alt='naSIMbe.ru'>";
}

function avatar_ank($id){
	global $set, $user;
	$p = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='$id'  LIMIT 1"));
	$a = mysql_fetch_array(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user`='$id' AND `avatar`='1' LIMIT 1"));
	if (is_file(H."sys/gallery/128/$a[id].$a[ras]"))	{
	echo "<a href='/foto/$id/$a[id_gallery]/$a[id]/'><img  src='/foto/foto128/$a[id].$a[ras]' alt='$a[name]' class='avatar' alt='naSIMbe.ru' ></a>";	}
	elseif (isset($user) && $user['id'] == $p['id'])	{
	echo "<a href='/avatar.php'><img src='/style/icons/avatar.png' width='128' alt='naSIMbe.ru'></a>";	}
	else	{
	echo "<img src='/style/icons/avatar.png' width='128' alt='naSIMbe.ru'>";	}
}
function avatar_ank_web($id){
	global $set, $user;
	$p = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='$id'  LIMIT 1"));
	$a = mysql_fetch_array(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user`='$id' AND `avatar`='1' LIMIT 1"));
	if (is_file(H."sys/gallery/128/$a[id].$a[ras]"))	{
	echo "<a href='/foto/$id/$a[id_gallery]/$a[id]/'><img  src='/foto/foto640/$a[id].$a[ras]' alt='$a[name]' width='200' class='avatar' alt='naSIMbe.ru' ></a>";	}
	elseif (isset($user) && $user['id'] == $p['id'])	{
	echo "<a href='/avatar.php'><img src='/style/icons/avatar.png' width='200' alt='naSIMbe.ru'></a> ";	}
	else	{
	echo "<img src='/style/icons/avatar.png' width='200' alt='naSIMbe.ru'> ";	}
}
?>