<?php include "../fnd_bd.php"; ?>
<?php include "../fnd_bd_sql.php"; ?>
<div class="black_block_c">
<?php
	if ($num_result){
	for ($i=0; $i<$num_result; $i++){
		$row = mysql_fetch_array($result);
?>
<div class="p_block"><?php
echo "<span style='font-weight : bold;'>[&nbsp;";
if (isset($_GET['l'])){
	echo $i + 1 + $_GET['l'];}
else{
	echo $i + 1;
}
echo  "&nbsp;]</span> ";
if ($_SESSION['CURR_LIMIT'] < $tmp_get_stop_limit){ echo  setarch("/online.php?p=" . ($_GET['p'] + 1) . "&u=" . $row['jobid']); } ?>
<?php echo setmode("online.php?p=" . ($_GET['p'] + 1) . "&u=" . $row['jobid']); ?><a class="a_show_hide" title="Открыть описание" href="online.php?p=<?php echo $_GET['p'] + 1;  ?>&u=<?php echo $row['jobid']; ?>">
<?php echo stripslashes($row['name']) ?></a>
</div>
<span class="sm"><?php

echo "<span class='bld'>" . $basename[$_GET['p']] . "</span>&nbsp;";

$result2 = mysql_query("select obd_129.name, obd_129.jobid, tblTag_129.p_tag, tblTag_129.word_id from obd_129, tblTag_129 where tblTag_129.p_tag = " . ($row['jobid']-1) . " and tblTag_129.word_id = obd_129.jobid");
for ($k=0; $k<mysql_num_rows($result2); $k++){
	$row2 = mysql_fetch_array($result2);
	echo "<a target='_blank' href='online.php?p=130&u=" . $row2['jobid'] . "'>" . $row2['name'] . "</a> ";
}

?></span>
<table style="width:100%;"><tr><td class="sm" style="padding:0px 7px;width:55%;">
<span class="bld">Комментариев&nbsp;[</span>
<?php
	mysql_select_db('onestyle_w');
	$result2 = mysql_query("select c_word_id from octblTag_" . ($_GET['p'] + 1) . " where c_word_id= " . $row['jobid']);
?>
<a class="a_show_hide" title="Открыть комментарии к описанию" target="_blank" href="online.php?p=<?php echo $_GET['p'] + 1;  ?>&u=<?php echo $row['jobid']; ?>#add_comment">
<?php
	echo mysql_num_rows($result2) . "</a>";
	echo "<span class='bld'>&nbsp;]&nbsp;&nbsp;</span>Просмотров<span class='bld'>&nbsp;[&nbsp;</span>";
	$result2 = mysql_query("select * from " . $view . " where c_word_id= " . $row['jobid']);
	if (mysql_num_rows($result2)){
		$row2 = mysql_fetch_array($result2);
		echo $row2['c_count'];
	}else{
		echo "0";
	}

	echo "<span class='bld'>&nbsp;]&nbsp;&nbsp;</span>Рейтинг<span class='bld'>&nbsp;[&nbsp;</span>";

	$result2 = mysql_query("select c_word_id, c_rcount, c_rating from ocView_" . ($_GET['p'] + 1) . " where c_word_id= " . $row['jobid']);

	if (mysql_num_rows($result2)){
		$row2 = mysql_fetch_array($result2);
		if ($row2['c_rcount'] == 0){echo "0";}else{echo number_format((float)($row2['c_rating']/$row2['c_rcount']), 2);}
	}else{
		echo "0";
	}
	echo "<span class='bld'>&nbsp;]</span>";

	mysql_select_db('onestyle_testmy');
?>
</td><td class="sm rgt" style="padding:0px 3px;width:45%;">
<?php
	$result4 = mysql_query("select p_tag, word_id from " . $tbl . " where word_id=".$row['jobid']);
	$num_result4 = mysql_num_rows($result4);
	for ($k=0; $k<$num_result4; $k++){
		$row4 = mysql_fetch_array($result4);
		echo "<a href='javascript:document.getElementById(" . chr(34) . "fchangedirect" . chr(34) . ").setAttribute(" . chr(34) . "action" . chr(34) . ", " . chr(34) . "/online.php?p=" . $_GET['p'];
		if (isset($_GET['u'])){echo "&u=" . $_GET['u'];}
		if (isset($_GET['tag']) and ($_GET['tag']==$row4['p_tag'])){echo  chr(34) . ");document.getElementById(" . chr(34) . "fchangedirect" . chr(34) . ").submit();'>";}else{echo "&tag=" . $row4['p_tag'] . chr(34) . ");document.getElementById(" . chr(34) . "fchangedirect" . chr(34) . ").submit();'>";}
		if (isset($_GET['tag']) and ($_GET['tag']==$row4['p_tag'])){echo "<span class='div_big'>";}
		echo $tags[$_GET['p']][$row4['p_tag']];
		if (isset($_GET['tag']) and ($_GET['tag']==$row4['p_tag'])){echo "</span>";}
		echo "</a> ";
	}
?>
</td></tr><tr><td class="sm" colspan="2" style="padding:3px 7px 0px 7px;">
<?php
$tmp_mnumb = 95 + $_SESSION['listwidth']*$_SESSION['listwidth']*($_SESSION['listwidth'] - 1);
if (strlen($row['desk']) > $tmp_mnumb) {
	echo filter_find($_POST['user_name'], substr(strip_tags(str_replace("<br />", " ", str_replace("</p>", " ", stripslashes($row['desk'])))), 0, $tmp_mnumb)) . "...";
}else{
	echo filter_find($_POST['user_name'], strip_tags(str_replace("<br />", " ", str_replace("</p>", " ", stripslashes($row['desk'])))));
} ?>
</td></tr></table>
<?php
	}
	}else{
		none_project();
	}
?>
</div>
<?php require "../find_project_res.php"; ?>
<?php finds5last_get($_GET['p']); ?>
</td></tr></table>