<div id="div_21">
<p><span class="div_bbig">Наши проекты</span></p>

<FORM METHOD="POST" class="black_block sm" style="color:#FCCE92;font-size: smaller;" id="fchangedirect" action="<?php echo $_SERVER['SCRIPT_NAME'];?>#fchangedirect">
<select class="cinline" name="direct_job" onchange="javascript:document.getElementById('fchangedirect').submit();">
<option>Выберите направление</option>
<?php 
for($k=1;$k<=count($odirection);$k++){
?>
<option value="<?php echo $k; ?>" <?php if ($_POST['direct_job'] == $k) {echo "selected";} ?>><?php echo $odirection[$k][0]; ?></option>
<?php 
}
?>
</select>
<input class="cinline" title="Сортировать результаты поиска по возрастанию" name="in_orderby" type="Checkbox" <?php if ($_POST['in_orderby'] == 'on'){echo " checked";} ?> onclick="javascript:document.getElementById('fchangedirect').submit();">&nbsp;По возрастанию</FORM>
<?php
if (isset($_POST['direct_job']) && ($_POST['direct_job'] <> "Выберите направление")){
	$_POST['direct_job'] = intval($_POST['direct_job']);
	if (isset($_GET['tag'])){
		$query = "select obd_0.name, obd_0.desk, obd_0.jobid, obd_0.directionid, tblTag_0.p_tag from obd_0, tblTag_0 where obd_0.directionid = " . $_POST['direct_job'] . " and tblTag_0.p_tag = " . $_GET['tag'] . " and tblTag_0.word_id = obd_0.jobid";
	}else{
		$query = "select name, desk, jobid, directionid from obd_0 where directionid = " . $_POST['direct_job'];
	}
	$query .= " ORDER BY jobid";
	if ($_POST['in_orderby'] == 'on'){$query .= " asc";}else{$query .= " desc";}

	//проверка лимита
	$result = mysql_query($query);
	$z = mysql_num_rows($result);
	if (isset($_GET['l'])){$query .= " limit " .$_GET['l'] . "," . $cur_list_numb;}else{$query = $query . " limit 0," . $cur_list_numb;}
	$result = mysql_query($query);
	$num_result = mysql_num_rows($result);
?>
<div class="black_block_c">
<?php
	if ($num_result){
	for ($i=0; $i<$num_result; $i++){
		$row = mysql_fetch_array($result);
require "../find_project.php";
	}
	}else{
		if ($_POST['direct_job'] == 1){
			echo '<div class="p_block">&nbsp;</div><center>Все проекты, связанные с дизайном интерьеров, представлены в <a class="sm" href="galary.php?u=0">галерее</a>.<br /><br /></center>';
		}else{none_project();}
	}
?>
</div>
<?php
require "../find_project_res.php";
}
?>
</div>
