function abbreviate($text, $val){
$text = iconv('utf8', 'windows-1251', $text);
if(strlen($text) > $val){
$text = substr($text, 0, $val) . '...';
$text = iconv('windows-1251', 'utf8', $text);
}else{
$text = iconv('windows-1251', 'utf8', $text);
}
return $text;
}