<?php
if (ismode()){
$tmp1 = "obd_";
$tmp2 = "";
$tmp_mnumb = 100 + $_SESSION['listwidth']*$_SESSION['listwidth']*($_SESSION['listwidth'] - 1);
if ($_GET['p'] == 3){$tmp1 .= "0";}else{$tmp1 .= ($_GET['p'] - 1);}
?>
<table cellspacing="0" cellpadding="0" style="width:100%;"><tr><td class="black_block mdl"><form METHOD="POST" class="cinline" id="comt_reload" action="<?php echo $_SERVER['REQUEST_URI'];?>">
<select class="cinline" name="comt_numb" onchange="javascript:document.getElementById('comt_reload').submit();">
<?php
for($k=3;$k<10;$k++){
	echo "<option";
	if ($k == $_SESSION['comtnumb']) {echo " selected";}
	echo ">" . $k . "</option>";
}
?>
</select></form></td><td class="black_block pg10 wnw rgt mdl" style="width:20%;">
<?php
$result = mysql_query("select jobid from " . $tmp1 . " order by jobid desc");
$num_result = mysql_num_rows($result);
$rownext = mysql_fetch_array($result);
if ($_GET['u'] <> $rownext['jobid']){
echo '<a class="a_black2" title="Открыть страницу записи" href="';
if ($_GET['p'] < 100){echo $site_pages[$_GET['p']][1] . "?";} else {echo "/online.php?p=" . $_GET['p'] . "&";}
echo 'u=' . $rownext['jobid'] . '">Последняя запись</a>';
}
?>
&nbsp;</td><td class="black_block clr_or cntr" style="width:60%;">
&nbsp;<input class="cinline" name="npr" checked title="поиск в этой базе данных" type="Radio" value="" id="pr_1" onclick="javascript:fprpn('2');"><label class="ssm" title="поиск только на нашем сайте"  for="pr_1">Следующие записи</label>
<input class="cinline" name="npr" type="Radio" value="" id="pr_2" onclick="javascript:fprpn('1');"><label class="ssm" for="pr_2">Предыдущие записи</label>
</td><td class="black_block pg10 wnw lft mdl" style="width:20%;">&nbsp;
<?php
$result = mysql_query("select jobid from " . $tmp1 . " order by jobid asc");
$num_result = mysql_num_rows($result);
$rownext = mysql_fetch_array($result);
if ($_GET['u'] <> $rownext['jobid']){
echo '<a class="a_black2" title="Открыть страницу записи" href="';
if ($_GET['p'] < 100){echo $site_pages[$_GET['p']][1] . "?";} else {echo "/online.php?p=" . $_GET['p'] . "&";}
echo 'u=' . $rownext['jobid'] . '">Первая запись</a>';
}
?>
</td></tr></table>
<div class="bl_w2" id="pr_pn1" style="display:block;">
<?php
$result = mysql_query("select * from " . $tmp1 . " where jobid > " . $_GET['u'] . " order by jobid asc");
$num_result = mysql_num_rows($result);
if ($num_result){
if ($num_result < $_SESSION['comtnumb']){$tmpoterprj = $num_result;}else{$tmpoterprj = $_SESSION['comtnumb'];}
for ($k=0; $k<$tmpoterprj; $k++){
	$rownext = mysql_fetch_array($result);
?><?php echo setmode(($_GET['p'] < 100?$site_pages[$_GET['p']][1] . "?":"/online.php?p=" . $_GET['p'] . "&") . "u=" . $rownext['jobid']); ?><a title="Открыть страницу записи" href="<?php if ($_GET['p'] < 100){echo $site_pages[$_GET['p']][1] . "?";} else {echo "/online.php?p=" . $_GET['p'] . "&";} ?>u=<?php echo $rownext['jobid']; ?>">
<?php
$tmp2 = stripslashes($rownext['name']) . " ";

$rownext['word2'] = stripslashes($rownext['word2']);
if (isset($rownext['word2']) and isset($basename[$_GET['p']-1])){
	if ($rownext['word2'] <> "нет" and $rownext['word2'] <> "нет описания"){
		$tmp2 .= $rownext['word2'];
	}
}
if (strlen($tmp2) < $tmp_mnumb){echo $tmp2;}else{echo substr($tmp2, 0, $tmp_mnumb) . "...";}
echo "</a><br />";
} } ?>
</div>
<div class="bl_w2" id="pr_pn2" style="display:none;">
<?php
$query = "select * from " . $tmp1 . " where jobid < " . ($_GET['u']) . " order by jobid desc";
$result = mysql_query($query);
$num_result = mysql_num_rows($result);
if ($num_result){
if ($num_result < $_SESSION['comtnumb']){$tmpoterprj = $num_result;}else{$tmpoterprj = $_SESSION['comtnumb'];}
for ($k=0; $k<$tmpoterprj; $k++){
	$rownext = mysql_fetch_array($result);
?>
<?php echo setmode(($_GET['p'] < 100?$site_pages[$_GET['p']][1] . "?":"/online.php?p=" . $_GET['p'] . "&") . "u=" . $rownext['jobid']); ?><a title="Открыть страницу записи" href="<?php if ($_GET['p'] < 100){echo $site_pages[$_GET['p']][1] . "?";} else {echo "/online.php?p=" . $_GET['p'] . "&";} ?>u=<?php echo $rownext['jobid']; ?>">
<?php

$tmp2 = stripslashes($rownext['name']) . " ";

$rownext['word2'] = stripslashes($rownext['word2']);
if (isset($rownext['word2']) and isset($basename[$_GET['p']-1])){
	if ($rownext['word2'] <> "нет" and $rownext['word2'] <> "нет описания"){
		$tmp2 .= $rownext['word2'];
	}
}
if (strlen($tmp2) < $tmp_mnumb){echo $tmp2;}else{echo substr($tmp2, 0, $tmp_mnumb) . "...";}
echo "</a><br />";
} } ?>
</div>
<?php } ?>