$query = $_SGLOBAL['db']->query('SELECT i.* FROM '.tname('spaceitems').' i WHERE i.itemid>\''.$itemid.'\' AND catid = \''.$news['catid'].'\' AND type=\'news\' ORDER BY itemid LIMIT 0,1');
$newspre = $_SGLOBAL['db']->fetch_array($query);
$query = $_SGLOBAL['db']->query('SELECT i.* FROM '.tname('spaceitems').' i WHERE i.itemid<\''.$itemid.'\' AND catid = \''.$news['catid'].'\' AND type=\'news\' ORDER BY itemid DESC LIMIT 0,1');