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