0 || 
	strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || 
	strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
	header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
	echo '';
?>
	
if (!$result = $DB->query('SELECT * FROM photos WHERE id=\'$i\''))
{
	showError('MySQL error');
}
if ($result->num_rows == 0)
{
	$row = array(
	'author' => '--',
	'description' => 'Zdjęcie usunięte',
	'photo_name' => 'no_image.png',
	'id' => $i
	);	
}
else
{
	$row = $result->fetch_assoc();
	$row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author'];
	$row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description'];
}?>
		
$prev = $DB->query('SELECT COUNT(id) FROM photos WHERE id<'.$id)->fetch_row(); #check if there are some previous photos
$prev=$prev[0];
if($prev>0) {
$prev=$DB->query('SELECT * FROM photos WHERE id<'.$id.' ORDER BY id DESC LIMIT 1;')->fetch_assoc(); #if yes, get the previous photo's data
?>
		
}
else {
?>
		
}
$next = $DB->query('SELECT COUNT(id) FROM photos WHERE id>'.$id)->fetch_row(); #check if there are some next photos
$next=$next[0];
if($next>0) {
$next=$DB->query('SELECT * FROM photos WHERE id>'.$id.' ORDER BY id ASC LIMIT 1;')->fetch_assoc(); #if yes, get the next photo's data
?>
		
}
else {
?>
		
}
?>